Bug 1538 - improve SSP detection
Summary: improve SSP detection
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: Build system (show other bugs)
Version: 5.1p1
Hardware: All Linux
: P2 normal
Assignee: Damien Miller
URL:
Keywords:
Depends on:
Blocks: V_5_2
  Show dependency treegraph
 
Reported: 2008-11-19 15:00 AEDT by Mike Frysinger
Modified: 2023-01-13 13:56 AEDT (History)
1 user (show)

See Also:


Attachments
Fixed patch (1.95 KB, patch)
2008-11-19 15:29 AEDT, Damien Miller
no flags Details | Diff
simplified diff (1.39 KB, patch)
2008-11-19 17:11 AEDT, Damien Miller
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Frysinger 2008-11-19 15:00:33 AEDT
the SSP test compiles this simple code:
#include <stdlib.h>
int main(void){exit(0);}

while that works fine for testing the -fstack-protector-all flag, it's insufficient for testing the -fstack-protector flag.  since it doesnt use any stack, no SSP markings will be added.  so if the toolchain does not fully support SSP, the configure script will add the flag but the build will ultimately fail.

a better test case seems to be:
#include <stdio.h>
int main(void){char foo[1024];return sprintf(foo, "moo cow");}

patch:
http://sources.gentoo.org/net-misc/openssh/files/openssh-5.1_p1-better-ssp-check.patch?rev=1.1
Comment 1 Damien Miller 2008-11-19 15:29:50 AEDT
Created attachment 1579 [details]
Fixed patch

I think the referenced patch is incorrect: square brackets need escaping in autoconf, so the test program would always fail with a compile error. This patch uses autoconf "quadrigraph" escaping (don't ask) to avoid this.
Comment 2 Damien Miller 2008-11-19 15:30:53 AEDT
oops, ignore the changes to Makefile.in in that diff - they aren't supposed to be there.
Comment 3 Tim Rice 2008-11-19 16:57:35 AEDT
(In reply to comment #1)
> I think the referenced patch is incorrect: square brackets need
> escaping in autoconf, so the test program would always fail with a
> compile error. This patch uses autoconf "quadrigraph" escaping (don't
> ask) to avoid this.

Or you can just double up on the square brackets. More readable?
+int main(void){char x[[256]]; snprintf(x, sizeof(x), "XXX"); return 0;}
Comment 4 Damien Miller 2008-11-19 17:11:39 AEDT
Created attachment 1580 [details]
simplified diff

diff with Tim's suggestion and no extraneous crap
Comment 5 Mike Frysinger 2008-11-20 11:17:30 AEDT
indeed ... i should have checked the config.log rather than just verifying that SSP was detected as not supported
Comment 6 Damien Miller 2008-12-08 09:36:02 AEDT
patch applied, will be in openssh-5.2. Thanks!
Comment 7 Damien Miller 2009-02-23 13:36:37 AEDT
Close bugs fixed/reviewed for openssh-5.2 release