From patchwork Mon Oct 14 20:56:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 176355 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp5014356ill; Mon, 14 Oct 2019 14:00:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqyyCt3goFXi8w1aj8jMHi3++7CPjq4+CvzABi0ZA9RLfUjHQkvCA03CyLY+KIsrv6+NgSbD X-Received: by 2002:a17:906:2cd2:: with SMTP id r18mr30685469ejr.282.1571086845281; Mon, 14 Oct 2019 14:00:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571086845; cv=none; d=google.com; s=arc-20160816; b=vF8Nv9RMoC31HhlOuO8byfMgKRqInCqS29WW15tGYORGIhDtsRYpwjNiFputMDtMqo 8BeXKiE/FPQ//S3W20ewkQ20SonwhbgU+n18TjDFGiQNISPzcmNupIDRBARE5exUR3N/ mhWuIDjI+2sRkK4jq6QUxuaIDnRHkDDgo9B2IyAQXkhE2VX00R4/5c4VFLqzmAQvhK15 ozYDjKCSXvhAIY/AssYl3NYEm7sNpZxfQdYnJr7twGVanjyYTEVzGwAIJei6SIh+tTGW tGcamSZQo/9SEnKLG1vcdD3L724dBf/GYTjIpD+kObEUtdxpqNe8qwnKPH4G7AyyayrH IiVw== 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 :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=TNBrHVKeYr+VRM8bQm1LuG5EotRzgiUu1U5GCEg7VCY=; b=xS9y/Q8Zqu1sKpvnRIpf2gdy90yHDLPr4yjeOzMkAf9SSamEXTazgcDhl/vkYc1FEf UOSwd7qH733qVcRCn2jRzaCPjZoZrVa6HvrIlV3z/WDgIaxV7ha4IZMeps82qJDsW1yQ tZQYqPgXHEv23G7EecArovCmEMOtjTwC8od1X5IkOJWPHDgWLD/tmBeRJviyIOgn0pPT HhnK8oOIcfNhTshKxoyJ8tPyDli2D/fjeI6WsMwy5HZhVeZnR322iQgxVPj34mRwCscm 46a64N15I2xqR/GNrc4JKY8qMng/zRRkklqbL/dEo+nauui/7wVnv6uBhs5uGavjLWVl dmxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=n9Ds9RCX; dkim=pass header.i=@linaro.org header.s=google header.b=iXdVaDgz; spf=pass (google.com: domain of libc-alpha-return-105946-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-105946-patch=linaro.org@sourceware.org"; dmarc=pass (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 w20si12850587edc.202.2019.10.14.14.00.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Oct 2019 14:00:45 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-105946-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=n9Ds9RCX; dkim=pass header.i=@linaro.org header.s=google header.b=iXdVaDgz; spf=pass (google.com: domain of libc-alpha-return-105946-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-105946-patch=linaro.org@sourceware.org"; dmarc=pass (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=jQVDr/5SRy1jgXA77IGEqGKCBcrBwEC 6C5kIrD9B6I+Yk39RYkMepwV6Ae1rldQeFE0PzHjwJJbcjx2zzvXEnTgle9g4ehR hWrZbeCWvirFpw1xAFqCNbT67OmFmDg5vEwbGyTAheQov8PE56y5lTB+USGiUvfi qGZXyj6Jnc7M= 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=sEMBRgCcPdVPsZGuby+gnxKEyXo=; b=n9Ds9 RCX5ZuNzJTjLj+AwxuVZjlFzpAMv2c1ePrTcSC7RxT4g+E3FN6Ohj6SWYZgO/KtM fH/ap3qh+LUD+eURRiDl3oKDbfy8+FBD0Ip5BXFGRH5bbWSwv1Ppcu0o2TxYlc2T nnwDMScj0x56H/U9pIkAdEK0KHyo3qdZcJXMb0= Received: (qmail 117901 invoked by alias); 14 Oct 2019 20:57:45 -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 116436 invoked by uid 89); 14 Oct 2019 20:57:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.4 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.1 spammy= X-HELO: mail-qt1-f194.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=TNBrHVKeYr+VRM8bQm1LuG5EotRzgiUu1U5GCEg7VCY=; b=iXdVaDgzz4mRhaBhRc1fxWYhGsaALmgzl20rVYBqqwg1NkKb89biBSrqEvaPL+Td1q q1yfRCvDBV2S+a/evNsDUPdGoo6xcXsfdlxnnJHasMrTdl7qWJZ0RcKxrkhnEqzrO731 7D2aRH6rG7e/gw2KUf3J2zO14y95VI9RtKpj56IwA68tGs1uboVwpeZ1tqrLNI/LwVwF 336wfCK15FhCbOvjdxkkGYgYF5/kCmnKXfjj8U9h7SD4Wi7z3nhJxlCT5YwXcpRp/2fn 6jzmZxbIV1G/uCqChGAFiXR5Eu35IbuXTitf7/S66JticD1G4GSP1ZDkebDiAFI74FJR 4gEg== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v3 18/21] nptl: s390: Fix Race conditions in pthread cancellation (BZ#12683) Date: Mon, 14 Oct 2019 17:56:53 -0300 Message-Id: <20191014205656.29834-19-adhemerval.zanella@linaro.org> In-Reply-To: <20191014205656.29834-1-adhemerval.zanella@linaro.org> References: <20191014205656.29834-1-adhemerval.zanella@linaro.org> This patch adds the s390 modifications required for the BZ#12683 fix by adding the arch-specific cancellation syscall bridge. Checked on s390-linux-gnu and s390x-linux-gnu. --- .../sysv/linux/s390/s390-32/syscall_cancel.S | 83 +++++++++++++++++++ .../sysv/linux/s390/s390-64/syscall_cancel.S | 83 +++++++++++++++++++ 2 files changed, 166 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/syscall_cancel.S create mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/syscall_cancel.S -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/syscall_cancel.S b/sysdeps/unix/sysv/linux/s390/s390-32/syscall_cancel.S new file mode 100644 index 0000000000..3c934addbd --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/syscall_cancel.S @@ -0,0 +1,83 @@ +/* Cancellable syscall wrapper. Linux/s390 version. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +/* long int __syscall_cancel_arch (int *cancelhandling, + __syscall_arg_t nr, + __syscall_arg_t arg1, + __syscall_arg_t arg2, + __syscall_arg_t arg3, + __syscall_arg_t arg4, + __syscall_arg_t arg5, + __syscall_arg_t arg6) */ + +ENTRY (__syscall_cancel_arch) + 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) + + .globl __syscall_cancel_arch_start + .type __syscall_cancel_arch_start,@function +__syscall_cancel_arch_start: + l %r0, 0(%r2) + tml %r0, 4 + jne 1f + 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 + + .globl __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 + +1: + cfi_restore_state + brasl %r14, __syscall_do_cancel +END (__syscall_cancel_arch) +libc_hidden_def (__syscall_cancel_arch) diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscall_cancel.S b/sysdeps/unix/sysv/linux/s390/s390-64/syscall_cancel.S new file mode 100644 index 0000000000..3480020fbb --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscall_cancel.S @@ -0,0 +1,83 @@ +/* Cancellable syscall wrapper. Linux/s390x version. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +/* long int __syscall_cancel_arch (int *cancelhandling, + __syscall_arg_t nr, + __syscall_arg_t arg1, + __syscall_arg_t arg2, + __syscall_arg_t arg3, + __syscall_arg_t arg4, + __syscall_arg_t arg5, + __syscall_arg_t arg6) */ + +ENTRY (__syscall_cancel_arch) + 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) + + .globl __syscall_cancel_arch_start + .type __syscall_cancel_arch_start,@function +__syscall_cancel_arch_start: + l %r0,0(%r2) + tmll %r0,4 + jne 1f + 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 + + .globl __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 + +1: + cfi_restore_state + brasl %r14, __syscall_do_cancel +END (__syscall_cancel_arch) +libc_hidden_def (__syscall_cancel_arch)