Gentoo Archives: gentoo-hardened

From: "Peter S. Mazinger" <ps.m@×××.net>
To: Alexander Gabert <pappy@g.o>
Cc: gentoo-hardened@g.o
Subject: [gentoo-hardened] Re: hardened-gcc-3.3.2.1
Date: Mon, 15 Dec 2003 12:18:01
Message-Id: Pine.LNX.4.44.0312151848160.27598-100000@lnx.bridge.net
In Reply to: [gentoo-hardened] Re: hardened-gcc-3.3.2.1 by Alexander Gabert
1 On Mon, 15 Dec 2003, Alexander Gabert wrote:
2
3 > hi Peter, thanks for your bug reports,
4 >
5 > # conservative PIE PIC and SSP options, on by default, suppress flags
6 > take precedence
7 > HGCC_33_DEFAULT_SPECS_CPP_SECTION_PIC_ACTIVATION="%{!yet_exec: %{!nopie:
8 > -D__PIC__ -D__pic__ -DPIC}}"
9 omitted -Dpic (although I haven't found any app needing it).
10
11 > HGCC_33_DEFAULT_SPECS_CC1_SECTION_PIC_ACTIVATION="%{!yet_exec: %{!nopie:
12 > -fPIC -fpie}}"
13 Why have you added -fpie?
14
15 this has the problems with libraries as described earlier (try
16 zlib-1.2.1.ebuild, comment the pic patch and build the shared lib, check
17 with readelf -d for TEXTREL. I have to remove -fpie from it, also if it
18 somehow could work, I think it should be
19 %{!yet_exec: %{!nopie: -fPIC %{!static|!shared: -fpie}}} (the static part
20 is solved probably with %{!static: %{pie:-pie}} at the end of the
21 specfile, but for shared libs I do not think -fpie is good.
22
23 > HGCC_33_DEFAULT_SPECS_CC1_SECTION_SSP_ACTIVATION="%{!yno_propolice:
24 > %{!fno-stack-protector: -fstack-protector %{!fno-stack-protector-all:
25 > -fstack-protector-all -fforce-addr}}}"
26
27 I like this one better, have you checked that fforce is only needed by
28 -all?
29
30 > # the Scrt1.o provided by Redhat has relocation errors when -pie builds
31 > executables with -shared and no main function
32 > HGCC_33_DEFAULT_SPECS_STRTSECTION_CRT_ACTIVATION="crt1S.o"
33
34 I'll stay with my Scrt1.o for uClibc then (I do not have another one ;-)
35
36 > # final static linking executables breaks when -pie is given
37 > HGCC_33_DEFAULT_SPECS_LINKSECTION_PIE_ACTIVATION="%{!yet_exec: %{!nopie:
38 > %{!static: -pie -z combreloc}}}"
39 this is the same as earlier and provides one of the doubles.
40
41 >
42 > can you please try these lines in hcc.conf and activate them?
43 >
44 > TIA,
45 >
46 > Alex
47 >
48 > On Mon, 2003-12-15 at 15:06, Peter S. Mazinger wrote:
49 > > On Mon, 15 Dec 2003, Peter S. Mazinger wrote:
50 > >
51 > > New problem: I have rebuilt rpm-4.0.4 and got text relocation in
52 > > librpmbuild shared library hardened-gcc-3.3.2.0 worked)
53 > > I think we have to enforce -fPIC for all (also for static, because if
54 > > later a binary is built against static and dynamic libraries, it will have
55 > > problems (like bash's included readline, this is static)
56 > > The problem happens with libraries due to the change in cc1 section from
57 > > -fPIC to -fPIC -fpie (simple test: build zlib w/o the pic patch)
58 > >
59 > > > Hello!
60 > > >
61 > > > The link section has a !static redundancy (from EXC_FRONT and
62 > > > PIE_ACTIVATION), see attached diff (edited manually based on hcc.conf and
63 > > > the scripts)
64 > > >
65 > > > Why is crt1S.o added in the default config, the conservative one adds
66 > > > Scrt1.o? (crt1S.S is the same as in hardened 2.4.6 non_csu version), it is
67 > > > rather a glibc issue having it or not.
68 > > >
69 > > > Also I am not so sure about the stack-protector[-all] running together, I
70 > > > have the impression, that they work separately, but for all cases I would
71 > > > suggest the possibility to use only fstack-protector if -all is
72 > > > deactivated (there could be some apps that cannot be built with -all) like
73 > > > this, or similar
74 > > > %{!yno_propolice: %{!fno-stack-protector: -fstack-protector}
75 > > > %{!fno-stack-protector-all: -fstack-protector-all}}.
76 > > >
77 > > > I do not really know which one needs fforce-addr (the kernel works with
78 > > > both, using my patch -earlier mail, but does not like fforce-addr).
79 > > > So adapt accordingly.
80 > > >
81 > > > Peter
82 > > >
83 > > >
84 >
85
86 --
87 Peter S. Mazinger <ps.m@×××.net> ID: 0xA5F059F2 NIC: IXUYHSKQLI
88 Key fingerprint = 92A4 31E1 56BC 3D5A 2D08 BB6E C389 975E A5F0 59F2
89
90
91 ____________________________________________________________________
92 Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol.
93 Probald ki most! http://www.freestart.hu
94
95 --
96 gentoo-hardened@g.o mailing list

Replies

Subject Author
Re: [gentoo-hardened] Re: hardened-gcc-3.3.2.1 Alexander Gabert <pappy@g.o>