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]

Re: Remove the getpagesize system call from ia64


On Wed, Jan 10, 2001 at 10:23:31AM -0800, H . J . Lu wrote:
> AT_PAGESZ works on the current ia64 kernel.

Unfortunately, not fully yet :(.

Consider statically linked:
#include <stdio.h>
#include <pwd.h>
#include <sys/types.h>
#include <unistd.h>

int main() {
        struct passwd *foo;
        foo=getpwuid(2166);
        printf("%d %d\n",foo->pw_uid,foo->pw_gid);
}
This will crash. Although _dl_pagesize is set properly in the main program,
when it dlopens libnss_files.so.2 which in turn drags in libc.so.6.1 and
ld-linux-ia64.so.2. Now when libnss_files.so.2 calls __getpagesize(), it
uses _dl_pagesize variable present in ld-linux-ia64.so.2 which has not been
initialized and thus it either crashes immediately or later on (if
-DNDEBUG=1). At least I believe this is happening from what Bill Nottingham
told me. I think one solution could be to have the getpagesize syscall for
this case, another one would be to have a list of ld.so variables which need
to be initialized to their static originals, like have something like:
{ "_dl_pagesize", &_dl_pagesize },
and during dlopen #ifndef SHARED go through that list and copy the content.

	Jakub

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