This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Variable page size support for MIPS/Linux


On Mon, 5 Jan 2004, Maciej W. Rozycki wrote:

>  Now, getting back to the subject, please note that I am specifically
> referring to the case when ld.so gets loaded as a result of dlopen() --
> here's a small snippet that depicts what I mean:
> 
> #include <dlfcn.h>
> #include <stdio.h>
> #include <unistd.h>
> 
> int main(void)
> {
> 	void *h;
> 	int (*g)(void);
> 	int p0, p1;
> 
> 	h = dlopen("/lib/libc.so.6", RTLD_GLOBAL | RTLD_LAZY);
> 
> 	g = dlsym(h, "getpagesize");
> 
> 	p0 = g();
> 
> 	dlclose(h);
> 
> 	p1 = getpagesize();
> 
> 	printf("pagesize: %u, %u\n", p0, p1);
> 
> 	return 0;
> }
> 
> With glibc as distributed it outputs bad values of the page size.  With
> glibc patched to add sysdeps/unix/sysv/linux/mips/getpagesize.c only, it
> crashes due to the assertion quoted above.  While calling dlopen() on
> libc.so isn't that useful itself, it corresponds to a real-life situation
> when both libc.so and ld.so get loaded as a part of references to NSS
> modules from static executables.

 FYI, the above program prints:

pagesize: 65536, 4096

on my system with unpatched glibc and:

pagesize: 4096, 4096

after my fix.  My system is currently configured for a 4kB page size --
for page sizes of 16kB and 64kB substitute 16384 and 65536 respectively
for 4096 above.

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]