]> git.pld-linux.org Git - packages/glibc.git/blob - glibc-getpagesize-revert.patch
d99eed6d1b9d2be0327b63d7d2368033c8b60053
[packages/glibc.git] / glibc-getpagesize-revert.patch
1 Date: Wed, 18 Aug 2010 01:31:18 -0400
2 Subject: Re: vi and glibc 2.12: Assertion `_rtld_global_ro._dl_pagesize != 0
3 From: Mike Frysinger <vapier at gentoo dot org>
4 To: Allan McRae <allan at archlinux dot org>
5 Cc: =?ISO-8859-2?Q?Pawe=B3_Sikora?= <pluto at agmk dot net>, 
6         libc-alpha at sourceware dot org
7
8 On Tue, Aug 17, 2010 at 10:36 PM, Mike Frysinger wrote:
9 > i'm certainly not familiar with glibc's ldso implementation due to
10 > it's crazy large & complicated code base, but i imagine this could be
11 > resolved best by having the ldso declare an initializer that calls the
12 > same functions as the ldso does when bootstrapping a normal
13 > application (_dl_sysdep_start/etc...). =A0this is because the nss libs
14 > are dlopened like any other ELF, and it tails into libc.so which tails
15 > into the ldso. =A0there is no special code that i can see that goes
16 > "this is the ldso, do xxx specially" which makes perfect sense. =A0only
17 > outstanding issue there would be whether the ldso will process its own
18 > initializers when bootstrapping a standard application.
19 >
20 > we could back out the assert in __getpagesize(), but that would only
21 > "fix" things until the next time someone adds code which relies on
22 > initialized GLRO() state.
23
24 after some experimenting, i guess the init method isnt feasible.  as
25 the GLRO() name indicates, the struct is backed by read-only mappings,
26 and the ELF processing has already set up all the mappings with proper
27 permissions per the program headers by the time it calls any
28 initializers for that ELF.  temporarily remapping itself isnt feasible
29 as some kernels prevent re-enabling write access to a read/execute
30 only mapping.
31
32 the ldso doesnt have any problems with this since it initializes its
33 internal state before setting its own mappings to read-only.
34
35 which leaves us with the __getpagesize() function and simply reverting
36 commit 8f4a5048eea6536ee85c0f2670adbb97d71e427d.  unless anyone else
37 has an alternative, that's what i'm going to roll with in Gentoo.
38 there should be no need to recompile any static apps, just glibc
39 itself, since the issue is coming from libc.so/ldso itself being
40 dlopened.
41
42 --- a/sysdeps/unix/sysv/linux/getpagesize.c
43 +++ b/sysdeps/unix/sysv/linux/getpagesize.c
44 @@ -28,7 +28,7 @@
45  int
46  __getpagesize ()
47  {
48 -#ifdef __ASSUME_AT_PAGESIZE
49 +#if 0
50    assert (GLRO(dl_pagesize) != 0);
51    return GLRO(dl_pagesize);
52  #else
53 -mike
54
This page took 0.021573 seconds and 2 git commands to generate.