From patchwork Mon Dec 11 19:06:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 121448 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3169324qgn; Mon, 11 Dec 2017 11:09:58 -0800 (PST) X-Google-Smtp-Source: ACJfBouTlWj32dCoVWpHOrOPf0jf6fJDTToqu3Xbwbk2rT0sC1qUL/AYSge8Bd4JZgL5RQ/Xp7y9 X-Received: by 10.99.181.72 with SMTP id u8mr1205468pgo.118.1513019398635; Mon, 11 Dec 2017 11:09:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513019398; cv=none; d=google.com; s=arc-20160816; b=LbFownxMsfj4APtY+RegyAN6SkrE/gohP3G5lUvInvkGbe2AdQceLWVdTR+TEZrHzJ oP5coPQlpsKvsXGp2JhNqOgdCcXaneAHj6PmuBgIrq0ve06GKgs1QSYQaMk9NTqrCPcD zua2GQsxiPm55W8RkLy0GbRTXoS+uLNPs2Y3V0lFWHJYXlla1bluR3t+cwCLErwZ5KK0 PwIRLqknvb9GowFAHkDwH+XBHKteqJXki697sGKMU2dgJP1Kmj5y2Lj8emH/YK4YWA9V 1JFCr3hivDN7kQgHmuPWsQyUjKWSGS/tZYRnMDvDeQAuA19BF08IZVTKa+bqE4imJRlK /aaA== 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=xbYWbumA6kX8KYJKza5utUN/uiShIM9DdLlMXmBkjHY=; b=h41V5xeKQW5tnb1bVJbHRaLzK/EGe/ryY0uiTU43qkL+asQMRfKC0G2UYktpTLeU6R C1yQjEiDsBPDAlhYcgq4t3p47IQRACrHcqafBqugqWeeSd12CuwwTV5XvW4W8MsKw8TV tSUpIpmOl7Slkj1ye3HGu86027rleWSky0Y3vBAOlOqNNR0gLeUZX24qv/oeMaz3E7F3 v/HykQYz2uDitQmvE8E46wDyhV2WwtNMuToiqLUlSwv2aKlqKxU5GutUh20UaDunjm9i oMkoS5Pzb9gUBXJusS0/bMy78hM4+eOfJMuIa0t8KENtrbJVJ8XkSH/gRNPx/3xojdjV 5ZnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=r1nS9arh; spf=pass (google.com: domain of libc-alpha-return-88025-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-88025-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 v196si10138840pgb.825.2017.12.11.11.09.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2017 11:09:58 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-88025-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=r1nS9arh; spf=pass (google.com: domain of libc-alpha-return-88025-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-88025-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=DUfVg5dEKIkAK6YhiwZINLSRWcjdzr4 MeLXdJJOCDjwZJo3u3tE2q+COqfLdOCe3TjDFrebT28Yo5mlu36P4LC/bhwMbp7W usRB57KFNWnICNEJkImsiLikPzEUHUHEhL2M3IPJZVcuPi6zBHOsgGSZWrsu0Lio RDvXE8bZMggk= 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=FG/nfqmmhOaZOfJI9SzC4LjVYZQ=; b=r1nS9 arhbMlitRc4ut5IFrjcARU2se1sZNDJ3b9RhOg50txj2vhKJse4sYgElGIYgU5e9 QQ/hy1phw5xEOqjvxQVMSHx7u11FvoUZ0kz/ugteLGptbL1PqlxGTuSB1VNfxHio q1IuP+oDUodbwJswYTHKuHPRy/55y1y9KksCmg= Received: (qmail 42106 invoked by alias); 11 Dec 2017 19:07:30 -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 42091 invoked by uid 89); 11 Dec 2017 19:07:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 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-f196.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=xbYWbumA6kX8KYJKza5utUN/uiShIM9DdLlMXmBkjHY=; b=Q/qBiW5R+hKKY5t+TdVklISInwXjZ8VwxlxptbSH7B8gk4fpEPiczvMVlTl5gRlkNB MTOiyX47rwTuGS56VwAljLzNNEMUwFlFiNU9rSqL7aRE9RHOkZYC7kb8KAMfecdJMxNt YXzD7z3nmHsgoaFXcklbn703tHHjkPcOQfSeb6du6PUmE4x3Y+g0zDYfo0vk05Lggw3Z rdJ0d30CA/EcUhgehyA2fK4Su53V8jwlihkoR4x3sLT8sqa7ZgT0R+0G23ww4cFJNCfV QLhbaOBtAIZTXYwFXdFwaM3ZNjzFXqXIgnaGQUmz2RfboQpmz97muMAvGrBPc8kBNC8+ pwgQ== X-Gm-Message-State: AKGB3mLtBSaF6njiP/FmgASyGZ6ZZs6uQO6Kxh/TccCOdoQZueANqRkj KU+F0i1gwfeKO+6Gvhri3ALSnUx4SqA= X-Received: by 10.237.34.202 with SMTP id q10mr2056751qtc.341.1513019246752; Mon, 11 Dec 2017 11:07:26 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 11/19] nptl: alpha: Fix Race conditions in pthread cancellation (BZ#12683) Date: Mon, 11 Dec 2017 17:06:55 -0200 Message-Id: <1513019223-7603-12-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 alpha modifications required for the BZ#12683. It basically adds the required ucontext_get_pc function The default syscall_cancel.c should be fine for alpha and GCC 6.1 generates the following cod for syscall_cancel.os: --- 0000000000000000 <__GI___syscall_cancel_arch>: 0: 00 00 bb 27 ldah gp,0(t12) 4: 00 00 bd 23 lda gp,0(gp) 8: f0 ff de 23 lda sp,-16(sp) c: 00 04 f1 47 mov a1,v0 10: 00 00 5e b7 stq ra,0(sp) 0000000000000014 <__syscall_cancel_arch_start>: 14: 00 00 30 a0 ldl t0,0(a0) 18: 01 00 e1 43 sextl t0,t0 1c: 01 90 20 44 and t0,0x4,t0 20: 0f 00 20 f4 bne t0,60 <__syscall_cancel_arch_end+0x20> 24: 10 04 f2 47 mov a2,a0 28: 11 04 f3 47 mov a3,a1 2c: 12 04 f4 47 mov a4,a2 30: 10 00 9e a6 ldq a4,16(sp) 34: 13 04 f5 47 mov a5,a3 38: 18 00 be a6 ldq a5,24(sp) 3c: 83 00 00 00 callsys 0000000000000040 <__syscall_cancel_arch_end>: 40: 21 05 e0 43 negq v0,t0 44: 00 00 5e a7 ldq ra,0(sp) 48: c0 04 61 46 cmovne a3,t0,v0 4c: 10 00 de 23 lda sp,16(sp) 50: 01 80 fa 6b ret 54: 00 00 fe 2f unop 58: 1f 04 ff 47 nop 5c: 00 00 fe 2f unop 60: 00 00 7d a7 ldq t12,0(gp) 64: 00 40 5b 6b jsr ra,(t12),68 <__syscall_cancel_arch_end+0x28> 68: 1f 04 ff 47 nop 6c: 00 00 fe 2f unop --- Checked on alpha-linux-gnu, no regression found. * sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h (ucontext_get_pc): New function. Signed-off-by: Adhemerval Zanella --- ChangeLog | 4 ++++ sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h | 13 +++++++++++++ 2 files changed, 17 insertions(+) -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h b/sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h index e8b74d5..a61c289 100644 --- a/sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h +++ b/sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h @@ -15,6 +15,11 @@ License along with the GNU C Library. If not, see . */ +#ifndef _SIGCONTEXTINFO_H +#define _SIGCONTEXTINFO_H + +#include + #define SIGCONTEXT int _code, struct sigcontext * #define SIGCONTEXT_EXTRA_ARGS _code, #define GET_PC(ctx) ((void *) (ctx)->sc_pc) @@ -22,3 +27,11 @@ #define GET_STACK(ctx) ((void *) (ctx)->sc_regs[30]) #define CALL_SIGHANDLER(handler, signo, ctx) \ (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx)) + +static inline uintptr_t +ucontext_get_pc (const ucontext_t *uc) +{ + return uc->uc_mcontext.sc_pc; +} + +#endif /* _SIGCONTEXTINFO_H */