From 41d6f74e6cb6a92ab428c11ee1e408b2a16aa1b0 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 2 Jul 2019 15:12:20 +0200 Subject: nptl: Remove vfork IFUNC-based forwarder from libpthread [BZ #20188] With commit f0b2132b35248c1f4a80f62a2c38cddcc802aa8c ("ld.so: Support moving versioned symbols between sonames [BZ #24741]"), the dynamic linker will find the definition of vfork in libc and binds a vfork reference to that symbol, even if the soname in the version reference says that the symbol should be located in libpthread. As a result, the forwarder (whether it's IFUNC-based or a duplicate of the libc implementation) is no longer necessary. On older architectures, a placeholder symbol is required, to make sure that the GLIBC_2.1.2 symbol version does not go away, or is turned in to a weak symbol definition by the link editor. (The symbol version needs to preserved so that the symbol coverage check in elf/dl-version.c does not fail for old binaries.) mips32 is an outlier: It defined __vfork@@GLIBC_2.2, but the baseline is GLIBC_2.0. Since there are other @@GLIBC_2.2 symbols, the placeholder symbol is not needed there. --- sysdeps/unix/sysv/linux/hppa/libpthread.abilist | 2 - sysdeps/unix/sysv/linux/hppa/localplt.data | 1 - sysdeps/unix/sysv/linux/hppa/pt-vfork.S | 82 ------------------------- 3 files changed, 85 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/hppa/pt-vfork.S (limited to 'sysdeps/unix/sysv/linux/hppa') diff --git a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist index bcba07f575..e9b3be6ac8 100644 --- a/sysdeps/unix/sysv/linux/hppa/libpthread.abilist +++ b/sysdeps/unix/sysv/linux/hppa/libpthread.abilist @@ -46,7 +46,6 @@ GLIBC_2.2 __read F GLIBC_2.2 __res_state F GLIBC_2.2 __send F GLIBC_2.2 __sigaction F -GLIBC_2.2 __vfork F GLIBC_2.2 __wait F GLIBC_2.2 __write F GLIBC_2.2 _pthread_cleanup_pop F @@ -192,7 +191,6 @@ GLIBC_2.2 siglongjmp F GLIBC_2.2 sigwait F GLIBC_2.2 system F GLIBC_2.2 tcdrain F -GLIBC_2.2 vfork F GLIBC_2.2 wait F GLIBC_2.2 waitpid F GLIBC_2.2 write F diff --git a/sysdeps/unix/sysv/linux/hppa/localplt.data b/sysdeps/unix/sysv/linux/hppa/localplt.data index 5f3475de19..867413f0c5 100644 --- a/sysdeps/unix/sysv/linux/hppa/localplt.data +++ b/sysdeps/unix/sysv/linux/hppa/localplt.data @@ -10,7 +10,6 @@ libc.so: __sigsetjmp libc.so: _IO_funlockfile libc.so: __errno_location libm.so: matherr -libpthread.so: __errno_location # The main malloc is interposed into the dynamic linker, for # allocations after the initial link (when dlopen is used). ld.so: malloc diff --git a/sysdeps/unix/sysv/linux/hppa/pt-vfork.S b/sysdeps/unix/sysv/linux/hppa/pt-vfork.S deleted file mode 100644 index 9d7dda8b63..0000000000 --- a/sysdeps/unix/sysv/linux/hppa/pt-vfork.S +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright (C) 2005-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#include -#define _ERRNO_H 1 -#include -#include - -/* Clone the calling process, but without copying the whole address space. - The calling process is suspended until the new process exits or is - replaced by a call to `execve'. Return -1 for errors, 0 to the new process, - and the process ID of the new process to the old process. */ - -.Lthread_start: ASM_LINE_SEP - - /* r26, r25, r24, r23 are free since vfork has no arguments */ -ENTRY(__vfork) - /* We must not create a frame. When the child unwinds to call - exec it will clobber the same frame that the parent - needs to unwind. */ - - /* Save the PIC register. */ -#ifdef PIC - copy %r19, %r25 /* parent */ -#endif - - /* Syscall saves and restores all register states */ - ble 0x100(%sr2,%r0) - ldi __NR_vfork,%r20 - - /* Check for error */ - ldi -4096,%r1 - comclr,>>= %r1,%ret0,%r0 /* Note: unsigned compare. */ - b,n .Lerror - - /* Return, and DO NOT restore rp. The child may have called - functions that updated the frame's rp. This works because - the kernel ensures rp is preserved across the vfork - syscall. */ - bv,n %r0(%rp) - -.Lerror: - /* Now we need a stack to call a function. We are assured - that there is no child now, so it's safe to create - a frame. */ - stw %rp, -20(%sp) - .cfi_offset 2, -20 - stwm %r3, 64(%sp) - .cfi_def_cfa_offset -64 - .cfi_offset 3, 0 - stw %sp, -4(%sp) - - sub %r0,%ret0,%r3 - SYSCALL_ERROR_HANDLER - /* Restore the PIC register (in delay slot) on error */ -#ifdef PIC - copy %r25, %r19 /* parent */ -#else - nop -#endif - /* Write syscall return into errno location */ - stw %r3, 0(%ret0) - ldw -84(%sp), %rp - bv %r0(%rp) - ldwm -64(%sp), %r3 -PSEUDO_END (__vfork) -libc_hidden_def (__vfork) -weak_alias (__vfork, vfork) -- cgit 1.4.1