From patchwork Fri Apr 16 09:20:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 1466949 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=XbZOyxB4; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FM9f873dWz9sV5 for ; Fri, 16 Apr 2021 19:20:00 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B05793890424; Fri, 16 Apr 2021 09:19:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B05793890424 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1618564798; bh=6k99i1mmPUZvbWN4EmSYaLSJe09OGwD1E9sPFgYNBoU=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=XbZOyxB4NF+T1s1NuMYGp2WOLnUNfGkQNIo76EZv0garuUREHFxjVEYdCZgX78RI+ tpT23vAC/e5AXyo0VB46oX6fNPG4ob74P3kyO0x6fxhHJVHGOxoZP6mlEP4hvFOHXc oUhYhaibQtJN9wTlHEpIpm/8gkyQVDK4rC4UdTK8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id D81903890418 for ; Fri, 16 Apr 2021 09:19:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D81903890418 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-145-6ER21egaMhW6sTLZap9HFA-1; Fri, 16 Apr 2021 05:19:50 -0400 X-MC-Unique: 6ER21egaMhW6sTLZap9HFA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BB3B46D241 for ; Fri, 16 Apr 2021 09:19:49 +0000 (UTC) Received: from oldenburg.str.redhat.com (ovpn-113-139.ams2.redhat.com [10.36.113.139]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C824E5C626 for ; Fri, 16 Apr 2021 09:19:48 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH v4 00/37] libpthread: Remove NPTL forwarders Message-Id: Date: Fri, 16 Apr 2021 11:20:06 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" I was on pseudo-vacation for a while and then some urgent downstream work came up. Sorry. I hope to return to libpthread work part-time next week, and full time after that. Hopefully this will get us back on track. I believe this series addresses all of Adhemerval's review comments. It switches to OTHER_SHLIB_COMPAT. I've retested this on i686-linux-gnu and x86_64-linux-gnu, and built the entire thing with build-many-glibcs.py. Thanks, Florian Adhemerval Zanella (1): x86: Restore compile-time check for shadow stack pointer in longjmp Florian Weimer (36): nptl: Move pthread_mutex_consistent into libc nptl: Move __pthread_cleanup_routine into libc nptl: Move legacy unwinding implementation into libc nptl: Move legacy cancelation handling into libc as compat symbols nptl: Remove longjmp, siglongjmp from libpthread nptl: Move __pthread_cleanup_upto into libc nptl: Move pthread_once and __pthread_once into libc nptl: Move __pthread_unwind_next into libc csu: Move calling main out of __libc_start_main_impl nptl: Move internal __nptl_nthreads variable into libc nptl_db: Introduce DB_MAIN_ARRAY_VARIABLE nptl: Move __pthread_keys global variable into libc nptl: Move __nptl_deallocate_tsd into libc nptl: Move pthread_exit into libc nptl: Move pthread_setcancelstate into libc nptl: Move pthread_setcanceltype into libc nptl: Invoke the set_robust_list system call directly in fork dlfcn: Failures after dlmopen should not terminate process [BZ #24772] dlfcn: dlerror needs to call free from the base namespace [BZ #24773] Remove pthread_key_create-related internals from libc-lock.h elf: Introduce __tls_init_tp for second-phase TCB initialization nptl: Move part of TCB initialization from libpthread to __tls_init_tp nptl: Move pthread_key_create, __pthread_key_create into libc nptl: Move pthread_getspecific, __pthread_getspecific into libc nptl: Move pthread_setspecific, __pthread_setspecific into libc nptl: Move pthread_key_delete into libc. nptl: Move rwlock functions with forwarders into libc nptl: Move the internal thread priority protection symbols into libc pthread: Introduce __pthread_early_init nptl: Move internal symbol __mutex_aconf into libc nptl: pthread_mutex_lock, pthread_mutex_unock single-threaded optimization x86: Remove low-level lock optimization nptl: Move core mutex functions into libc nptl: Move core condition variable functions into libc nptl: Move setxid broadcast implementation into libc nptl: Remove remnants of the libc/libpthread forwarder interface NEWS | 4 +- csu/libc-start.c | 74 +---- csu/libc-tls.c | 8 +- dlfcn/Makefile | 3 +- dlfcn/Versions | 6 +- dlfcn/dlerror.c | 303 ++++++++---------- dlfcn/dlerror.h | 92 ++++++ dlfcn/libc_dlerror_result.c | 39 +++ elf/Makefile | 12 +- elf/dl-error-skeleton.c | 12 + elf/dl-exception.c | 11 + elf/dl-tls_init_tp.c | 24 ++ elf/libc_early_init.c | 3 + elf/rtld.c | 16 +- elf/tst-dlmopen-dlerror-mod.c | 58 ++++ elf/tst-dlmopen-dlerror.c | 49 +++ include/dlfcn.h | 2 - include/setjmp.h | 4 +- libio/iopopen.c | 5 +- malloc/set-freeres.c | 10 +- malloc/thread-freeres.c | 2 + misc/error.c | 19 +- nptl/Makefile | 92 +++--- nptl/Versions | 133 +++++--- nptl/allocatestack.c | 209 ------------ nptl/cleanup_compat.c | 18 +- nptl/cleanup_defer_compat.c | 72 +---- nptl/cleanup_routine.c | 11 +- nptl/forward.c | 131 -------- nptl/libc-cleanup.c | 64 +++- nptl/libc_pthread_init.c | 35 +- nptl/libpthread-compat.c | 5 + nptl/nptl-init.c | 152 +-------- nptl/nptl_deallocate_tsd.c | 112 +++++++ nptl/nptl_nthreads.c | 23 ++ nptl/nptl_setxid.c | 279 ++++++++++++++++ nptl/old_pthread_cond_broadcast.c | 2 +- nptl/old_pthread_cond_signal.c | 2 +- nptl/old_pthread_cond_timedwait.c | 2 +- nptl/old_pthread_cond_wait.c | 2 +- nptl/pt-longjmp.c | 49 --- nptl/pthreadP.h | 111 ++++--- nptl/pthread_cancel.c | 10 +- nptl/{pt-cleanup.c => pthread_cleanup_upto.c} | 2 +- nptl/pthread_cond_broadcast.c | 10 +- nptl/pthread_cond_signal.c | 8 +- nptl/pthread_cond_wait.c | 62 ++-- nptl/pthread_create.c | 102 +----- nptl/pthread_exit.c | 20 +- nptl/pthread_getspecific.c | 18 +- nptl/pthread_key_create.c | 20 +- nptl/pthread_key_delete.c | 16 +- nptl/pthread_keys.c | 24 ++ nptl/pthread_mutex_cond_lock.c | 4 +- nptl/pthread_mutex_conf.c | 1 + nptl/pthread_mutex_consistent.c | 18 +- nptl/pthread_mutex_destroy.c | 16 +- nptl/pthread_mutex_init.c | 16 +- nptl/pthread_mutex_lock.c | 47 ++- nptl/pthread_mutex_unlock.c | 34 +- nptl/pthread_once.c | 15 +- nptl/pthread_rwlock_rdlock.c | 16 +- nptl/pthread_rwlock_unlock.c | 18 +- nptl/pthread_rwlock_wrlock.c | 16 +- nptl/pthread_setcancelstate.c | 6 +- nptl/pthread_setcanceltype.c | 3 +- nptl/pthread_setspecific.c | 20 +- nptl/tpp.c | 6 +- nptl/tst-cleanup4.c | 5 + nptl/tst-cleanup4aux.c | 5 + nptl/tst-pthread_exit-nothreads-static.c | 19 ++ nptl/tst-pthread_exit-nothreads.c | 28 ++ nptl/unwind.c | 13 +- nptl/vars.c | 5 - nptl_db/db-symbols.awk | 1 + nptl_db/structs.def | 9 +- setjmp/Versions | 4 - stdlib/fmtmsg.c | 9 +- sysdeps/arm/Makefile | 5 - sysdeps/arm/nptl/unwind-forcedunwind.c | 25 -- sysdeps/arm/pt-arm-unwind-resume.S | 20 -- sysdeps/generic/ldsodefs.h | 21 ++ sysdeps/generic/libc-lock.h | 12 - sysdeps/generic/libc_start_call_main.h | 24 ++ sysdeps/generic/unwind-resume.c | 14 + sysdeps/htl/libc-lockP.h | 13 - sysdeps/i386/nptl/pthread_spin_lock.S | 1 - .../unwind-resume.c} | 5 +- sysdeps/nptl/dl-tls_init_tp.c | 67 ++++ sysdeps/nptl/fork.c | 14 +- sysdeps/nptl/jmp-unwind.c | 8 +- sysdeps/nptl/libc-lock.h | 59 ++-- sysdeps/nptl/libc-lockP.h | 160 ++------- sysdeps/nptl/libc_start_call_main.h | 74 +++++ sysdeps/nptl/pthread-functions.h | 88 ----- sysdeps/nptl/pthread.h | 10 +- .../nptl/pthread_early_init.h | 22 +- {nptl => sysdeps/nptl}/pthread_mutex_conf.h | 9 +- sysdeps/nptl/setxid.h | 26 +- sysdeps/nptl/unwind-forcedunwind.c | 64 ---- sysdeps/posix/system.c | 5 +- sysdeps/powerpc/Versions | 4 - sysdeps/powerpc/longjmp.c | 14 +- sysdeps/pthread/Makefile | 2 +- sysdeps/pthread/pthread_early_init.h | 29 ++ .../pthread/pthread_mutex_conf.h | 17 +- sysdeps/pthread/tst-robust1.c | 4 +- sysdeps/pthread/tst-robust8.c | 2 +- sysdeps/pthread/tst-robust9.c | 4 +- sysdeps/unix/sysv/linux/aarch64/libc.abilist | 48 +++ .../sysv/linux/aarch64/libpthread.abilist | 41 --- sysdeps/unix/sysv/linux/alpha/libc.abilist | 48 +++ .../unix/sysv/linux/alpha/libpthread.abilist | 46 +-- sysdeps/unix/sysv/linux/arc/libc.abilist | 48 +++ .../unix/sysv/linux/arc/libpthread.abilist | 39 --- sysdeps/unix/sysv/linux/arm/be/libc.abilist | 48 +++ .../unix/sysv/linux/arm/be/libpthread.abilist | 41 --- sysdeps/unix/sysv/linux/arm/le/libc.abilist | 48 +++ .../unix/sysv/linux/arm/le/libpthread.abilist | 41 --- sysdeps/unix/sysv/linux/csky/libc.abilist | 48 +++ .../unix/sysv/linux/csky/libpthread.abilist | 39 --- sysdeps/unix/sysv/linux/fatal-prepare.h | 4 +- sysdeps/unix/sysv/linux/hppa/libc.abilist | 48 +++ .../unix/sysv/linux/hppa/libpthread.abilist | 46 +-- sysdeps/unix/sysv/linux/i386/libc.abilist | 48 +++ .../unix/sysv/linux/i386/libpthread.abilist | 46 +-- sysdeps/unix/sysv/linux/ia64/Makefile | 2 +- sysdeps/unix/sysv/linux/ia64/libc.abilist | 48 +++ .../unix/sysv/linux/ia64/libpthread.abilist | 46 +-- sysdeps/unix/sysv/linux/internal-signals.h | 4 - .../sysv/linux/m68k/coldfire/libc.abilist | 48 +++ .../linux/m68k/coldfire/libpthread.abilist | 41 --- .../unix/sysv/linux/m68k/m680x0/libc.abilist | 48 +++ .../sysv/linux/m68k/m680x0/libpthread.abilist | 46 +-- .../sysv/linux/microblaze/be/libc.abilist | 48 +++ .../linux/microblaze/be/libpthread.abilist | 41 --- .../sysv/linux/microblaze/le/libc.abilist | 48 +++ .../linux/microblaze/le/libpthread.abilist | 41 --- .../sysv/linux/mips/mips32/fpu/libc.abilist | 48 +++ .../sysv/linux/mips/mips32/libpthread.abilist | 46 +-- .../sysv/linux/mips/mips32/nofpu/libc.abilist | 48 +++ .../sysv/linux/mips/mips64/libpthread.abilist | 46 +-- .../sysv/linux/mips/mips64/n32/libc.abilist | 48 +++ .../sysv/linux/mips/mips64/n64/libc.abilist | 48 +++ sysdeps/unix/sysv/linux/nios2/libc.abilist | 48 +++ .../unix/sysv/linux/nios2/libpthread.abilist | 41 --- .../linux/powerpc/powerpc32/fpu/libc.abilist | 48 +++ .../powerpc/powerpc32/libpthread.abilist | 48 +-- .../powerpc/powerpc32/nofpu/libc.abilist | 48 +++ .../linux/powerpc/powerpc64/be/libc.abilist | 48 +++ .../powerpc/powerpc64/be/libpthread.abilist | 48 +-- .../linux/powerpc/powerpc64/le/libc.abilist | 48 +++ .../powerpc/powerpc64/le/libpthread.abilist | 41 --- sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c | 61 ---- sysdeps/unix/sysv/linux/pthread-pids.h | 29 -- .../unix/sysv/linux/riscv/rv32/libc.abilist | 48 +++ .../sysv/linux/riscv/rv32/libpthread.abilist | 39 --- .../unix/sysv/linux/riscv/rv64/libc.abilist | 48 +++ .../sysv/linux/riscv/rv64/libpthread.abilist | 39 --- sysdeps/unix/sysv/linux/s390/Versions | 2 +- sysdeps/unix/sysv/linux/s390/jmp-unwind.c | 7 +- .../unix/sysv/linux/s390/libpthread-compat.c | 25 ++ sysdeps/unix/sysv/linux/s390/pt-longjmp.c | 33 -- .../unix/sysv/linux/s390/s390-32/libc.abilist | 48 +++ .../linux/s390/s390-32/libpthread.abilist | 49 +-- .../unix/sysv/linux/s390/s390-64/libc.abilist | 48 +++ .../linux/s390/s390-64/libpthread.abilist | 49 +-- sysdeps/unix/sysv/linux/sh/be/libc.abilist | 48 +++ .../unix/sysv/linux/sh/be/libpthread.abilist | 46 +-- sysdeps/unix/sysv/linux/sh/le/libc.abilist | 48 +++ .../unix/sysv/linux/sh/le/libpthread.abilist | 46 +-- .../sysv/linux/sparc/sparc32/libc.abilist | 48 +++ .../linux/sparc/sparc32/libpthread.abilist | 46 +-- .../sysv/linux/sparc/sparc64/libc.abilist | 48 +++ .../linux/sparc/sparc64/libpthread.abilist | 46 +-- sysdeps/unix/sysv/linux/spawni.c | 5 +- sysdeps/unix/sysv/linux/x86/longjmp.c | 39 +++ sysdeps/unix/sysv/linux/x86/lowlevellock.h | 87 ----- .../unix/sysv/linux/x86_64/64/libc.abilist | 48 +++ .../sysv/linux/x86_64/64/libpthread.abilist | 46 +-- .../unix/sysv/linux/x86_64/x32/libc.abilist | 48 +++ .../sysv/linux/x86_64/x32/libpthread.abilist | 41 --- sysdeps/x86/nptl/pt-longjmp.c | 71 ---- sysdeps/x86_64/nptl/pthread_spin_lock.S | 1 - 184 files changed, 3567 insertions(+), 3318 deletions(-) create mode 100644 dlfcn/dlerror.h create mode 100644 dlfcn/libc_dlerror_result.c create mode 100644 elf/dl-tls_init_tp.c create mode 100644 elf/tst-dlmopen-dlerror-mod.c create mode 100644 elf/tst-dlmopen-dlerror.c delete mode 100644 nptl/forward.c create mode 100644 nptl/nptl_deallocate_tsd.c create mode 100644 nptl/nptl_nthreads.c create mode 100644 nptl/nptl_setxid.c delete mode 100644 nptl/pt-longjmp.c rename nptl/{pt-cleanup.c => pthread_cleanup_upto.c} (98%) create mode 100644 nptl/pthread_keys.c create mode 100644 nptl/tst-pthread_exit-nothreads-static.c create mode 100644 nptl/tst-pthread_exit-nothreads.c delete mode 100644 sysdeps/arm/nptl/unwind-forcedunwind.c delete mode 100644 sysdeps/arm/pt-arm-unwind-resume.S create mode 100644 sysdeps/generic/libc_start_call_main.h rename sysdeps/{unix/sysv/linux/ia64/unwind-forcedunwind.c => ia64/unwind-resume.c} (87%) create mode 100644 sysdeps/nptl/dl-tls_init_tp.c create mode 100644 sysdeps/nptl/libc_start_call_main.h delete mode 100644 sysdeps/nptl/pthread-functions.h rename nptl/pthread-pids.h => sysdeps/nptl/pthread_early_init.h (61%) rename {nptl => sysdeps/nptl}/pthread_mutex_conf.h (86%) delete mode 100644 sysdeps/nptl/unwind-forcedunwind.c create mode 100644 sysdeps/pthread/pthread_early_init.h rename dlfcn/dlfreeres.c => sysdeps/pthread/pthread_mutex_conf.h (74%) delete mode 100644 sysdeps/unix/sysv/linux/powerpc/pt-longjmp.c delete mode 100644 sysdeps/unix/sysv/linux/pthread-pids.h create mode 100644 sysdeps/unix/sysv/linux/s390/libpthread-compat.c delete mode 100644 sysdeps/unix/sysv/linux/s390/pt-longjmp.c create mode 100644 sysdeps/unix/sysv/linux/x86/longjmp.c delete mode 100644 sysdeps/unix/sysv/linux/x86/lowlevellock.h delete mode 100644 sysdeps/x86/nptl/pt-longjmp.c