| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This addresses an issue that is present mainly on SMP machines running
threaded code. In a typical indirect call or PLT import stub, the
target address is loaded first. Then the global pointer is loaded into
the PIC register in the delay slot of a branch to the target address.
During lazy binding, the target address is a trampoline which transfers
to _dl_runtime_resolve().
_dl_runtime_resolve() uses the relocation offset stored in the global
pointer and the linkage map stored in the trampoline to find the
relocation. Then, the function descriptor is updated.
In a multi-threaded application, it is possible for the global pointer
to be updated between the load of the target address and the global
pointer. When this happens, the relocation offset has been replaced
by the new global pointer. The function pointer has probably been
updated as well but there is no way to find the address of the function
descriptor and to transfer to the target. So, _dl_runtime_resolve()
typically crashes.
HP-UX addressed this problem by adding an extra pc-relative branch to
the trampoline. The descriptor is initially setup to point to the
branch. The branch then transfers to the trampoline. This allowed
the trampoline code to figure out which descriptor was being used
without any modification to user code. I didn't use this approach
as it is more complex and changes function pointer canonicalization.
The order of loading the target address and global pointer in
indirect calls was not consistent with the order used in import stubs.
In particular, $$dyncall and some inline versions of it loaded the
global pointer first. This was inconsistent with the global pointer
being updated first in dl-machine.h. Assuming the accesses are
ordered, we want elf_machine_fixup_plt() to store the global pointer
first and calls to load it last. Then, the global pointer will be
correct when the target function is entered.
However, just to make things more fun, HP added support for
out-of-order execution of accesses in PA 2.0. The accesses used by
calls are weakly ordered. So, it's possibly under some circumstances
that a function might be entered with the wrong global pointer.
However, HP uses weakly ordered accesses in 64-bit HP-UX, so I assume
that loading the global pointer in the delay slot of the branch must
work consistently.
The basic fix for the race is a combination of modifying user code to
preserve the address of the function descriptor in register %r22 and
setting the least-significant bit in the relocation offset. The
latter was suggested by Carlos as a way to distinguish relocation
offsets from global pointer values. Conventionally, %r22 is used
as the address of the function descriptor in calls to $$dyncall.
So, it wasn't hard to preserve the address in %r22.
I have updated gcc trunk and gcc-9 branch to not clobber %r22 in
$$dyncall and inline indirect calls. I have also modified the import
stubs in binutils trunk and the 2.33 branch to preserve %r22. This
required making the stubs one instruction longer but we save one
relocation. I also modified binutils to align the .plt section on
a 8-byte boundary. This allows descriptors to be updated atomically
with a floting-point store.
With these changes, _dl_runtime_resolve() can fallback to an alternate
mechanism to find the relocation offset when it has been clobbered.
There's just one additional instruction in the fast path. I tested
the fallback function, _dl_fix_reloc_arg(), by changing the branch to
always use the fallback. Old code still runs as it did before.
Fixes bug 23296.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
| |
|
|
|
|
|
|
|
| |
* All files with FSF copyright notices: Update copyright dates
using scripts/update-copyrights.
* locale/programs/charmap-kw.h: Regenerated.
* locale/programs/locfile-kw.h: Likewise.
|
|
|
|
|
|
|
| |
* All files with FSF copyright notices: Update copyright dates
using scripts/update-copyrights.
* locale/programs/charmap-kw.h: Regenerated.
* locale/programs/locfile-kw.h: Likewise.
|
|
|
|
|
|
|
|
|
| |
* sysdeps/hppa/dl-fptr.c (elf_machine_resolve): Remove unnecessary
depi instruction from PIC pc-relative sequence.
* sysdeps/hppa/dl-fptr.h (ELF_MACHINE_LOAD_ADDRESS): Likewise.
* sysdeps/hppa/dl-machine.h (elf_machine_dynamic): Likewise.
(elf_machine_load_address): Likewise.
(elf_machine_runtime_setup): Likewise.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The attached patch fixes dladdr on hppa.
Instead of using the generic version of _dl_lookup_address, we use an
implementation more or less modeled after __canonicalize_funcptr_for_compare()
in gcc. The function pointer is analyzed and if it points to the
trampoline used to call _dl_runtime_resolve just before the global
offset table, then we call _dl_fixup to resolve the function pointer.
Then, we return the instruction pointer from the first word of the
descriptor.
The change fixes the testcase provided in [BZ #19415] and the Debian
nss package now builds successfully.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2003-12-17 Carlos O'Donell <carlos@baldric.uwo.ca>
* sysdeps/hppa/fpu/fclrexcpt.c (feclearexcept): Right shift
FE_ALL_EXCEPT before complimenting.
* sysdeps/hppa/fpu/fegetenv.c (fegetenv): Use asm 'ma,' completer,
and gcc '+r' constraint.
* sysdeps/hppa/fpu/feholdexcpt.c (feholdexcept): Likewise.
* sysdeps/hppa/fpu/fesetenv.c (fesetenv): Likewise.
* sysdeps/hppa/fpu/feupdateenv.c (feupdateenv): Read raised
exception bits, OR with envp, pass to fesetenv.
* sysdeps/hppa/fpu/fraiseexcpt.c (feraiseexcept): Add delayed
exception flushing, FE_UNDERFLOW is DBL_MIN/3.0, FE_INEXACT is
triggered by M_PI/69.69 converted to single precision.
* sysdeps/hppa/fpu/fsetexcptflg.c (fesetexceptflag): Set enable
bits not raised exception bits.
* sysdeps/hppa/Makefile: Add dl-symaddr and dl-fptr to the
correct build strings.
* sysdeps/hppa/dl-fptr.h: New file.
* sysdeps/hppa/dl-fptr.c: Removed.
* sysdeps/hppa/dl-symaddr.c (_dl_symbol_address): Use _dl_make_ftpr,
remove const qualifier for map.
(_dl_function_address): Removed.
* sysdeps/hppa/dl-lookupcfg.h: DL_LOOKUP_ADDRESS must clear
PLABEL32 bits, define DL_AUTO_FUNCTION_ADDRESS and
DL_STATIC_FUNCTION_ADDRESS, DL_DT_INIT_ADDRESS and
DL_DT_FINI_ADDRESS use the previous two macros.
* misc/mntent_r.c: Change encoding to match recently changed decoder.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* sysdeps/generic/ldsodefs.h: Add _dl_load_lock, _dl_lazy,
_dl_dynamic_weak, _dl_fpu_control, _dl_cpuclock_offset, and
_dl_debug_fd to rtld_global.
* elf/Versions: Likewise.
* elf/dl-close.c: Likewise.
* elf/dl-iteratephdr.c: Likewise.
* elf/dl-lookup.c: Likewise.
* elf/dl-misc.c: Likewise.
* elf/dl-open.c: Likewise.
* elf/dl-support.c: Likewise.
* elf/do-lookup.h: Likewise.
* elf/rtld.c: Likewise.
* sysdeps/generic/dl-cache.c: Likewise.
* sysdeps/generic/dl-sysdep.c: Likewise.
* sysdeps/ia64/Versions: Likewise.
* sysdeps/unix/clock_gettime.c: Likewise.
* sysdeps/unix/clock_settime.c: Likewise.
* sysdeps/unix/sysv/linux/init-first.c: Likewise.
* sysdeps/sparc/Versions: Removed.
* sysdeps/i386/i686/Versions : Removed.
* sysdeps/x86_64/Versions: Removed.
* configure.in: Define HAVE_PROTECTED if .protected is available.
* config.h.in: Add entry for HAVE_PROTECTED.
2002-01-31 Jakub Jelinek <jakub@redhat.com.
* sysdeps/alpha/dl-machine.h: Move global variables for SHARED
code in struct _rtld_global. Export this struct, remove all
exports for the signal variables.
* sysdeps/arm/dl-machine: Likewise.
* sysdeps/generic/dl-origin: Likewise.
* sysdeps/generic/dl-sysdep: Likewise.
* sysdeps/generic/dl-cache: Likewise.
* sysdeps/hppa/dl-fptr: Likewise.
* sysdeps/hppa/dl-machine: Likewise.
* sysdeps/cris/dl-machine: Likewise.
* sysdeps/i386/dl-machine: Likewise.
* sysdeps/ia64/dl-machine: Likewise.
* sysdeps/m68k/dl-machine: Likewise.
* sysdeps/mach/hurd/dl-sysdep: Likewise.
* sysdeps/mips/mips64/dl-machine: Likewise.
* sysdeps/mips/dl-machine: Likewise.
* sysdeps/powerpc/elf/libc-start: Likewise.
* sysdeps/powerpc/dl-machine: Likewise.
* sysdeps/powerpc/dl-start: Likewise.
* sysdeps/sparc/sparc32/dl-machine: Likewise.
* sysdeps/sparc/sparc64/dl-machine: Likewise.
* sysdeps/sh/dl-machine: Likewise.
* sysdeps/s390/s390-32/dl-machine: Likewise.
* sysdeps/s390/s390-64/dl-machine: Likewise.
* sysdeps/unix/sysv/aix/libc-start: Likewise.
* sysdeps/unix/sysv/aix/start-libc: Likewise.
* sysdeps/unix/sysv/linux/ia64/dl-static: Likewise.
* sysdeps/unix/sysv/linux/m68k/getpagesize: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/getpagesize: Likewise.
* sysdeps/x86_64/dl-machine: Likewise.
2002-01-31 Ulrich Drepper <drepper@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2001-09-07 Tom Rix <trix@redhat.com>
* sysdeps/unix/sysv/aix/sysv_termio.h: New file.
2001-08-26 Tom Rix <trix@redhat.com>
* sysdeps/unix/sysv/aix/Makefile (aix-syscalls.o): More linker
command line options.
* sysdeps/unix/sysv/aix/start.s: New file, rework of start.c
* sysdeps/unix/sysv/aix/start.c: Removed.
* sysdeps/unix/sysv/aix/start-libc.c: New file.
* sysdeps/unix/sysv/aix/init-first.c: New file.
* sysdeps/unix/sysv/aix/fcntl.c: Alias __libc_fcntl to __fcntl.
2001-09-08 Ben Collins <bcollins@debian.org>
* sysdeps/arm/dl-machine.h: Fix usage of new _dl_signal_error() format.
* sysdeps/generic/dl-machine.h: Likewise.
* sysdeps/hppa/dl-fptr.c: Likewise.
* sysdeps/ia64/dl-fptr.c: Likewise.
* sysdeps/mach/hurd/dl-sysdep.c: Likewise.
* sysdeps/mips/dl-machine.h: Likewise.
* sysdeps/mips/mips64/dl-machine.h: Likewise.
* sysdeps/powerpc/dl-machine.c: Likewise.
2001-09-07 Ben Collins <bcollins@debian.org>
* sysdeps/sparc/sparc32/dl-machine.h: Fix typo.
* sysdeps/hppa/dl-lookupcfg.h: Forward declare struct link_map.
* elf/dl-lookup.c (add_dependency): Bump l_opencount of all
dependencies if necessary.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2001-07-06 Paul Eggert <eggert@twinsun.com>
* manual/argp.texi: Remove ignored LGPL copyright notice; it's
not appropriate for documentation anyway.
* manual/libc-texinfo.sh: "Library General Public License" ->
"Lesser General Public License".
2001-07-06 Andreas Jaeger <aj@suse.de>
* All files under GPL/LGPL version 2: Place under LGPL version
2.1.
|
|
2000-10-14 Ulrich Drepper <drepper@redhat.com>
* math/libm-test.inc (frexp_test): Add L suffix also to parameters.
(hypot_test): Likewise.
* sysdeps/generic/printf_fphex.c: Compute width of decimal point
string correctly. Handle padding correctly.
* sysdeps/ia64/fpu/printf_fphex.c: Use sizeof in _itowa parameters
correctly.
* sysdeps/ieee754/ldbl-128/printf_fphex.c: Likewise.
* sysdeps/ieee754/ldbl-96/printf_fphex.c: Likewise.
2000-10-12 Alan Modra <alan@linuxcare.com.au>
* FAQ.in: Add --start-group and --end-group.
2000-10-12 Alan Modra <alan@linuxcare.com.au>
* malloc/memusage.c: Conditionalize stack usage calculation on
stack direction.
2000-10-12 Alan Modra <alan@linuxcare.com.au>
* config.h.in: Add ASM_LINE_SEP.
* configure.in: Add test for comment and line separators.
* include/libc-symbols.h: Define and use ASM_LINE_SEP, and add tabs to
placate some hppa assemblers.
* sysdeps/hppa/sysdep.h: Likewise.
* sysdeps/gnu/siglist.c: Insert \n and \t into inline asm.
* sysdeps/unix/sysv/linux/errlist.c: Likewise.
2000-10-12 David Huggins-Daines <dhd@linuxcare.com>
* sysdeps/unix/sysv/linux/Makefile: Include <bits/initspin> in
$(sysdep_headers).
* sysdeps/unix/sysv/linux/bits/initspin.h: Dummy version for
non-threaded platforms.
2000-10-12 David Huggins-Daines <dhd@linuxcare.com>
* configure.in: Add definitions for hppa.
* elf/elf.h: Add PLABEL32 relocation for hppa ELF32, comments
for IPLT and EPLT relocations.
* shlib-versions: Version symbol definitions for hppa-linux.
* sysdeps/unix/sysv/linux/configure.in: Define $arch_minimum_kernel
for hppa.
2000-10-12 David Huggins-Daines <dhd@linuxcare.com>
* sysdeps/hppa/Makefile: New file.
* sysdeps/hppa/Versions: New file.
* sysdeps/hppa/setjmp.S: New file.
* sysdeps/hppa/__longjmp.S: New file.
* sysdeps/hppa/bits/setjmp.h: New file.
* sysdeps/hppa/frame.h: New file.
* sysdeps/hppa/add_n.s: Don't use %r19 (linkage table pointer).
* sysdeps/hppa/sub_n.s: Likewise.
* sysdeps/hppa/lshift.s: Likewise.
* sysdeps/hppa/rshift.s: Likewise.
* sysdeps/hppa/udiv_qrnnd.s: Likewise.
* sysdeps/hppa/hppa1.1/addmul_1.s: Likewise.
* sysdeps/hppa/hppa1.1/submul_1.s: Likewise.
* sysdeps/hppa/hppa1.1/mul_1.s: Likewise.
* sysdeps/hppa/hppa1.1/udiv_qrnnd.s: Likewise.
* sysdeps/hppa/dl-machine.h: New file.
* sysdeps/hppa/dl-fptr.c: New file (note that this is almost
identical to the IA-64 one).
* sysdeps/hppa/dl-lookupcfg.h: Likewise.
* sysdeps/hppa/dl-symaddr.c: Likewise.
* sysdeps/hppa/elf/initfini.c: New file.
* sysdeps/hppa/elf/start.S: New file.
* sysdeps/hppa/fpu/bits/fenv.h: New file.
* sysdeps/hppa/fpu/fclrexcpt.c: New file.
* sysdeps/hppa/fpu/fedisblxcpt.c: New file.
* sysdeps/hppa/fpu/feenablxcpt.c: New file.
* sysdeps/hppa/fpu/fegetenv.c: New file.
* sysdeps/hppa/fpu/fegetexcept.c: New file.
* sysdeps/hppa/fpu/fegetround.c: New file.
* sysdeps/hppa/fpu/feholdexcpt.c: New file.
* sysdeps/hppa/fpu/fesetenv.c: New file.
* sysdeps/hppa/fpu/fesetround.c: New file.
* sysdeps/hppa/fpu/feupdateenv.c: New file.
* sysdeps/hppa/fpu/fegetexcptflg.c: New file.
* sysdeps/hppa/fpu/fraiseexcpt.c: New file.
* sysdeps/hppa/fpu/fsetexcptflg.c: New file.
* sysdeps/hppa/fpu/ftestexcept.c: New file.
* sysdeps/unix/sysv/linux/hppa/Makefile: New file.
* sysdeps/unix/sysv/linux/hppa/Versions: New file.
* sysdeps/unix/sysv/linux/hppa/syscalls.list: New file.
* sysdeps/unix/sysv/linux/hppa/sysdep.c: New file.
* sysdeps/unix/sysv/linux/hppa/sysdep.h: New file.
* sysdeps/unix/sysv/linux/hppa/bits/fcntl.h: New file.
* sysdeps/unix/sysv/linux/hppa/bits/ioctls.h: New file.
* sysdeps/unix/sysv/linux/hppa/bits/mman.h: New file.
* sysdeps/unix/sysv/linux/hppa/bits/sigaction.h: New file.
* sysdeps/unix/sysv/linux/hppa/bits/signum.h: New file.
* sysdeps/unix/sysv/linux/hppa/brk.c: New file.
* sysdeps/unix/sysv/linux/hppa/clone.S: New file.
* sysdeps/unix/sysv/linux/hppa/socket.S: New file.
* sysdeps/unix/sysv/linux/hppa/syscall.S: New file.
* sysdeps/unix/sysv/linux/hppa/setrlimit.c: New file.
* sysdeps/unix/sysv/linux/hppa/getrlimit.c: New file.
* sysdeps/unix/sysv/linux/hppa/getrlimit64.c: New file.
* sysdeps/unix/sysv/linux/hppa/kernel_sigaction.h: New file.
* sysdeps/unix/sysv/linux/hppa/kernel_stat.h: New file.
* sysdeps/unix/sysv/linux/hppa/mmap.c: New file.
* sysdeps/unix/sysv/linux/hppa/profil-counter.h: New file.
* sysdeps/unix/sysv/linux/hppa/procfs.h: New file.
* sysdeps/unix/sysv/linux/hppa/ucontext.h: New file.
* sysdeps/unix/sysv/linux/hppa/umount.c: New file.
2000-10-12 Alan Modra <alan@linuxcare.com.au>
* sysdeps/hppa/hppa1.1/Implies: New file.
* sysdeps/hppa/memusage.h: New file.
|