On Fri, 21 Nov 2003, Maciej W. Rozycki wrote:
> > The kernel is already passing AT_PAGESZ to ELF binaries. Wouldn't that
> > be sufficient? Currently it's passing the largest supported page size,
>
> Well, AFAICS in glibc it's ld.so that is responsible for interpreting the
> auxiliary vector -- see _dl_aux_init() in elf/dl-support.c. If the
> dynamic linker isn't run (which is the usual case for static binaries,
> although calling dlopen() from them might complicate things), the
> dl_pagesize variable remains set to zero. Please prove me wrong if I am
> missing anything.
>
> > that is 64k. However this constant is always passed even when a smaller
> > page size is configured.
>
> Are you sure? I can see create_elf_tables() in fs/binfmt_elf.c sets
> AT_PAGESZ to ELF_EXEC_PAGESIZE, which, in turn, is set in
> include/asm-mips/elf.h to PAGE_SIZE. Which is the currently used page
> size and probably the optimal solution.
After rebuilding glibc (2.2.5) with the patch applied, the following
program:
#include <stdio.h>
#include <unistd.h>
int main(void)
{
printf("%u\n", getpagesize());
return 0;
}
prints "4096" if dynamically linked and "65536" if statically linked on my
system, as expected.
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
|