From patchwork Mon Oct 14 20:56:44 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: 176344 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp5012408ill; Mon, 14 Oct 2019 13:58:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqzuS7KoeMcN6O/Kls5iVBX13Dpp3ApE+Wd9fgTsYh4pS6ue50XBKrqiZ5b/deW03a56FnTW X-Received: by 2002:a17:907:365:: with SMTP id rs5mr31241075ejb.121.1571086725207; Mon, 14 Oct 2019 13:58:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571086725; cv=none; d=google.com; s=arc-20160816; b=j8asF1AYe8uEIap/eFF8mKwwQRuR+tagY81tmPxNec49sKoijO/d754+tHnzs+s5ya rIjBLs1JHY1PzUymYRAIxCB5CML9qEnXUSL7HP6nWAH+MEV8zGupPaO9Zh6ztAbS737S ef306JBSH8DGToHqaBXiLeDfaIL9VEULP18Z+QG5/C4KNN/UCh7N0HQu2S3e6t3RTq1+ H9JMSCSR6ALhCbTAZ+ujORdvgJQnrO7TyyzIP68CSVFXNM6jAY6/eeg9GDGZnG72aMzj AFsij93CRDBh13FfaG4qff25OzSSSLlMRLG4aT4P+PFPflR/n8wWQHySm5KTdUBIpeHO uPLA== 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=/Tn3fTfJlame1huFejUiVJMQG25cQhfChU4g4LwAzlU=; b=1AZlaztZHiW3c9/SHhpVkiOkcMeGswnIl4jQrWftWOyDL1m/XmAUDCq2izNF3RZRdC jbSqa0YNF1+tZOyvgqM26bVOmcpIRmUvpn9EAr81e9Dfr7LY9vDVgI9FIhhd3WZ/xxBD diOFk114wFiwvL9TVXDFAImrOLZrGYBurg8GVD5CV+Zdi9A8RyxoXa23+TjNaV1IQ24y nuchD44BWJU/DL1/TzFp5eheZey5WNgZPdrlR24KblxIpcPq4fVsNKlNNlpKKY82/Wq1 7+bFMmXX/iN/RtBF/oEUmOfDSOs31nZLgdaxNlC/eqpHQyCdg2xVMzgL7TwjjbFv3Dym 2Cug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=HmqbItlQ; dkim=pass header.i=@linaro.org header.s=google header.b=SrMBv3gV; spf=pass (google.com: domain of libc-alpha-return-105935-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-105935-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 r8si11035489ejr.33.2019.10.14.13.58.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Oct 2019 13:58:45 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-105935-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=HmqbItlQ; dkim=pass header.i=@linaro.org header.s=google header.b=SrMBv3gV; spf=pass (google.com: domain of libc-alpha-return-105935-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-105935-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=yAGcMCouwz7iNLaMhyek3epmjrO1WLd 3hIs07Jp9D9H1/XugMw5juMu5cXEbhPM1Puve2En4TBijSLws3lRBgNMdN5pSTzb O9M68E51nS0CsCbVNfJtpMfmZnwoKoz4tcqNPFltcVv3MN+NjqfrTaR0t598SK3H etdJ1IqbG4kE= 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=ujGsBnaEdryzxA63eX/GihdzNIs=; b=HmqbI tlQZzEQU+7Smp3zM+tZY/zxlHcpJ/FD/8mkhiO7rtK7A476AUjb7E7bHsct+r6kg zwzFAIeoWvWgTIlDJFz41FEs0ImbSfXYd+GRtskJkzRKBo6+j0C8QMSX4lK63O8D RV2nYgpQTx6GF6ExXRsDlpqSdzoRXepSNYWtsY= Received: (qmail 115109 invoked by alias); 14 Oct 2019 20:57:25 -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 114726 invoked by uid 89); 14 Oct 2019 20:57:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.3 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=HX-Languages-Length:2845 X-HELO: mail-qt1-f196.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=/Tn3fTfJlame1huFejUiVJMQG25cQhfChU4g4LwAzlU=; b=SrMBv3gVgZXP4DMaqOGshnjfQXx78nPkvnPq3tLvmAVy3umcIPsJmgnNVoeX08WKfw J08rTITR+RZIc0of90SGPN9Qe3npylkz+p38hFdGDmpREZLbl05VenQHzWGveUJxaIW4 M+I8h518OllwL9bJ8VHwU0T7MA2E5fu2ikEHjsTVigqumKYalvzpJdjOThBbNAPfXUHP T+EaOnmHVWzlP0fVFKnZFcCfsNLAYaw7LGgO+1bfOxVZPzoo+VxKALXXQM+T6nII7Zd/ WYSgMMI1URUmLzZ7PKNAAmvofVCP90jeEkNSancaIrYognnS7TUvfc/AIIh1yCK5xyIl 7l4Q== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v3 09/21] nptl: arm: Fix Race conditions in pthread cancellation (BZ#12683) Date: Mon, 14 Oct 2019 17:56:44 -0300 Message-Id: <20191014205656.29834-10-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 arm modifications required for the BZ#12683 fix by adding the arch-specific cancellation syscall bridge. Checked on arm-linux-gnueabihf. --- sysdeps/unix/sysv/linux/arm/syscall_cancel.S | 80 ++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/arm/syscall_cancel.S -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/arm/syscall_cancel.S b/sysdeps/unix/sysv/linux/arm/syscall_cancel.S new file mode 100644 index 0000000000..996334a4bb --- /dev/null +++ b/sysdeps/unix/sysv/linux/arm/syscall_cancel.S @@ -0,0 +1,80 @@ +/* Cancellable syscall wrapper. Linux/arm 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 [r0] __syscall_cancel_arch (int *cancelhandling [r0], + long int nr [r1], + long int arg1 [r2], + long int arg2 [r3], + long int arg3 [SP], + long int arg4 [SP+4], + long int arg5 [SP+8], + long int arg6 [SP+12]) */ + + .syntax unified + +ENTRY (__syscall_cancel_arch) + .fnstart + mov ip, sp + stmfd sp!, {r4, r5, r6, r7, lr} + .save {r4, r5, r6, r7, lr} + + cfi_adjust_cfa_offset (20) + cfi_rel_offset (r4, 0) + cfi_rel_offset (r5, 4) + cfi_rel_offset (r6, 8) + cfi_rel_offset (r7, 12) + cfi_rel_offset (lr, 16) + + .globl __syscall_cancel_arch_start + .type __syscall_cancel_arch_start,%function +__syscall_cancel_arch_start: + + /* if (*cancelhandling & CANCELED_BITMASK) + __syscall_do_cancel() */ + ldr r0, [r0] + tst r0, #4 + bne 1f + + /* Issue a 6 argument syscall, the nr [r1] being the syscall + number. */ + mov r7, r1 + mov r0, r2 + mov r1, r3 + ldmfd ip, {r2, r3, r4, r5, r6} + svc 0x0 + + .globl __syscall_cancel_arch_end + .type __syscall_cancel_arch_end,%function +__syscall_cancel_arch_end: + ldmfd sp!, {r4, r5, r6, r7, lr} + cfi_adjust_cfa_offset (-20) + cfi_restore (r4) + cfi_restore (r5) + cfi_restore (r6) + cfi_restore (r7) + cfi_restore (lr) + BX (lr) + +1: + ldmfd sp!, {r4, r5, r6, r7, lr} + b __syscall_do_cancel + .fnend +END (__syscall_cancel_arch) +libc_hidden_def (__syscall_cancel_arch)