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

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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: new syscall stub support for ia64 libc


>>>>> On Thu, 30 Oct 2003 08:03:02 +0100, Jakub Jelinek <jakub@redhat.com> said:

  >> - The "assert (ph->p_vaddr == GL(dl_sysinfo_dso)" check in
  >> elf/rtld.c is too strict.  On ia64, we have two LOAD segments, so
  >> the check can't possibly succeed:

  >> $ readelf -l arch/ia64/kernel/gate.so |grep LOAD LOAD
  >> 0x0000000000000000 0xa000000000010000 0xa000000000010000 LOAD
  >> 0x0000000000000000 0xa000000000020000 0xa000000000020000

  Jakub> Can you readelf -Wl arch/ia64/kernel/gate.so |grep LOAD (or
  Jakub> grep -A1 LOAD instead), or better yet readelf -Wa
  Jakub> arch/ia64/kernel/gate.so ? I'd like to understand why you
  Jakub> need the second LOAD segment, what stuff has it in etc.

How about I try to explain?  The reason there are two segments is that
the privilege-promote page used to enter the kernel is executable only
at the user-level.  To export the DSO headers etc., we thus create a
second, read-only mapping.  Here is the expanded readelf output:

$ readelf -Wl arch/ia64/kernel/gate.so |grep LOAD
LOAD           0x000000 0xa000000000010000 0xa000000000010000 0x000628 0x000628 R   0x10000
LOAD           0x000000 0xa000000000020000 0xa000000000020000 0x0009e0 0x0009e0   E 0x10000

  >> - The changes to linuxthreads/{manager,pthread}.c are almost
  >> certainly wrong, but I'm not sure I understand how you want
  >> things set up to ensure that single-threaded apps use the new
  >> stub but linuxthread apps use the old one.

  Jakub> IMHO NEED_DL_SYSINFO should be defined in both NPTL and
  Jakub> Linuxthread ia64/dl-sysdep.h, while USE_DL_SYSINFO only in
  Jakub> NPTL. And sysdep.h should use sysinfo only if USE_DL_SYSINFO is
  Jakub> defined.  Then linuxthreads will work just fine (use break
  Jakub> always, who cares) and NPTL will use VDSO.

But wouldn't this imply that non-threaded apps won't use the new
stubs?  I'm probably missing something here.

  >> - The libc-start.c change is also "wrong" but since
  >> DL_SYSDEP_OSCHECK() may do syscalls, it is necessary to do
  >> __pthread_initialize_minimal() first, as otherwise the minimal
  >> thread descriptor isn't setup.

  Jakub> This is handled on IA-32 by providing DL_SYSINFO_DEFAULT (and
  Jakub> defining USE_DL_SYSINFO).  This means the few syscalls in
  Jakub> DL_SYSDEP_OSCHECK will use the break insn and the rest will
  Jakub> use VDSO if available.

OK, that behavior should be fine (especially if the DL_SYSDEP_OSCHECK
can go away completely with the right libc config option).

	--david


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