Message ID | 1513019223-7603-10-git-send-email-adhemerval.zanella@linaro.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3168570qgn; Mon, 11 Dec 2017 11:09:14 -0800 (PST) X-Google-Smtp-Source: ACJfBosar5rpMS2XFrfyf0MYtB8i1wMc4GFAUj8b5yxWXLSTJFuqW4P2RKp3HRKmHYwT0t0zh0Qw X-Received: by 10.84.137.129 with SMTP id 1mr1308240pln.169.1513019354551; Mon, 11 Dec 2017 11:09:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513019354; cv=none; d=google.com; s=arc-20160816; b=EYgTUbuKCFsUrYwWvfRTljBweZpDqghSiXE48RtA3Wj0FLiGVbesG/91EOBw2WiSes OYGwRniaKYRak78qOy2A+/FXYLxVW9TH8TIHcCFjUhsjLBAEarXlWoJby1VGmw+Bgaql LBDOLF4R4ZHpBFb8JPH3qIWrUInTz795oSrPlW331hP2Wn0ZHazwtcEpsQlvCjsKwaiB M1fSaQ9O2HfTfp+GVkFmNOyviqSydTy3CTtWh2JOQBp41PF4UUbbHfYW882ckh8349kJ 7fvfhVT13JmTLFz4DwhCcS/eiDCmqZE4TkQSJ+Zl72vRUnvM+1y2CBf5a74n3Pw+/gI/ kp8A== 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:cc: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=Rqh/D9W65fMFC1DYB2ohJ5K3qjrQCvLICpkdWuaqyOo=; b=joetY18LVNchA14Q9Lj/Nl8KPt6FOCv+HZ79nM5/NhCAHVRTQyfunhTCtbJ5sfPl8L r2nAxIJ0fTZVnPeAVnly5WX4PhUF/i5vPBLB25fiyRLrEy8skWbt9oYxr8CLqCeMkldl roqPnYwsW3AkzhfzhVcMLJzfhN4M9ctVIV+x+tQx0nanrzWnec+kFXzu7cccEQR5osGZ hFpWkiq24eLYdyt7t6Ar7oPZMSQsYXAimmOxH3Q72Mnkp6HvkMs9VONxcEFn3d+1T6YE /RnEcek1KAPHG5RwtUjB3F3mLC8D9szTiC56kjHCzZK2ByYmGaJN/5Jo6r0RUKsDirGm d21Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=IRbLqEx7; spf=pass (google.com: domain of libc-alpha-return-88022-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-88022-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <libc-alpha-return-88022-patch=linaro.org@sourceware.org> Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id l18si11370895pfk.170.2017.12.11.11.09.14 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2017 11:09:14 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-88022-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=IRbLqEx7; spf=pass (google.com: domain of libc-alpha-return-88022-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-88022-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:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=qqsoqUPwcw9a9CnBdpoy6LLQggY6Mjd zyLNakdzZmBl2Pg7/0mz70HlFYygMI+mwVKuKvCHgOO4djljUrxSdroM9Ntd8+b/ Vmr+CGJByOQUh8ENJatIASMcXm+6qR+bJfb4sdtLeywfemM/yhEssA0ow4pDlCSs F9VVzArjHHqs= 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:cc:subject:date:message-id:in-reply-to :references; s=default; bh=AO+Jo7/V8y6uB55rB1+c2NH5pCg=; b=IRbLq Ex7Qgz/eDNyEnpv9mK1sYpbrearJDIrVRMcupX3nZ9r0s45bVmH7tqirh49qI4HV YFsk32NnErxpVL9x9yJyLO6x21j5+emAgKzc3UWgzjR+PrCpUzYjIG2wDSUtJTM8 YHWPFGQWbi6u813LTTgnnpUjEGKmFTqsrDBZd8= Received: (qmail 41774 invoked by alias); 11 Dec 2017 19:07:28 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <libc-alpha.sourceware.org> List-Unsubscribe: <mailto:libc-alpha-unsubscribe-patch=linaro.org@sourceware.org> List-Subscribe: <mailto:libc-alpha-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 41730 invoked by uid 89); 11 Dec 2017 19:07:27 -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=s390xlinuxgnu, s390x-linux-gnu, ahi X-HELO: mail-qt0-f173.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:cc:subject:date:message-id:in-reply-to :references; bh=Rqh/D9W65fMFC1DYB2ohJ5K3qjrQCvLICpkdWuaqyOo=; b=ocyaFE3bTVmR52qFW/VOJokwSaxpG4dSW88rsVvB7uTiXhMfI8+mRUeJIz/FnUw7Ie GM0JUNvzk19k29CKSIaK+mBGBVT88FrSUD9ygGNmnyfdgUpPHYh01RSoTM+eSzi/9ng2 9G69jg3oUJqI8q8VCP1lFUKEGkQinWBELcB6RzFqIAvZAoymWAgzPF/jvn8aUbau5CJm ckF/dWn7mybh6cIKdNE94ru+OM4dOS2978V8b7VDC0b3MutBQp0fNEtySeHj5/t7IHJq G/+HDOeTV3w4GRW60sVjOeF+0eL8BTHM+b+Sd6xfqr7Isr1eklHYFwmS5UxWF+Ko7CiH WjgA== X-Gm-Message-State: AKGB3mI1M4nxINtNYVR+7hM1RJYVeplcFs25eKF4JAUrLraij/m4LUt8 Dr5besYya6ftufTAWGKrKDW+EpMfx8U= X-Received: by 10.55.25.22 with SMTP id k22mr1883148qkh.120.1513019244012; Mon, 11 Dec 2017 11:07:24 -0800 (PST) From: Adhemerval Zanella <adhemerval.zanella@linaro.org> To: libc-alpha@sourceware.org Cc: Adhemerval Zanella <adhemerval.zanella@linaro.com> Subject: [PATCH 09/19] nptl: s390: Fix Race conditions in pthread cancellation (BZ#12683) Date: Mon, 11 Dec 2017 17:06:53 -0200 Message-Id: <1513019223-7603-10-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> |
Series |
nptl: Fix Race conditions in pthread cancellation (BZ#12683)
|
expand
|
diff --git a/sysdeps/unix/sysv/linux/s390/sigcontextinfo.h b/sysdeps/unix/sysv/linux/s390/sigcontextinfo.h index 90ead3f..676a8bd 100644 --- a/sysdeps/unix/sysv/linux/s390/sigcontextinfo.h +++ b/sysdeps/unix/sysv/linux/s390/sigcontextinfo.h @@ -16,7 +16,11 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ +#ifndef _SIGCONTEXTINFO_H +#define _SIGCONTEXTINFO_H + #include <signal.h> +#include <stdint.h> #define SIGCONTEXT struct sigcontext * #define SIGCONTEXT_EXTRA_ARGS @@ -25,3 +29,16 @@ #define GET_STACK(ctx) ((void *)((ctx)->sregs->regs.gprs[15])) #define CALL_SIGHANDLER(handler, signo, ctx) \ (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx)) + +static inline uintptr_t +ucontext_get_pc (const ucontext_t *uc) +{ +#ifdef __s390x__ + return uc->uc_mcontext.psw.addr; +#else + /* We have 31bit addresses, remove bit 0. */ + return uc->uc_mcontext.psw.addr & 0x7FFFFFFF; +#endif +} + +#endif
From: Adhemerval Zanella <adhemerval.zanella@linaro.com> This patch adds the s390 modifications required for the BZ#12683 fix. It basically adds the required ucontext_get_pc function. The built cancelable syscall wrapper for s390 using GCC 7.2.1 and default configuration flags shows the wrappers on expected corrected places: --- __GI___syscall_cancel_arch: .LFB39: .cfi_startproc stm %r6,%r15,24(%r15) .cfi_offset 6, -72 .cfi_offset 7, -68 .cfi_offset 8, -64 .cfi_offset 9, -60 .cfi_offset 10, -56 .cfi_offset 11, -52 .cfi_offset 12, -48 .cfi_offset 13, -44 .cfi_offset 14, -40 .cfi_offset 15, -36 ahi %r15,-96 .cfi_def_cfa_offset 192 .global __syscall_cancel_arch_start .type __syscall_cancel_arch_start,@function __syscall_cancel_arch_start: l %r0,0(%r2) tml %r0,4 jne .L5 lr %r1,%r3 lr %r2,%r4 lr %r3,%r5 lr %r4,%r6 l %r5,192(%r15) l %r6,196(%r15) l %r7,200(%r15) svc 0 .global __syscall_cancel_arch_end .type __syscall_cancel_arch_end,@function __syscall_cancel_arch_end: l %r4,152(%r15) lm %r6,%r15,120(%r15) .cfi_remember_state .cfi_restore 15 .cfi_restore 14 .cfi_restore 13 .cfi_restore 12 .cfi_restore 11 .cfi_restore 10 .cfi_restore 9 .cfi_restore 8 .cfi_restore 7 .cfi_restore 6 .cfi_def_cfa_offset 96 br %r4 .L5: .cfi_restore_state brasl %r14,__syscall_do_cancel .cfi_endproc --- The s390x version also shows similar placement: --- __GI___syscall_cancel_arch: .cfi_startproc stmg %r6,%r15,48(%r15) .cfi_offset 6, -112 .cfi_offset 7, -104 .cfi_offset 8, -96 .cfi_offset 9, -88 .cfi_offset 10, -80 .cfi_offset 11, -72 .cfi_offset 12, -64 .cfi_offset 13, -56 .cfi_offset 14, -48 .cfi_offset 15, -40 aghi %r15,-160 .cfi_def_cfa_offset 320 .global __syscall_cancel_arch_start .type __syscall_cancel_arch_start,@function __syscall_cancel_arch_start: l %r0,0(%r2) tmll %r0,4 jne .L5 lgr %r1,%r3 lgr %r2,%r4 lgr %r3,%r5 lgr %r4,%r6 lg %r5,320(%r15) lg %r6,328(%r15) lg %r7,336(%r15) svc 0 .global __syscall_cancel_arch_end .type __syscall_cancel_arch_end,@function __syscall_cancel_arch_end: lg %r4,272(%r15) lmg %r6,%r15,208(%r15) .cfi_remember_state .cfi_restore 15 .cfi_restore 14 .cfi_restore 13 .cfi_restore 12 .cfi_restore 11 .cfi_restore 10 .cfi_restore 9 .cfi_restore 8 .cfi_restore 7 .cfi_restore 6 .cfi_def_cfa_offset 160 br %r4 .L5: .cfi_restore_state brasl %r14,__syscall_do_cancel .cfi_endproc --- Checked with a s390-linux-gnu and s390x-linux-gnu build with run-tests-built=no. * sysdeps/unix/sysv/linux/s390/sigcontextinfo.h (ucontext_get_pc): New function. --- ChangeLog | 3 +++ sysdeps/unix/sysv/linux/s390/sigcontextinfo.h | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) -- 2.7.4