From patchwork Mon Feb 26 21:03:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 129703 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp4289703edc; Mon, 26 Feb 2018 13:04:10 -0800 (PST) X-Google-Smtp-Source: AH8x227M7C15FswScaEGF4mTedAPBmTmLhWcr08CXynzwUZ7ZN8D3ehJSGLOn9++0s9oMYVAMUGP X-Received: by 10.98.11.19 with SMTP id t19mr11934911pfi.70.1519679050129; Mon, 26 Feb 2018 13:04:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519679050; cv=none; d=google.com; s=arc-20160816; b=P3X9cc5kQb5lcUnuUu3b8AJCxNaJEzXx5gk4I/YB6CnxA3mIjEDyV/iBmNAcnQLurE Gp6jtrHpzGEZT/ua2TIAk25LYviCZ2wUKZDRqcnznsfjU4KnRYwUdtmP5et781uSYyeb O0eJeEmCSrv0QcAIzgzG1RwAOqFo2lsKsgYMvUdCxHDn9Y1aoyiHbZ/gDsh4FxZqgNv4 v+dVaKxZMtx1hELVKsIci+i8NszQY4ZQXzZ0Rsiq9aaG6CojnUEAJc8WBX99HlR0iKCB 8GpUXZAsPeICDvdwPjEzFkukH/Zm1AnwuC5nmN3I2S60NvhPAfG1jdcilZ3R2M0cELhH RHhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:to:from:delivered-to:sender:list-help :list-post:list-archive:list-subscribe:list-unsubscribe:list-id :precedence:mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=xqft9HFOFpGwNpfZMAcYluqUfmTTHUghJQ9Xq4Nb4iQ=; b=Oe3oy9NCXcJQ7qc7fzE4UPwKhJdJzeKrHdlfAPhJxeZ91vGqDYsWcS7XlsB8AnWhts GsRA9CuI8GRNJJKjL510S5B75k9Nyr8jFx8jg9A9/RPNUI2qwKj5u4buo21wfgsJGFME tWwTict9NuJm8FfRYXgbIZVhkuBhQ6kAIOXfLZ4dVHvXg95pg98acS4lYadNvxnKeMlx 8QE8SOxSoyUpUrUcgojKdEKfnUv6v0cRdWJqrpV2EScDi1VM03Byttmr9bjY9vIOHyPT 4Y4lb7QD3le8uOTxV0nGszzDqqjA/RC6vTV1FDe/8+YSLmN0/JKvfx0dX9Eze4iLQsrG A2kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Dk8Z0B93; spf=pass (google.com: domain of libc-alpha-return-90618-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-90618-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id o128si7306712pfo.68.2018.02.26.13.04.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Feb 2018 13:04:10 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-90618-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Dk8Z0B93; spf=pass (google.com: domain of libc-alpha-return-90618-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-90618-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; q=dns; s= default; b=p4JnQeKwTxXdOMjy1TojMlWD87lD6ajyIFvHR8V0fnEtm9UQj+HSY qvIQAT6Ai5AVFfCB/1wkzWW272c7yc2iD7l6i0hbSYhSGijLgfk66v3xVpLmUXwv ZvE4IR/IvS8KNxxC1gdC7BJZojr1wiw/eAD5b7ivGCqCSLDbmzllYU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; s=default; bh=8VylgvPfa+O5pwmLQVI2yr1jNDY=; b=Dk8Z0B93rFwsEHwqHdPKKLO5ca/2 W39zrfn3+PZ9h7Scsmcabpd+mfkHDcmbaovS62M7Idf0D1++oVdQCQiWyGnlkUh7 rCI6MiTocdkRAVz1BLtrT9jpoyKQiks0tHqpMlMxDMrqQ3ZCow+TAVCetM5Jr1fF ffnwvNWPikWnO18= Received: (qmail 73988 invoked by alias); 26 Feb 2018 21:03:48 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 73578 invoked by uid 89); 26 Feb 2018 21:03:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-12.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt0-f194.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=xqft9HFOFpGwNpfZMAcYluqUfmTTHUghJQ9Xq4Nb4iQ=; b=ADMTO6pRb6Uvq5IacK69I+iaeGu4ExsWE5ZR/RdziT6RIy+jx2vO3S+osPYxQ2I3Ez VE3Vewu+l+bdna2kHpnzqEWsZykdfxKSei+XGYl9Vuh5n6wR1LcrRJXtbxWT8IWh62wH HNjfK6WUTyUr0IkP0e9AhC23TvjT25Be5rgCTVE0IlowSgPzxBAEHSeUeA38Q3qMOiud vBHGYMlSA2Ge1IoKEzn6sMzG6oUXIyS1z86tdqWEXNjMd3KZ5kfLurGR4iY1qcWz9xDG RfQAta43XTA6XDpJDvidAT/N5BBIQdP9gfogVHc6++vG3Nyj4ZbvvdvXossoT3L/enT9 dGWA== X-Gm-Message-State: APf1xPCRSuXlwwjgSM/ER2Sc5rq8IJMFjbsyxqvQUu4LT/E2bF1hHIKD wrFxis+eLvEuj2NE6N3bb+sN+rFDoZk= X-Received: by 10.237.36.170 with SMTP id t39mr20302852qtc.136.1519679023582; Mon, 26 Feb 2018 13:03:43 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v2 00/21] nptl: Fix Race conditions in pthread cancellation (BZ#12683) Date: Mon, 26 Feb 2018 18:03:15 -0300 Message-Id: <1519679016-12241-1-git-send-email-adhemerval.zanella@linaro.org> Changes from previous version [1]: * Rebase againt master to incorporate the pthread_join consolidation. * Remove ARM syscall_cancel.S implementation and make it use default one instead. * Move the powerpc syscall stackframe to its own patch. * Added a RISCV port using generic syscall_cancel implementation. I currently tested on x86_64-linux-gnu, x86_64-linux-gnu-x32, i686-linux-gnu, arm-linux-gnueabihf, aarch64-linux-gnu, sparcv9-linux-gnu, sparc64-linux-gnu, alpha-linux-gnu, and hppa-linux-gnu. I also did some simple tests on ia64-linux-gnu and mips{64}-linux-gnu (to check for the correctness in the syscall wrapper implementation). For the rest of support architectures I just did a cross build/check. [1] https://sourceware.org/ml/libc-alpha/2017-12/msg00314.html Adhemerval Zanella (21): powerpc: Create stackframe information on syscall nptl: Fix testcases for new pthread cancellation mechanism nptl: Fix Race conditions in pthread cancellation (BZ#12683) nptl: x86_64: Fix Race conditions in pthread cancellation (BZ#12683) nptl: x32: Fix Race conditions in pthread cancellation (BZ#12683) nptl: i386: Fix Race conditions in pthread cancellation (BZ#12683) nptl: powerpc: Fix Race conditions in pthread cancellation (BZ#12683) nptl: aarch64: Fix Race conditions in pthread cancellation (BZ#12683) nptl: arm: Fix Race conditions in pthread cancellation (BZ#12683) nptl: s390: Fix Race conditions in pthread cancellation (BZ#12683) nptl: ia64: Fix Race conditions in pthread cancellation (BZ#12683) nptl: alpha: Fix Race conditions in pthread cancellation (BZ#12683) nptl: m68k: Fix Race conditions in pthread cancellation (BZ#12683) nptl: microblaze: Fix Race conditions in pthread cancellation (BZ#12683) nptl: tile: Fix Race conditions in pthread cancellation (BZ#12683) nptl: sparc: Fix Race conditions in pthread cancellation (BZ#12683) nptl: nios2: Fix Race conditions in pthread cancellation (BZ#12683) nptl: sh: Fix Race conditions in pthread cancellation (BZ#12683) nptl: mips: Fix Race conditions in pthread cancellation (BZ#12683) nptl: hppa: Fix Race conditions in pthread cancellation (BZ#12683) nptl: riscv: Fix Race conditions in pthread cancellation (BZ#12683) ChangeLog | 216 +++++++++++++++++++++ debug/tst-backtrace5.c | 28 +-- include/libc-pointer-arith.h | 16 +- io/creat.c | 3 - io/ppoll.c | 2 - manual/llio.texi | 4 +- misc/pselect.c | 2 - nptl/Makefile | 25 +-- nptl/Versions | 3 + nptl/cancellation.c | 101 ---------- nptl/descr.h | 15 +- nptl/libc-cancellation.c | 48 ++++- nptl/lll_timedlock_wait.c | 2 +- nptl/lll_timedwait_tid.c | 3 +- nptl/nptl-init.c | 78 +++++--- nptl/pthreadP.h | 74 +++---- nptl/pthread_cancel.c | 68 ++----- nptl/pthread_create.c | 7 +- nptl/pthread_exit.c | 9 +- nptl/pthread_join_common.c | 7 +- nptl/sem_wait.c | 8 +- nptl/tst-cancel-wrappers.sh | 92 --------- nptl/tst-cancel2.c | 3 - nptl/tst-cancel28.c | 94 +++++++++ nptl/tst-cancel3.c | 3 - nptl/tst-cancel4.c | 8 + rt/Makefile | 1 - support/temp_file.c | 23 +++ support/temp_file.h | 6 + sysdeps/generic/sigcontextinfo.h | 15 ++ sysdeps/generic/sysdep-cancel.h | 3 - sysdeps/i386/nptl/tls.h | 11 -- sysdeps/mips/nptl/tls.h | 2 +- sysdeps/nptl/Makefile | 3 +- sysdeps/nptl/aio_misc.h | 13 +- sysdeps/nptl/gai_misc.h | 13 +- sysdeps/nptl/lowlevellock.h | 5 +- sysdeps/posix/open64.c | 12 +- sysdeps/posix/pause.c | 2 - sysdeps/posix/sigpause.c | 3 - sysdeps/posix/sigwait.c | 9 +- sysdeps/posix/waitid.c | 11 +- sysdeps/sh/sysdep.h | 1 + sysdeps/sparc/sparc32/lowlevellock.c | 3 +- sysdeps/unix/sysdep.h | 118 +++++++++-- sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h | 11 ++ sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h | 13 ++ sysdeps/unix/sysv/linux/arm/Makefile | 3 + sysdeps/unix/sysv/linux/arm/sigcontextinfo.h | 12 ++ sysdeps/unix/sysv/linux/clock_nanosleep.c | 20 +- sysdeps/unix/sysv/linux/creat.c | 2 - sysdeps/unix/sysv/linux/creat64.c | 2 - sysdeps/unix/sysv/linux/futex-internal.h | 18 +- .../sysv/linux/hppa/sigcontextinfo.h} | 26 ++- sysdeps/unix/sysv/linux/hppa/syscall_cancel.S | 82 ++++++++ sysdeps/unix/sysv/linux/i386/Makefile | 2 +- sysdeps/unix/sysv/linux/i386/lowlevellock.h | 2 +- sysdeps/unix/sysv/linux/i386/sigcontextinfo.h | 13 ++ sysdeps/unix/sysv/linux/i386/syscall_cancel.S | 107 ++++++++++ sysdeps/unix/sysv/linux/ia64/sigcontextinfo.h | 24 +++ sysdeps/unix/sysv/linux/ia64/syscall_cancel.S | 94 +++++++++ sysdeps/unix/sysv/linux/lowlevellock-futex.h | 34 +++- sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h | 13 ++ .../unix/sysv/linux/microblaze/sigcontextinfo.h | 13 ++ .../unix/sysv/linux/microblaze/syscall_cancel.S | 62 ++++++ .../unix/sysv/linux/mips/mips32/syscall_cancel.S | 128 ++++++++++++ sysdeps/unix/sysv/linux/mips/mips32/sysdep.h | 4 + sysdeps/unix/sysv/linux/mips/sigcontextinfo.h | 13 +- sysdeps/unix/sysv/linux/nios2/sigcontextinfo.h | 16 ++ sysdeps/unix/sysv/linux/powerpc/sigcontextinfo.h | 16 ++ sysdeps/unix/sysv/linux/powerpc/syscall.S | 14 ++ sysdeps/unix/sysv/linux/powerpc/syscall_cancel.S | 64 ++++++ sysdeps/unix/sysv/linux/pthread_kill.c | 5 +- sysdeps/unix/sysv/linux/riscv/sigcontextinfo.h | 12 ++ sysdeps/unix/sysv/linux/s390/sigcontextinfo.h | 17 ++ sysdeps/unix/sysv/linux/sh/sigcontextinfo.h | 11 ++ sysdeps/unix/sysv/linux/sh/syscall_cancel.S | 125 ++++++++++++ sysdeps/unix/sysv/linux/sigwait.c | 3 - sysdeps/unix/sysv/linux/sigwaitinfo.c | 3 - sysdeps/unix/sysv/linux/socketcall.h | 37 +++- sysdeps/unix/sysv/linux/sparc/lowlevellock.h | 2 +- .../unix/sysv/linux/sparc/sparc32/sigcontextinfo.h | 52 +++++ .../unix/sysv/linux/sparc/sparc32/syscall_cancel.S | 74 +++++++ .../libc-cancellation.S => sparc/sparc64/pause.c} | 14 +- .../unix/sysv/linux/sparc/sparc64/sigcontextinfo.h | 40 ++++ .../unix/sysv/linux/sparc/sparc64/syscall_cancel.S | 74 +++++++ sysdeps/unix/sysv/linux/syscall_cancel.c | 64 ++++++ sysdeps/unix/sysv/linux/sysdep.h | 17 ++ sysdeps/unix/sysv/linux/tile/sigcontextinfo.h | 12 ++ sysdeps/unix/sysv/linux/x86_64/cancellation.S | 115 ----------- .../unix/sysv/linux/x86_64/librt-cancellation.S | 21 -- sysdeps/unix/sysv/linux/x86_64/lowlevellock.h | 8 +- sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h | 11 ++ sysdeps/unix/sysv/linux/x86_64/x32/sysdep.h | 13 ++ sysdeps/x86_64/nptl/tcb-offsets.sym | 1 - sysdeps/x86_64/nptl/tls.h | 11 -- 96 files changed, 2014 insertions(+), 709 deletions(-) delete mode 100644 nptl/cancellation.c delete mode 100644 nptl/tst-cancel-wrappers.sh create mode 100644 nptl/tst-cancel28.c rename sysdeps/{nptl/librt-cancellation.c => unix/sysv/linux/hppa/sigcontextinfo.h} (55%) create mode 100644 sysdeps/unix/sysv/linux/hppa/syscall_cancel.S create mode 100644 sysdeps/unix/sysv/linux/i386/syscall_cancel.S create mode 100644 sysdeps/unix/sysv/linux/ia64/syscall_cancel.S create mode 100644 sysdeps/unix/sysv/linux/microblaze/syscall_cancel.S create mode 100644 sysdeps/unix/sysv/linux/mips/mips32/syscall_cancel.S create mode 100644 sysdeps/unix/sysv/linux/powerpc/syscall_cancel.S create mode 100644 sysdeps/unix/sysv/linux/sh/syscall_cancel.S create mode 100644 sysdeps/unix/sysv/linux/sparc/sparc32/syscall_cancel.S rename sysdeps/unix/sysv/linux/{x86_64/libc-cancellation.S => sparc/sparc64/pause.c} (66%) create mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/syscall_cancel.S create mode 100644 sysdeps/unix/sysv/linux/syscall_cancel.c delete mode 100644 sysdeps/unix/sysv/linux/x86_64/cancellation.S delete mode 100644 sysdeps/unix/sysv/linux/x86_64/librt-cancellation.S -- 2.7.4