From patchwork Mon Dec 11 19:06:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 121443 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3168225qgn; Mon, 11 Dec 2017 11:08:54 -0800 (PST) X-Google-Smtp-Source: ACJfBov0rGlBvdnVXl8gU3Kf8uzZQ/9qupCOoCrfOaX8A1FyMRMoh2pel6P5pFoqxzvvz4q/35Vg X-Received: by 10.159.252.197 with SMTP id o5mr1322285pls.46.1513019334849; Mon, 11 Dec 2017 11:08:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513019334; cv=none; d=google.com; s=arc-20160816; b=Hyd5QK1cdBekaMZ67UoVEpf7TcU6dj5gWSxVMExyd/J3V1ikdYMj8Kf9/TUFja9Fjl g9K5LS1sG6chef3Bx6+iFQAxSPNh6i4Kr8V46bZKJvQEUbQOJjF15t3G4V0iKCddgsP0 RzLgWWmU4hFu87YIOHSlG6fjSjxSnBJymr3vQD+xfFKodaIiweVSDIsZsfyjLEZkGc7F T/uxm4cCeIZ7cYPDqT0tm4WPLSYd13xK6zXrQMqa9HgR4Z/oC47Ae1U2X9xtXm+Y2jMP KM0cmt8rDwspFrjSVpuPj96HRZyGhPCKV9xNqIrtk9+GbW0f7hYmLTJ8MEsEAi4gd0tE RlUQ== 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=+ZzPUeqVpgNTa1Rnv9v8I/qJhq2Aoh1svP3JDkJ2PZI=; b=SydXTS+6IyE2zVzfhnFpVol/ASSGXhlG3VJ5hmjAcHrZsTaMB1Bb6beVxE1xD2ZJd3 QwkgcVBuJ1xxJmk/2GUBKsZaEjGcSSrZRzz4uE24EpHBTyBH0zmz2lOf6jUnBlKTPWto D+JqwpACJOp3siSSV/czVDZb6wNNpbuuPcwAgPfAtbyM45uhfHkBALttlHB8WwuStzPc 0QNSYOjYd7XM6FJF67t+543VxezxMtoQLSqpqYDkw47oMB2Var+vxqdSjuU93oufeBkO nzQ/BUCe9HXQnHNvuxhsD/cpVqA1h7FnjujOLyweOh+mjRDiGcQhdmAlrW8mhvHCi0Gd +xLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=GSNxj4il; spf=pass (google.com: domain of libc-alpha-return-88020-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-88020-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 c26si11441428pfh.105.2017.12.11.11.08.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2017 11:08:54 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-88020-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=GSNxj4il; spf=pass (google.com: domain of libc-alpha-return-88020-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-88020-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=wJEVW4v+1ZmxySJzvvs+8Sz2QjIY4y9 IwzkeDPvtwRnWQZrAjNeXDCoPCEAsG/+v/ZOTSbnLRHVyLhjuS1i3BUob5HM6frG UAGwWq0HQdWKZRNSvp1eCR4Q37uuwvVbzLoJmtnP1t8k/3onVI7aHKIuU2VVRBO6 FF9JDSbfTdY0= 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=u/2b6qjROyAq91THcECO5f2CEZI=; b=GSNxj 4ilwbKdMeTPuK1JjKIYc8QF31itstzEDJVb5DHoThGJkK+R3vxTjWuIYZbbE+1Gc Ljk1pf5/KbE+724rrax6zRIJhhXOYpcMZqNS/MjM9fZ+79P4PedhLqaMCMODSjuK yjwRmBrQwIQH9ZlYj1vPIJ5i4EwjIidSCR4tpU= Received: (qmail 41388 invoked by alias); 11 Dec 2017 19:07:24 -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 41358 invoked by uid 89); 11 Dec 2017 19:07:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.8 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=H*RU:209.85.216.195, Hx-spam-relays-external:209.85.216.195, 3611 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=+ZzPUeqVpgNTa1Rnv9v8I/qJhq2Aoh1svP3JDkJ2PZI=; b=jqmJ5YBloYsuSnaKBbjwotgv2dx7SUGbqivmgFwWQmjhNyqKoKBl8VsuX36dYBEcb3 mYkpcab8ztWD+EOUHeao7JOKujlG+7OPxyQmSWOfCcncupSZkVh2wViclidDLeNPK9Lg EqFcYQve/yJ7B37ngQoWV7bkENgreMaAIttyvQYylhiuLXkuZx13ksRzGeYtXtnFPkGa gF/grmlPMTNnmejchSqX/EKRgzsVEIB+cQhw1VInJSwmIIZdk3FGMPfiAhY/taVQDYz8 KHN9OHpbDD559+dvC1YH93sTIBIrAdecBdIs1oi5PD0FdjptZGXAqRfb2vVc8ND6xjs1 FF3A== X-Gm-Message-State: AKGB3mLDT4BwOJ4VT+VfVhjua//58otYUFSKmcz+hv3HxMgBvIjRZCdk 23caNrnwjsTL/da9CGiN0+grLpsrI/c= X-Received: by 10.55.19.19 with SMTP id d19mr1815668qkh.189.1513019240764; Mon, 11 Dec 2017 11:07:20 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 07/19] nptl: aarch64: Fix Race conditions in pthread cancellation (BZ#12683) Date: Mon, 11 Dec 2017 17:06:51 -0200 Message-Id: <1513019223-7603-8-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1513019223-7603-1-git-send-email-adhemerval.zanella@linaro.org> References: <1513019223-7603-1-git-send-email-adhemerval.zanella@linaro.org> This patch adds the aarch64 modifications required for the BZ#12683. It basically adds the required ucontext_get_pc function. The built cancelable syscall wrapper for aarch64 using GCC 7.2.1 and default configuration flags shows an expected optimized version: --- __GI___syscall_cancel_arch: .LFB38: .cfi_startproc .global __syscall_cancel_arch_start .type __syscall_cancel_arch_start,@function __syscall_cancel_arch_start: ldr w9, [x0] tbnz x9, 2, .L7 mov x8, x1 mov x0, x2 mov x1, x3 mov x2, x4 mov x3, x5 mov x4, x6 mov x5, x7 svc 0 // syscall nr .global __syscall_cancel_arch_end .type __syscall_cancel_arch_end,@function __syscall_cancel_arch_end: ret --- A similar code is obtained with GCC 5.3.1, so I see to need to provide an arch-specific syscall_cancel.S for aarch64. Checked on aarch64-linux-gnu. * sysdeps/unix/sysv/linux/aarch64/sysdep-cancel.h (PSEUDO): Redefine to call __syscall_cancel function for cancellable syscalls. (__pthread_get_ip): Add implementation. * sysdeps/unix/sysv/linux/aarch64/sysdep.h (SYSCALL_CANCEL_ERROR): Add definition. (SYSCALL_CANCEL_ERRNO): Likewise. Signed-off-by: Adhemerval Zanella --- ChangeLog | 3 +++ sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h | 11 +++++++++++ 2 files changed, 14 insertions(+) -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h b/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h index 7793d11..4213be9 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h +++ b/sysdeps/unix/sysv/linux/aarch64/sigcontextinfo.h @@ -16,6 +16,9 @@ License along with the GNU C Library; if not, see . */ +#ifndef _SIGCONTEXTINFO_H +#define _SIGCONTEXTINFO_H + #include #include @@ -33,3 +36,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.pc; +} + +#endif