From patchwork Mon Feb 26 21:03:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 26087 Received: (qmail 77120 invoked by alias); 26 Feb 2018 21:04:09 -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 76695 invoked by uid 89); 26 Feb 2018 21:04:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=cod X-HELO: mail-qt0-f181.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=VVQell1oQ7MntDbjEHsRILnAWhnsUxWeKxijv+xVJlc=; b=kWMoUuhaw9bWBrqHBmw8ebPS0lvWPnZtCy8b2qwC7GyQAOvYjiKtW4AZFWzq25OaB0 HiQm2BhOZqZY6QQLx/bTO/rBn+p0DX4+jpJNBoslvLNP481K+jhvOqo0aMYhCsuZ8Ols GEE1s+8VlMkuVbm5n26uCuExlW4XuKzV7k/DhZORqs3CR1GicyRm+gUhc2+qLBQB7Qan YOxPQkm8HPQLkDGBjiv4UJUwsAts1QhgvjbV9B+TV0B8K4Li2xPccBXfDhA01UPr5zfV EvhZtaPyO60fwb7DeZC+gFaHbK+Gw1W5zoXWkPnL2JfcOLzpWbwSF52ZBgDcZWtT2L4L wDww== X-Gm-Message-State: APf1xPAGfX99e42Dudh29PI86jy5GMzSIUUR+Jc3lGFvcMgYcF8AopKW 4YLOIoxWB/yCjWJecPmR23mGVxCOZVc= X-Google-Smtp-Source: AG47ELuFZxMIOQJ3uefu1thX+9LiTaJengGX7qlTgiOHHLOTNwAmv8q5oOld7dgIieNaxCjFDrL9IQ== X-Received: by 10.200.34.209 with SMTP id g17mr18745066qta.93.1519679042634; Mon, 26 Feb 2018 13:04:02 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v2 12/21] nptl: alpha: Fix Race conditions in pthread cancellation (BZ#12683) Date: Mon, 26 Feb 2018 18:03:27 -0300 Message-Id: <1519679016-12241-13-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 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. [BZ #12683] * sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h (ucontext_get_pc): New function. --- ChangeLog | 4 ++++ sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h b/sysdeps/unix/sysv/linux/alpha/sigcontextinfo.h index 23f66d0..f762fff 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 */