From patchwork Mon Feb 26 21:03:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 129710 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp4290925edc; Mon, 26 Feb 2018 13:05:23 -0800 (PST) X-Google-Smtp-Source: AH8x225u9WW77FwXIMrnZM6ecv7/RVRWW+Qokoyob1ZKWh1QPnHpiRQN/WtXcXtQo4mM9PusUI4a X-Received: by 2002:a17:902:ba95:: with SMTP id k21-v6mr12123293pls.111.1519679123567; Mon, 26 Feb 2018 13:05:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519679123; cv=none; d=google.com; s=arc-20160816; b=M1m/1w4zk1e6JcgLVyrayi/68t9ZVce3Jsz2AaosW14PLSgXgDmk/SX+d8Kshrib8t 2hhXZkMTPj0+Oc65laSFS2hspqlBNWOOOojFeivsd/tdeHrpnkBknIh2Q9D9DMjzilI1 nuyNyzcrFxNVDEBI4wNTky1xyptHLLfK+mk8ucDZ/iNpWwZkUSB5OHkGRZmxU+a42McQ yIuSZLEKscN+paG3L66wH0ZE/gNQkmZ7U1Q0ImNpPa+R4sB3oU1XDeWX1z6SC+dqEAYL N2g2VmtfYWvTe2xwxd8wJMvtpWicHJ1WpXxxz4pk59ja9LE24+56Y4po0bZia9yZ7mGi ZihQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to: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=rAUuEneS+qPytZgXsnbUyy6v3Qv7It8G30fXgEteDVA=; b=RYMCwS4an/8dsL0ktQraEYKKDyBi2kwCtRe1v2FNX6thjxLZRJSRcQCfWvU3VvOB76 Gk5QvJAkPn/Q2NmDluSj6MaYEQnbvcodyC2z1Fz8ZwbNcDA8Bze5RhcDb5ECFN0eQSDa yQBuZFFzJt5LibTPliiTx9yH4XNY/aGsroZMWb6thgubTIq4RAFO1HcQBgfTxHvKXukv v+5tgprzJbDVYY19TOtOpHwznmFU25qf5SpvpIvWzdLuQcnVqxULfqrfZXBYBMkV720u xD/T76/GVejduFKBF1O3H79jJVXBnHFyx3dRdlmyvCYFYOoEAa86SCrUxFBWOTC9RZVB II+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=hPuLtDvv; spf=pass (google.com: domain of libc-alpha-return-90625-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-90625-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 n8si6033033pgt.427.2018.02.26.13.05.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Feb 2018 13:05:23 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-90625-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=hPuLtDvv; spf=pass (google.com: domain of libc-alpha-return-90625-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-90625-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:in-reply-to :references; q=dns; s=default; b=voS/vWlSSGYDMze5wcg1BqP3gn40ImC dkh2MKzS/9iwYLCADO8ok5MF36wNLpoeFsEVBtSowSF4e7brFIgWmE8lx1R1EFir IvSbXqGlIYOfAYs/lM7xUkpSuW8MRPXpCI+WrRvJA5TCHjeZbDWuQPg5uFDGaOmH pqs7f+t7tQsA= 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:in-reply-to :references; s=default; bh=fm9fvVCTOvPK3pngXKGk+zK/byE=; b=hPuLt DvvJBhCl6XVayjJE1tFCcOl/NotxcVamiiUrAeK3O+auwcUy597AOuVN8xFdHNow TtoH/5H2WbcqL4x4I1m7yxhG1LsRUJOgMnIqLFoZ4UU9Jt54dsVjTesXYmqngVbr DTNiG5PFmsjY+gMQ6SGG+VHHQqlT0N82pFg4YM= Received: (qmail 76049 invoked by alias); 26 Feb 2018 21:04:02 -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 75884 invoked by uid 89); 26 Feb 2018 21:04:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt0-f195.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:in-reply-to :references; bh=rAUuEneS+qPytZgXsnbUyy6v3Qv7It8G30fXgEteDVA=; b=EblDODW7SY/a4dlEBiLY1mXQ9FMOuxpBstH7vzcEwrFZ/v7M+571I6Bv9++WIeumhT iP9FfCQmgfTOUmwoukI0uO+vTD+G3LpkB968Q6OUTzHdEE5JFGNWPVmciTWoUcaO6GeZ imaWEJQ8Xywh1wWaO3CHQugafpqgzBCpO26gpmS3Ohcf4nlNusKahWpvo8iCs+Ki4FME jqeuuDoEgmR8xR5qACXVMeSyJhSDsa1MGPboTD7ddEK6JwqboZtsNzNqF0KiFCVhDvtU nVSAjOfodFBx4GDBlqP4Paz1Wbf/ui8VzyUaen6Z/VaX9MbqFayHMc+Ntg2+pPGYZGMp pYZw== X-Gm-Message-State: APf1xPBknFqfKn6mlybWeEpe3L1i/gcgeo51yppy/feij9ZlUJIb21GU yKIII/+uw9p7jF+Sx5gGuBBp7Wf39sA= X-Received: by 10.200.49.28 with SMTP id g28mr19193317qtb.279.1519679037602; Mon, 26 Feb 2018 13:03:57 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v2 09/21] nptl: arm: Fix Race conditions in pthread cancellation (BZ#12683) Date: Mon, 26 Feb 2018 18:03:24 -0300 Message-Id: <1519679016-12241-10-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1519679016-12241-1-git-send-email-adhemerval.zanella@linaro.org> References: <1519679016-12241-1-git-send-email-adhemerval.zanella@linaro.org> This patch adds the ARM modifications required for the BZ#12683. It basically adds the required ucontext_get_pc function and adjust the generic syscall_cancel build. For ARM we need to build syscall_cancel in ARM mode (-marm) to avoid INTERNAL_SYSCALL to issue the syscall through the helper gate __libc_do_syscall (which invalidates the mark checks on SIGCANCEL handler). Checked on arm-linux-gnueabihf. [BZ #12683] * sysdeps/unix/sysv/linux/arm/Makefile (CFLAGS-syscall_cancel.c): New rule. * sysdeps/unix/sysv/linux/arm/sigcontextinfo.h (ucontext_get_pc): New function. --- ChangeLog | 6 ++++++ sysdeps/unix/sysv/linux/arm/Makefile | 3 +++ sysdeps/unix/sysv/linux/arm/sigcontextinfo.h | 12 ++++++++++++ 3 files changed, 21 insertions(+) -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/arm/Makefile b/sysdeps/unix/sysv/linux/arm/Makefile index 4adc35d..8f01b52 100644 --- a/sysdeps/unix/sysv/linux/arm/Makefile +++ b/sysdeps/unix/sysv/linux/arm/Makefile @@ -30,6 +30,9 @@ endif ifeq ($(subdir),nptl) libpthread-sysdep_routines += libc-do-syscall libpthread-shared-only-routines += libc-do-syscall + +# INLINE_SYSCALL uses the helper __libc_do_syscall in thumb mode. +CFLAGS-syscall_cancel.c += -marm endif ifeq ($(subdir),resolv) diff --git a/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h b/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h index daf9bd3..3d4eb2f 100644 --- a/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h +++ b/sysdeps/unix/sysv/linux/arm/sigcontextinfo.h @@ -16,6 +16,10 @@ License along with the GNU C Library. If not, see . */ +#ifndef _SIGCONTEXTINFO_H +#define _SIGCONTEXTINFO_H + +#include #include #define SIGCONTEXT siginfo_t *_si, ucontext_t * @@ -46,3 +50,11 @@ (act)->sa_flags |= SA_SIGINFO; \ (sigaction) (sig, act, oact); \ }) + +static inline uintptr_t +ucontext_get_pc (const ucontext_t *uc) +{ + return uc->uc_mcontext.arm_pc; +} + +#endif /* _SIGCONTEXTINFO_H */