From patchwork Mon Apr 10 20:46:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 67593 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 147003855590 for ; Mon, 10 Apr 2023 20:49:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 147003855590 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681159780; bh=ZBOTIHpi8964eClgb9gmLoPglCk2l+9EdjCO+WdN6FU=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=o43cMdbLS54wTyBX5h2FZ15duIRz/85LOGZyBXJuKMjWfk+xK+LOiJPkmvuThVVzV cEt6K4Ain10jmDSdtloB+WGJnMEZzQqCJ0EEQ2pUD/WXl8vn+XO3Z26FrVKu8FOcQ5 icrz8zUJ9TmdJ78s1YvD9ogu1juIUT1UxN+vSV6Q= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) by sourceware.org (Postfix) with ESMTPS id 744693857733 for ; Mon, 10 Apr 2023 20:46:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 744693857733 Received: by mail-oi1-x234.google.com with SMTP id w19so4030281oiv.13 for ; Mon, 10 Apr 2023 13:46:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681159592; x=1683751592; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZBOTIHpi8964eClgb9gmLoPglCk2l+9EdjCO+WdN6FU=; b=ImdN7+kBVC5IfdhZO8H9Fn9zNJ3+xFUCVUV/2D6CnAQ3Qy6sCNkr1EkRP4rqOVZfy5 0ePJdF6rmOTEdshrvo4p1QvmR0vrQjC8hvnEe2U7hjDJal6b9N3oosKab/Xn65i8dZVE nkPVVpdcYSc0US0m4mKkDH+zSdCKXoWbLLKeispDqYj8Fus1amW3KGYF40oIVOI1qU1u WFmIZB5FRllhMSksb4Te5SAXbCx+tgxWVrL8JkxBXJHzP2yu3Bi8Cd8fiMEZn21DngSq B3UycyPbctx9vakl5IQt3PTAMIsjLT1DeCH5sOw7FL65vCGN0YF3gHpOjXnmmQEFdh6p KWYg== X-Gm-Message-State: AAQBX9cqW1LIHvNxVqEuZqY9m4UImXlNccM8nuJZR1jcohvIjX08swqA 4q46y1D0gwnK8XiOkGukF6c4OkbKg7hgzeYD/M6m1A== X-Google-Smtp-Source: AKy350aYrikO0WGBUjY965206+xqeDdIzKbA3RaJaLBfJx/FzleOikjmF/jFyssrePeBTeKmJq2BIw== X-Received: by 2002:a05:6808:20d:b0:38b:7122:9e78 with SMTP id l13-20020a056808020d00b0038b71229e78mr3393075oie.41.1681159592282; Mon, 10 Apr 2023 13:46:32 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c2:55a1:d59a:609a:284:6ed]) by smtp.gmail.com with ESMTPSA id p5-20020acabf05000000b003896f132821sm4865732oif.41.2023.04.10.13.46.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 13:46:31 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v5 16/22] hppa: Fix Race conditions in pthread cancellation [BZ#12683] Date: Mon, 10 Apr 2023 17:46:08 -0300 Message-Id: <20230410204614.4129551-8-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230410204614.4129551-1-adhemerval.zanella@linaro.org> References: <20230410195907.4123869-1-adhemerval.zanella@linaro.org> <20230410204614.4129551-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SCC_5_SHORT_WORD_LINES, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" By adding the required syscall_cancel.S. Checked on hppa-linux-gnu. --- sysdeps/unix/sysv/linux/hppa/syscall_cancel.S | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/hppa/syscall_cancel.S diff --git a/sysdeps/unix/sysv/linux/hppa/syscall_cancel.S b/sysdeps/unix/sysv/linux/hppa/syscall_cancel.S new file mode 100644 index 0000000000..b9c19747ea --- /dev/null +++ b/sysdeps/unix/sysv/linux/hppa/syscall_cancel.S @@ -0,0 +1,81 @@ +/* Cancellable syscall wrapper. Linux/hppa version. + Copyright (C) 2023 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 +#include + +/* long int __syscall_cancel_arch (int *cancelhandling, + long int nr, + long int arg1, + long int arg2, + long int arg3, + long int arg4, + long int arg5, + long int arg6) */ + + .text +ENTRY(__syscall_cancel_arch) + stw %r2,-20(%r30) + ldo 128(%r30),%r30 + cfi_def_cfa_offset (-128) + cfi_offset (2, -20) + ldw -180(%r30),%r28 + copy %r26,%r20 + stw %r28,-108(%r30) + ldw -184(%r30),%r28 + copy %r24,%r26 + stw %r28,-112(%r30) + ldw -188(%r30),%r28 + stw %r28,-116(%r30) + ldw -192(%r30),%r28 + stw %r4,-104(%r30) + stw %r28,-120(%r30) + copy %r25,%r28 + copy %r23,%r25 +#ifdef __PIC__ + stw %r19,-32(%r30) +#endif + cfi_offset (4, 24) + + .global __syscall_cancel_arch_start +__syscall_cancel_arch_start: + ldw 0(%r20),%r20 + bb,< %r20,31-TCB_CANCELED_BIT,1f + ldw -120(%r30),%r21 + ldw -116(%r30),%r22 + ldw -112(%r30),%r23 + ldw -108(%r30),%r24 + copy %r19, %r4 + ble 0x100(%sr2, %r0) + + .global __syscall_cancel_arch_end +__syscall_cancel_arch_end: + + copy %r28,%r20 + copy %r4,%r19 + + ldw -148(%r30),%r2 + ldw -104(%r30),%r4 + bv %r0(%r2) + ldo -128(%r30),%r30 +1: + bl __syscall_do_cancel,%r2 + nop + nop + +END(__syscall_cancel_arch)