Re: dietlibc broken on i386 since Feb 2018?

Frank Bergmann <[email protected]> Mon, 16 Sep 2019 10:42:18 +0200
Newsgroups gmane.linux.lib.dietlibc
Message-ID <[email protected]>
Hi.

On Mon, Sep 16, 2019 at 04:08:41AM +0200, Felix von Leitner wrote:
> This looks like the code works as expected.
> 
> If you want to run the binaries on an ancient kernel that does not put
> the random seed in the auxvec, you need to set the #define you removed
> in dietfeatures.h

No, I didn't. That's why I wrote the first email THIS:

On Sat, Sep 14, 2019 at 04:15:35PM +0200, Frank Bergmann wrote:
> victim:~ frank 16:02:15$ rm -rf dietlibc; cvs -d :pserver:[email protected]:/cvs -z9 co dietlibc &>/dev/null
> 
> victim:~ frank 16:02:25$ cd dietlibc
> 
> victim:dietlibc frank 16:02:27$ make clean &>/dev/null;make 2>&1 |tail -n 3
> strip -R .comment -R .note bin-i386/diet-i
> bin-i386/diet gcc -D__dietlibc__ -pipe -nostdinc -D_REENTRANT -ffunction-sections -fdata-sections -Os -fomit-frame-pointer -falign-functions=1 -falign-jumps=1 -falign-loops=1 -mpreferred-stack-boundary=4 -W -Wall -Wextra -Wchar-subscripts -Wmissing-prototypes -Wmissing-declarations -Wno-switch -Wno-unused -Wredundant-decls -Wshadow -o bin-i386/elftrunc contrib/elftrunc.c -Wl,--gc-sections -Wl,-z,noseparate-code
> make: *** [bin-i386/elftrunc] Segmentation fault

I didn't modified dietfeatures (which is normally my first task).
I used "vanilla cvs dietlibc".
That's why I was wondering. It's broken with default config.

> It is even documented there.

Actually not. After some trial and error I discovered that disabling WANT_SSP will make diet work again.
But HERE it is only documented that the *binary* will segfault - not diet itself.
And you are writing about -fstack-protector which makes sense. But this is not strictly related.
This dietfeature change made diet work again:

$ cvs di dietfeatures.h 
Index: dietfeatures.h
===================================================================
RCS file: /cvs/dietlibc/dietfeatures.h,v
retrieving revision 1.80
diff -u -r1.80 dietfeatures.h
--- dietfeatures.h      11 Dec 2018 15:16:39 -0000      1.80
+++ dietfeatures.h      16 Sep 2019 08:30:53 -0000
@@ -163,9 +163,11 @@
 /* If you compile dietlibc without WANT_SSP and then try to link code
  * compiled with -fstack-protector against it, the binary will segfault
  * when calling that code. */
+/*
 #if (__GNUC__>4) || ((__GNUC__==4) && (__GNUC_MINOR__>=1))
 #define WANT_SSP
 #endif
+*/

> What kernel are you using, if I may ask?

:-) RHEL 2.6.18-419.el5xen

BTW - "ancient kernel" is maybe misleading if I see WANT_SYSENTER... ;-)

Frank