Hello, Don't know what problem ur facing exactly but I now have a working system using the SSP from uClibc (0.9.30.1) and GCC (4.2.4).
The issue is to do with how GCC handles SSP on TLS and non TLS systems. Attached is the patch I used to get it working. It's by Natanel Copa from Alpine Linux. Only problem is Robert's FORTIFY_SOURCE patch generates an internal compiler error during the build. I remember u were also interested in Linux PAM on uClibc; am using version Linux-PAM-1.0.4 and all is well. I can share the patches if ur still interested. Daniel On Thursday 26 November 2009 06:45:16 Kevin Day wrote: > I am trying to figure out where the problem I have is, if it is some > unusual bug as a result of my own deviations, a bug in uClibc and not > glibc, or a bug with GCC. > > I am using GCC's libssp for SSP. > > There is an old upstream bug report of the same exact problem: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38274 > > I would get an Illegal Instruction and a core dump with any > appropriate SSP test at: > http://www.linuxfromscratch.org/hlfs/view/unstable/glibc-2.6/chapter06/butt >erfly-toolchain.html > > I ended up identifying that the problem exists somewhere with the exit > process after a stack smash happens and is handled. > I experimentally decided to take the ssp exit code directly from > uClibc-0.9.28.3. > > Replacing the exit code and exiting with SIGKILL, the program now > reports the Stack Smashing and exits without crashing and core > dumping. > Interestingly, if I used SIGABRT with the uClibc code, the program > would crash and core dump. > > My system for the test case is uClibc-0.9.28.3 based with gcc-4.4.2 > and binutils-2.20. > > I do not remember seeing this problem way back whenever I was using > the book's GCC and Binutils. > The book specifies gcc-4.1.2 and binutils 2.17, so I assume this > combination properly aborts with crashing? > > > Has anybody on this list tried gcc-4.4.2 with SSP either under glibc or > uClibc? > > > Does this segfault happen when uClibc's internal ssp is used instead > of the GCC libssp? > > > -- > Kevin Day -- Mwanguhya Daniel Murungi Makerere University [ DICTS ] P.O.Box 7062, Wandegeya Kampala Uganda MYTH: Knowledge is power TRUTH: APPLIED Knowledge is power
diff -u gcc/config/i386/linux.h gcc/config/i386/linux.h --- a/gcc/config/i386/linux.h 2 Jul 2005 08:52:20 -0000 1.60 +++ b/gcc/config/i386/linux.h 2 Jul 2005 08:52:20 -0000 1.60 @@ -186,7 +186,7 @@ /* This macro may be overridden in i386/k*bsd-gnu.h. */ #define REG_NAME(reg) reg -#ifdef TARGET_LIBC_PROVIDES_SSP +#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ /* i386 glibc provides __stack_chk_guard in %gs:0x14. */ #define TARGET_THREAD_SSP_OFFSET 0x14 #endif diff -u gcc/config/i386/linux64.h gcc/config/i386/linux64.h --- a/gcc/config/i386/linux64.h 2 Jul 2005 08:52:20 -0000 1.33 +++ b/gcc/config/i386/linux64.h 2 Jul 2005 08:52:20 -0000 1.33 @@ -74,7 +74,7 @@ /* This macro may be overridden in i386/k*bsd-gnu.h. */ #define REG_NAME(reg) reg -#ifdef TARGET_LIBC_PROVIDES_SSP +#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ /* i386 glibc provides __stack_chk_guard in %gs:0x14, x86_64 glibc provides it in %fs:0x28. */ #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14) diff -u gcc/config/rs6000/linux.h gcc/config/rs6000/linux.h --- a/gcc/config/rs6000/linux.h 2 Jul 2005 08:52:11 -0000 1.53 +++ b/gcc/config/rs6000/linux.h 2 Jul 2005 08:52:11 -0000 1.53 @@ -114,7 +114,7 @@ #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h" -#ifdef TARGET_LIBC_PROVIDES_SSP +#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ /* ppc32 glibc provides __stack_chk_guard in -0x7008(2). */ #define TARGET_THREAD_SSP_OFFSET -0x7008 #endif diff -u gcc/config/rs6000/linux64.h gcc/config/rs6000/linux64.h --- a/gcc/config/rs6000/linux64.h 2 Jul 2005 08:52:15 -0000 1.81 +++ b/gcc/config/rs6000/linux64.h 2 Jul 2005 08:52:15 -0000 1.81 @@ -548,7 +548,7 @@ #define MD_UNWIND_SUPPORT "config/rs6000/linux-unwind.h" -#ifdef TARGET_LIBC_PROVIDES_SSP +#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ /* ppc32 glibc provides __stack_chk_guard in -0x7008(2), ppc64 glibc provides it at -0x7010(13). */ #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? -0x7010 : -0x7008) diff -u gcc/config/s390/linux.h gcc/config/s390/linux.h --- a/gcc/config/s390/linux.h 2005-08-22 15:53:01.000000000 +0200 1.40 +++ b/gcc/config/s390/linux.h 2005-08-22 15:53:01.000000000 +0200 1.40 @@ -94,7 +94,7 @@ #define MD_UNWIND_SUPPORT "config/s390/linux-unwind.h" -#ifdef TARGET_LIBC_PROVIDES_SSP +#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ /* s390 glibc provides __stack_chk_guard in 0x14(tp), s390x glibc provides it at 0x28(tp). */ #define TARGET_THREAD_SSP_OFFSET (TARGET_64BIT ? 0x28 : 0x14) diff -u gcc/config/sparc/linux.h gcc/config/sparc/linux.h --- a/gcc/config/sparc/linux.h 6 Jul 2005 07:48:57 -0000 1.72 +++ b/gcc/config/sparc/linux.h 6 Jul 2005 07:48:57 -0000 1.72 @@ -230,7 +230,7 @@ #undef NEED_INDICATE_EXEC_STACK #define NEED_INDICATE_EXEC_STACK 1 -#ifdef TARGET_LIBC_PROVIDES_SSP +#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ /* sparc glibc provides __stack_chk_guard in [%g7 + 0x14]. */ #define TARGET_THREAD_SSP_OFFSET 0x14 #endif diff -u gcc/config/sparc/linux64.h gcc/config/sparc/linux64.h --- a/gcc/config/sparc/linux64.h 6 Jul 2005 07:48:57 -0000 1.95 +++ b/gcc/config/sparc/linux64.h 6 Jul 2005 07:48:57 -0000 1.95 @@ -364,7 +364,7 @@ #undef NEED_INDICATE_EXEC_STACK #define NEED_INDICATE_EXEC_STACK 1 -#ifdef TARGET_LIBC_PROVIDES_SSP +#if defined TARGET_LIBC_PROVIDES_SSP && !defined __UCLIBC__ /* sparc glibc provides __stack_chk_guard in [%g7 + 0x14], sparc64 glibc provides it at [%g7 + 0x28]. */ #define TARGET_THREAD_SSP_OFFSET (TARGET_ARCH64 ? 0x28 : 0x14)
-- http://linuxfromscratch.org/mailman/listinfo/hlfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page