Gentoo Archives: gentoo-dev

From: Ryan Hill <dirtyepic@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: Improve the security of the default profile
Date: Sat, 07 Sep 2013 21:01:26
Message-Id: 20130907151110.13ebc8a2@caribou.gateway.2wire.net
In Reply to: [gentoo-dev] Re: Improve the security of the default profile by Martin Vaeth
1 On Sat, 7 Sep 2013 18:10:42 +0000 (UTC)
2 Martin Vaeth <vaeth@××××××××××××××××××××××××.de> wrote:
3
4 > Ryan Hill <dirtyepic@g.o> wrote:
5 > >
6 > > * -fstack-protector{-all}
7 > > No thank you. -fstack-protector has very limited coverage
8 >
9 > I'd say it covers most cases where bugs can be made,
10 > practically without a severe impact on execution time or code size.
11
12 The numbers I've seen show a maximum of 5% coverage for code that has a large
13 number of functions containing char arrays on the stack. Most code doesn't fall
14 into that category. Coverage of perl was 0.5%, xorg 5%, kernel 3%. Those are
15 really old numbers though. The most recent I've seen is Chromium's coverage is
16 <2%. There is an upper bound of 8% performance overhead using -fstack-protector
17 according to the design spec. If you guys are okay with that then we can try
18 enabling it for 4.8.1.
19
20 > > * -Wl,-z,relro
21 > > Enabled by default since binutils 2.18
22 >
23 > This gives its real impact on secutiry only when combined with
24 >
25 > * -Wl,-z,now
26 >
27 > The latter is not enabled by default AFAIK.
28
29 That's a bit misleading. Immediate binding does allow the GOT to be made
30 readonly but relro does a lot more than that. In any case this is a firm no.
31 The increase in loading times for apps that link lots of libraries is
32 significant (if it wasn't, we wouldn't need lazy loading :p). If you want full
33 relro, enable it yourself or use hardened.
34
35 > I would like to suggest also another flag
36 >
37 > * -Wl,-z,noexecstack
38 >
39 > This should be the default, but e.g. some broken gcc versions
40 > forgot this default when using -flto.
41 > I am using this flag since I realized this -flto bug and never
42 > had any problems with it.
43
44 Well, portage will already tell you if your package installed any binaries with
45 executable stacks and I don't see many of those warnings that aren't binary
46 packages so I think we're good.
47
48 >
49 > > * -Wl,--hash-style={both,gnu}
50 >
51 > I don't know what this has to do with security.
52
53 I'm just responding to the list on the Ubuntu page.
54
55 > However, isn't it time to use "gnu" now for all users? Except for
56 > very strange binary-only code it should not cause any problems.
57 > The majority of users would not realize a difference but profit
58 > from smaller binaries.
59
60 Sure, but the sysv hash is teeny and backward compatibility is always nice if
61 it's next to free.
62
63 Here are some more resources if anyone is interested:
64
65 https://wiki.debian.org/Hardening
66 https://bugs.archlinux.org/task/18864
67 https://wiki.gentoo.org/wiki/Project:Hardened/GNU_stack_quickstart
68 http://tk-blog.blogspot.ca/2009/02/relro-not-so-well-known-memory.html
69
70 --
71 Ryan Hill psn: dirtyepic_sk
72 gcc-porting/toolchain/wxwidgets @ gentoo.org
73
74 47C3 6D62 4864 0E49 8E9E 7F92 ED38 BD49 957A 8463

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] Re: Improve the security of the default profile "Rick \\\"Zero_Chaos\\\" Farina" <zerochaos@g.o>
[gentoo-dev] Re: Improve the security of the default profile Martin Vaeth <vaeth@××××××××××××××××××××××××.de>
[gentoo-dev] Re: Improve the security of the default profile Martin Vaeth <vaeth@××××××××××××××××××××××××.de>
Re: [gentoo-dev] Re: Improve the security of the default profile "Anthony G. Basile" <blueness@g.o>