From patchwork Mon Aug 7 22:00:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 132442 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1757850vqr; Mon, 7 Aug 2023 16:00:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFRlvyc4PUrGSfro7UcSyHAMBdkKgbbHKHCVyU6JeL341gkOfsNwsvrWplvz+53GaX8fODj X-Received: by 2002:a05:6808:1283:b0:3a4:225d:8135 with SMTP id a3-20020a056808128300b003a4225d8135mr13462365oiw.31.1691449231688; Mon, 07 Aug 2023 16:00:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691449231; cv=none; d=google.com; s=arc-20160816; b=LuqxZVliWsir+fDbvxBsBPcYlI6KppAEils/sF7r/n6wh00NjaaWR7ol8wPNd3hphk AxdlZDMAVO/HOXcv1nea63/TlmLQ9kt9W1JXd83RIJjhe8ScYg+1CZY/Erqh/dVEVXBz w1zhDT3vsRzVUzZ9wkYV9DiqoPNmYmxj2Ys4s4Ced/JBy1RaBw+kb/Y7yG8M4ABCcw+o n5/zz7aHAqGeZl/BjycsUnrW9e2rNuNcwZZTuq/3iRpAZuH2qTgJ8oTOwCTTfO5bKzR8 e2q9RSIl11k/OlvFw/UYhBbu8CF80au73PNqYVr9TrJfPzss+1+IgelGgjoUeKiQt2LL Sb4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=c422h9hePWFZGXVEyc1SJULBUM8N+meybf6z8umXg3Q=; fh=EdAFSmIgUzZTC6WCy4Jg1wBZ0/m6m2d/OjiRUJ3BsTI=; b=ZxlOzS32BEVzzYmMnX0VfFMBjL5w5PZNoadGfloXVxeQGc3uz42g87Eu8u7DnIPhxG cwE4t+xjRCgYpohQu5+yeEE6Ry3zBn+h03XF6zA74iZvCrHYph2gP2VZEAqVWWwwZWSi 4t/Q0qHur18Rs8ElSLErW+/d6O3HtGDJ2TqRUKRXrffNZXQUa1s7NMJrtnSHnglKClqv kUuPs5YuqMIkPmubW730DuKnxNTw0dBY5s2y4C4XnGRML60cLdnlHDpMZWNFsgd16rkh BRGV6cGzc7MxcprB36JyhV9+VlS3g+XqR4wFaPGDCJE+DMuSwIZ/lfeA5QUTqT55rAHs kgEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=raqffCvM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p10-20020a63950a000000b005578023de91si6110647pgd.170.2023.08.07.16.00.17; Mon, 07 Aug 2023 16:00:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=raqffCvM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231548AbjHGWI1 (ORCPT + 99 others); Mon, 7 Aug 2023 18:08:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231610AbjHGWH7 (ORCPT ); Mon, 7 Aug 2023 18:07:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 561DD103; Mon, 7 Aug 2023 15:05:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 36103616B7; Mon, 7 Aug 2023 22:05:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D52DBC433D9; Mon, 7 Aug 2023 22:05:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691445916; bh=o3F0gqwirOzTh8gwGkZMmsXM7Yu/yi+gPnGo/AGnFQM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=raqffCvMWTfO1Rng4omxJsfaaPe/U3CqnaAlwHzSNkUoRIAoq08QfbIyecwv217iE KMqD6uLpuE3W340GgPyHszlI/P8+n8u7KI2TwGB+m6w/Wtxxzf38mpvtDNOz+Vo6La L5ixEyzPsS7uxnM7jE0qZdJI4NpY89YsIzri6JJuC8iK7f+q7Qg806qeR4SNqTSYxB WHYb8J68r7ciowGSwBwjRoGP/jdMGSg9k4TEzFe1VxKvohv+K8tSfsiUa8oAwK7PJ+ r3PoZiOh1+Azha6ud6Fgh+N6dZkuqoB3eyHFTk74zNCJaLf39h7kAkdClqmgymBJpc to8IuzURDg6Ww== From: Mark Brown Date: Mon, 07 Aug 2023 23:00:41 +0100 Subject: [PATCH v4 36/36] kselftest/arm64: Enable GCS for the FP stress tests MIME-Version: 1.0 Message-Id: <20230807-arm64-gcs-v4-36-68cfa37f9069@kernel.org> References: <20230807-arm64-gcs-v4-0-68cfa37f9069@kernel.org> In-Reply-To: <20230807-arm64-gcs-v4-0-68cfa37f9069@kernel.org> To: Catalin Marinas , Will Deacon , Jonathan Corbet , Andrew Morton , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Arnd Bergmann , Oleg Nesterov , Eric Biederman , Kees Cook , Shuah Khan , "Rick P. Edgecombe" , Deepak Gupta , Ard Biesheuvel , Szabolcs Nagy Cc: "H.J. Lu" , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Mark Brown X-Mailer: b4 0.13-dev-034f2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3085; i=broonie@kernel.org; h=from:subject:message-id; bh=o3F0gqwirOzTh8gwGkZMmsXM7Yu/yi+gPnGo/AGnFQM=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBk0Wm0B7vR+Jj9+krh2MyVWaBaRprqGc6O6TMFB5LC x8Rao0uJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZNFptAAKCRAk1otyXVSH0DDPCA CGBai+t6hCD7RdaCFqlpyScaFFsCygo7tHGR2ExxhQOjj2Qp6HrfVmIIebZ+b2n+GhUD4FG7W0cd4G 60s8t0qZCDiFxmb2nOYio7ZyqqUYHRFFOlFHG35XlpaJXVfYUphrX03EUBt0k1vyJmB/NV5ymRv2Sg viuPPcZk7co3lGYe4ormqwFoZ0ccHqkrzvqu8zp8jjCFibKt1tybybDVqYq98nwG+NXIB7BBwnor8Z thxFR7SWA0bL3uuxTULgb6GGc/3Dip1tBAoO9i+LP1twYFWRUuyt3UHzwK2gWiM4jK2yHJGIFjQ964 3v8/yDZmbweC+EUdisAnTPAphazHwS X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773613069277392521 X-GMAIL-MSGID: 1773613069277392521 While it's a bit off topic for them the floating point stress tests do give us some coverage of context thrashing cases, and also of active signal delivery separate to the relatively complicated framework in the actual signals tests. Have the tests enable GCS on startup, ignoring failures so they continue to work as before on systems without GCS. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/fp/assembler.h | 15 +++++++++++++++ tools/testing/selftests/arm64/fp/fpsimd-test.S | 2 ++ tools/testing/selftests/arm64/fp/sve-test.S | 2 ++ tools/testing/selftests/arm64/fp/za-test.S | 2 ++ tools/testing/selftests/arm64/fp/zt-test.S | 2 ++ 5 files changed, 23 insertions(+) diff --git a/tools/testing/selftests/arm64/fp/assembler.h b/tools/testing/selftests/arm64/fp/assembler.h index 9b38a0da407d..7012f9f796de 100644 --- a/tools/testing/selftests/arm64/fp/assembler.h +++ b/tools/testing/selftests/arm64/fp/assembler.h @@ -65,4 +65,19 @@ endfunction bl puts .endm +#define PR_SET_SHADOW_STACK_STATUS 72 +# define PR_SHADOW_STACK_ENABLE (1UL << 0) + +.macro enable_gcs + // Run with GCS + mov x0, PR_SET_SHADOW_STACK_STATUS + mov x1, PR_SHADOW_STACK_ENABLE + mov x2, xzr + mov x3, xzr + mov x4, xzr + mov x5, xzr + mov x8, #__NR_prctl + svc #0 +.endm + #endif /* ! ASSEMBLER_H */ diff --git a/tools/testing/selftests/arm64/fp/fpsimd-test.S b/tools/testing/selftests/arm64/fp/fpsimd-test.S index 8b960d01ed2e..b16fb7f42e3e 100644 --- a/tools/testing/selftests/arm64/fp/fpsimd-test.S +++ b/tools/testing/selftests/arm64/fp/fpsimd-test.S @@ -215,6 +215,8 @@ endfunction // Main program entry point .globl _start function _start + enable_gcs + mov x23, #0 // signal count mov w0, #SIGINT diff --git a/tools/testing/selftests/arm64/fp/sve-test.S b/tools/testing/selftests/arm64/fp/sve-test.S index 4328895dfc87..486634bc7def 100644 --- a/tools/testing/selftests/arm64/fp/sve-test.S +++ b/tools/testing/selftests/arm64/fp/sve-test.S @@ -378,6 +378,8 @@ endfunction // Main program entry point .globl _start function _start + enable_gcs + mov x23, #0 // Irritation signal count mov w0, #SIGINT diff --git a/tools/testing/selftests/arm64/fp/za-test.S b/tools/testing/selftests/arm64/fp/za-test.S index 9dcd70911397..f789694fa3ea 100644 --- a/tools/testing/selftests/arm64/fp/za-test.S +++ b/tools/testing/selftests/arm64/fp/za-test.S @@ -231,6 +231,8 @@ endfunction // Main program entry point .globl _start function _start + enable_gcs + mov x23, #0 // signal count mov w0, #SIGINT diff --git a/tools/testing/selftests/arm64/fp/zt-test.S b/tools/testing/selftests/arm64/fp/zt-test.S index d63286397638..ea5e55310705 100644 --- a/tools/testing/selftests/arm64/fp/zt-test.S +++ b/tools/testing/selftests/arm64/fp/zt-test.S @@ -200,6 +200,8 @@ endfunction // Main program entry point .globl _start function _start + enable_gcs + mov x23, #0 // signal count mov w0, #SIGINT