From patchwork Mon Apr 10 19:58:50 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: 67576 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 4C34E3853564 for ; Mon, 10 Apr 2023 20:00:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4C34E3853564 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681156825; bh=K8OFJakccglc5ylB7sxR7mrnDfCUY/95k9NJwF3I62w=; 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=tmfDajhZweoh0XDYrZ9+HuKfhzJ7rbr5rdbKX5TQQLzy253cjx8sBnczXUtimx7SE 0+PLGdjNV4zCb0vj7HjjpUIrhRGfy04s75RnYBTdcByf6BbukoZGPx8wDBMgB39Cav Jl7ZMvYD4KzFUS+dQELJahDQGbx6OV3Ay6xj4IP8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) by sourceware.org (Postfix) with ESMTPS id 013E63858428 for ; Mon, 10 Apr 2023 19:59:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 013E63858428 Received: by mail-ot1-x32d.google.com with SMTP id 6-20020a9d0106000000b006a177038dfeso16295606otu.7 for ; Mon, 10 Apr 2023 12:59:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681156760; x=1683748760; 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=K8OFJakccglc5ylB7sxR7mrnDfCUY/95k9NJwF3I62w=; b=tGwzN2kzXdyb1rE3kZfDHgL4wKV5pfRvoTl9LEyyQHMViEZmL67u4+NHKWmd9PSmF5 n9oHgOaj59VqgP7/IueKE7jKquij/dCjhw9zliSh5N6OAyrTO0n2PiKxbIxiXzktgjVO jj+FFzNfZpULZoMSLdEOzEB1gJTdcqKuoUDJJJiIc5ARf3u2D84QFwQsgdH76Tuhz/m9 dBI6hBuiqSqXrKxpTXsxqrZOmH75PKdGoTyPwU6oUz+3LhIHEJa8UrtxH/+t6izsfYnJ NoQ5cEcfp423eh9fj3TZs8iiZhni4KuOcn88N3FShUzmnOSXKttIjqouIb3vn/W/X67s FZmg== X-Gm-Message-State: AAQBX9eJltyzevs697KZowZvkBO3g+T2AIVqKLuQhBrU2DJQR8sv5AHq uGFr7u6IPb4SiOHjgYl5tUn8w/3ZV27XPy0/zv9pWg== X-Google-Smtp-Source: AKy350ZJ9uNH2oTRXjSQSvJrghqVd2Mc4NZ0+swoqT3xfBqVHgB9fwXeJIBOyV6Y+s9/N0qNISYI6g== X-Received: by 2002:a9d:5c06:0:b0:6a1:7f69:ffbf with SMTP id o6-20020a9d5c06000000b006a17f69ffbfmr224822otk.36.1681156760464; Mon, 10 Apr 2023 12:59:20 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c2:55a1:d59a:609a:284:6ed]) by smtp.gmail.com with ESMTPSA id r7-20020a9d7507000000b006a30260ccfdsm4673293otk.11.2023.04.10.12.59.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Apr 2023 12:59:19 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v5 05/22] aarch64: Fix Race conditions in pthread cancellation [BZ#12683] Date: Mon, 10 Apr 2023 16:58:50 -0300 Message-Id: <20230410195907.4123869-6-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230410195907.4123869-1-adhemerval.zanella@linaro.org> References: <20230410195907.4123869-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 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, 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 aarch64-linux-gnu. --- .../unix/sysv/linux/aarch64/syscall_cancel.S | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/aarch64/syscall_cancel.S diff --git a/sysdeps/unix/sysv/linux/aarch64/syscall_cancel.S b/sysdeps/unix/sysv/linux/aarch64/syscall_cancel.S new file mode 100644 index 0000000000..e91a431b36 --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/syscall_cancel.S @@ -0,0 +1,59 @@ +/* Cancellable syscall wrapper. Linux/AArch64 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 [x0] __syscall_cancel_arch (int *cancelhandling [x0], + long int nr [x1], + long int arg1 [x2], + long int arg2 [x3], + long int arg3 [x4], + long int arg4 [x5], + long int arg5 [x6], + long int arg6 [x7]) */ + +ENTRY (__syscall_cancel_arch) + + .globl __syscall_cancel_arch_start +__syscall_cancel_arch_start: + + /* if (*cancelhandling & CANCELED_BITMASK) + __syscall_do_cancel() */ + ldr w0, [x0] + tbnz w0, TCB_CANCELED_BIT, 1f + + /* Issue a 6 argument syscall, the nr [x1] being the syscall + number. */ + mov x8, x1 + mov x0, x2 + mov x1, x3 + mov x2, x4 + mov x3, x5 + mov x4, x6 + mov x5, x7 + svc 0x0 + + .globl __syscall_cancel_arch_end +__syscall_cancel_arch_end: + ret + +1: + b __syscall_do_cancel + +END (__syscall_cancel_arch)