Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 135265 - gcc-3.x SSP fails with C++
Summary: gcc-3.x SSP fails with C++
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Hardened (show other bugs)
Hardware: All Linux
: High normal with 1 vote (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
: 192564 (view as bug list)
Depends on: 101776 115237 126896 133092 133301 133463 137682 138604 143678 146157 154870 156800 175996 182087 217112 230119 230415 302534
Blocks:
  Show dependency tree
 
Reported: 2006-06-02 06:17 UTC by Kevin F. Quinn (RETIRED)
Modified: 2010-01-31 21:14 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin F. Quinn (RETIRED) gentoo-dev 2006-06-02 06:17:50 UTC
Bug to track C++ problems with the SSP we add to gcc-3.x

The SSP implementation we add to gcc-3.x does not like data declared elsewhere than in the initial declaration section of a function, which is legal in C++ but not in C.  Definitely the issue on 133301, likely also for 115237 and probably 136891 and 101776.
Comment 1 solar (RETIRED) gentoo-dev 2006-06-02 07:01:06 UTC
Would backing off on the -all option for CXX be ideal?
Comment 2 Kevin F. Quinn (RETIRED) gentoo-dev 2006-06-02 07:21:25 UTC
I don't think so, as -all will just reduce the likelihood of it being hit.  By how much is difficult to say as it depends on how often sweep-able variables occur in the same functions as the declarations that trigger the bug.
Comment 3 Caleb Tennis (RETIRED) gentoo-dev 2006-06-02 08:04:21 UTC
Regarding the dep'd bugs that are Qt specific:

The users have noted that the breakage occurs in 3.3.6 but NOT in 3.3.4.  I viewed the source for two of the bugs in question and the source hasn't changed between these versions (ie, the creation of a stack variable within a subblock of a function exists exactly the same in both versions).

What else could be the cause then?  Could some kind of bad cflags possibly be the culprit?  Perhaps the buildsystem mechanisms changed between 3.3.4 and 3.3.6 and we just haven't caught it yet.
Comment 4 Kevin F. Quinn (RETIRED) gentoo-dev 2006-06-02 08:43:06 UTC
(In reply to comment #3)
> The users have noted that the breakage occurs in 3.3.6 but NOT in 3.3.4.

Yeah, I noticed that.  The difficulty is in knowing how the issue is triggered.  I'm inclined to believe it is down to context; perhaps the data passed into the function is different in size for example.  Changes elsewhere in the code could cause the fault to become visible.  Note that the stack smash only occurs if the canary is overwritten - perhaps whatever data is being written doesn't quite reach the canary.

SSP does play significantly with the stack layout; it duplicates parameters and re-orders locally declared data to arrange to have any buffers located after the scalar data, so that buffer overflows won't corrupt the scalar data and are more likely to hit the canary.

It should be detectable by comparing the asm output from the function with the declaration in each place; I'm building some stuff at the moment to investigate.
Comment 5 Kevin F. Quinn (RETIRED) gentoo-dev 2006-06-02 14:55:38 UTC
re 133301 - seems SSP isn't causing the problem, just highlighting it (see comments there).

I think it'll be worth investigating the other bugs further, see if they're the same.
Comment 6 PaX Team 2006-06-03 12:11:55 UTC
all these bugs remind on one that solar gave me some 2-3 years ago, a few lines of c++ that crashed when compiled with SSP. i had spent a whole day of debugging what turned out to be a function prologue code generation bug in SSP and these bugs look very similar to that, maybe an angle to pursue... the next question is then, how are you going to fix it? that old bug was never addressed by Etoh (even though we gave him all the details) and i doubt he'd touch SSP these days again.
Comment 7 PaX Team 2006-07-30 02:55:09 UTC
i think bug 133092 belongs here as well.
Comment 8 Jorge Nerin 2006-12-21 12:49:25 UTC
I think bind in bug 158664 also suffer some kind of strange interaction with SSP.
Comment 9 Donnie Berkholz (RETIRED) gentoo-dev 2008-05-09 08:16:42 UTC
*** Bug 192564 has been marked as a duplicate of this bug. ***
Comment 10 Attila Tóth 2008-07-16 22:55:08 UTC
https://hardened.gentooexperimental.org/secure/

Dw.
Comment 11 Gordon Malm (RETIRED) gentoo-dev 2009-10-14 00:58:21 UTC
GCC 4.3.4 is stable on hardened.  All tracked bugs closed in one form or another.  GCC 3.4.x is frozen/not being worked on. Closing as WONTFIX.
Comment 12 Gordon Malm (RETIRED) gentoo-dev 2010-01-27 22:08:48 UTC
For anyone looking to solve this bug 302534 may be of particular interest.