Summary: | glibc-2.12: static binaries: __getpagesize: Assertion `_rtld_global_ro._dl_pagesize != 0' | ||
---|---|---|---|
Product: | glibc | Reporter: | Mike Frysinger <vapier> |
Component: | libc | Assignee: | Ulrich Drepper <drepper.fsp> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | allan, glibc-bugs, lool, me, toolchain |
Priority: | P2 | Flags: | fweimer:
security-
|
Version: | 2.12 | ||
Target Milestone: | --- | ||
Host: | x86_64-linux-gnu | Target: | |
Build: | Last reconfirmed: | ||
Attachments: | glibc-2.12-static-glro-init.patch |
Description
Mike Frysinger
2010-08-19 22:41:04 UTC
Created attachment 4941 [details]
glibc-2.12-static-glro-init.patch
This patch causes some issues when static linking. e.g.: #include <iconv.h> #include <stdio.h> #include <errno.h> int main () { iconv_t x; x = iconv_open ("UTF-8", "UTF-32LE"); printf ("%d\n", errno == EINVAL); return 0; } The iconv_open fails when compiled with -static. Using the workaround in sysdeps/unix/sysv/linux/getpagesize.c from Fedora git "fixes" the issue: -#ifdef __ASSUME_AT_PAGESIZE +#if 0 && defined __ASSUME_AT_PAGESIZE Allan, is the iconv issue a new one? Your testcase fails for me even when Mike's patch isn't applied; I get an assertion failure "_rtld_global_ro._dl_pagesize != 0". What failure do you get? Could you break in __getpagesize() and see what pagesize you get in the first (static libc.a copy) and second (lib.so) hits? Yes... it is not surprising that you run into the initial bug when not applying the patch! The point I was making is that Fedora's hack fix fixes both the "_dl_pagesize" issue and the "iconv" one that I pointed out. That leads me to suspect that some part of the initialisation of static apps is still incomplete after the application of the proposed patch. And given that changing on #ifdef fixes both, these issues were probably introduced at the same time. Sorry, wasn't clear: I did not know whether you iconv issue was there before the patch, and when reading your first comment, I thought it was a rebuttal for Mike's patch, but I wanted to confirm that Mike's patch was an immediate net win (moving arch-specific code to common code and fixing at least one class of issues), even if it doesn't fix all instances of this class of bugs. Hope this makes more sense now :) I understand that the Fedora change is just meant to be a workaround rather than a fix? There might be other random issues if the vdso isn't setup properly in the static+dynamic case, so it would be best to init libc properly in this case rather than fix just the getpagesize() issue? Yes, the patch is an improvement but it either: 1) is incomplete 2) introduces a new big (with iconv test case) I am leaning towards #1, but have not had time to investigate further. the iconv code calls the gconv code which attempts to dynamically load shared objects from /usr/lib64/gconv/. i havent dug past that so far, but it seems to boil down to the same issue -- dlopening shared objects from static objects is broken. From some quick testing, it appears this bug is fixed in glibc-2.15. Possibly by commit 02d46fc4. I went ahead and marked the change as the fix. |