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: 34972 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 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)