From patchwork Tue Aug 22 13:57:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 136591 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b82d:0:b0:3f2:4152:657d with SMTP id z13csp3810509vqi; Tue, 22 Aug 2023 11:24:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEKbitUGNveqeXkmTbGFB2jZuzvVi/NNV3yLmilcLyyMK6pXsUDucEYiyWGBLCldIPAHQhZ X-Received: by 2002:a05:6a21:3d84:b0:13d:ea25:9656 with SMTP id bj4-20020a056a213d8400b0013dea259656mr8333522pzc.60.1692728657005; Tue, 22 Aug 2023 11:24:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692728656; cv=none; d=google.com; s=arc-20160816; b=D3hkXiYzlT8UCzICh/xDgv47m3u5qGyBj63G8ixtkeVWQOrAm6bPjutY0ISSHc3VKj Q/Js9oWtQVYNTXQqtLkd9n8zj65vR8jEOj67FY7uy37Nk/zRuE0xZveTT8FkzHql/kNd 8Jn60iBgoVP2SV/z/dTVhQ4+Q4+YgTLpYckvC1LVE59JtC6gKN/zFXmMKfR5lJ/eHf4E lAFxj80aouTCvFzNMnTcT6pEBTQ/W0l7a62F5i4KHj6lG+Xi0oahjXqnOMmWWR3hQSWI uo3kqFfnn4MM13BdkLac1YcFhXMfZZOEEz8om4TIQSy0Jj7DkCeY4i2WAg9RQmRIfN50 Afsg== 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=pWtYuGVPwcuZGl9JZJ+abpsNY7lzh0YkfvPszVllCpGk6YBCkYIivrulREZCPNQJIM OOUBxjdVeq8csJPuC6jzBu0rms6xbFLFlkWF1qlQGvdcfVKHqi8CuVZ6HcUarf8FbR6n gFP1Jm0KCu2T3Vv72NPlWsFNa4s/P0mo71QTYRhQr/8RFTYg3hpSWIeGOlpoxgPS5m/C twjfeOXataKj6w/SF0vBni1zw2sUk3oi/CY1h5vafvMnixCiYE1hepBTYXBBOOiF3Z6q RosPC9PW3oYVcGOvDZvXEiw/F+0PukFOy5aCbYIeLNwGirAjE/LV76Ivqwy7GT2HQl1/ 7R3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Lodozd7l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id cn15-20020a056a00340f00b0068781a6993bsi9084467pfb.276.2023.08.22.11.24.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Aug 2023 11:24:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Lodozd7l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0D4693DD0D; Tue, 22 Aug 2023 10:23:52 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236644AbjHVOI1 (ORCPT + 99 others); Tue, 22 Aug 2023 10:08:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236589AbjHVOIX (ORCPT ); Tue, 22 Aug 2023 10:08:23 -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 A2F75E58; Tue, 22 Aug 2023 07:07:52 -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 09E3461587; Tue, 22 Aug 2023 14:07:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4D8DC433C8; Tue, 22 Aug 2023 14:06:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692713219; bh=o3F0gqwirOzTh8gwGkZMmsXM7Yu/yi+gPnGo/AGnFQM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Lodozd7lEcs8J8FHBWLzVHqcOediGHFTgfJTa8pByGLpGgE9Q/VT6PR8A4mOPzYND 0KSwGzmqkW7hGOD0yjOwIlAVM5Tgey2CgQIQAzDxCQtAduKwx3YTSwqwT2ykASKHZ+ gsbGmVZFTV2NezkO3DVeHrsFeKeoBprifsT1k9Hdhhz8I9ppAJNE3rKe0X2XyIolrU SR/2hnR8YcJaBeRb3a6+UDlBVdgD4NYymWgF2gb8gL3OEL5eP9J2wsIK+135u1b1YE L0py6zI5WnusoyHZZm5LHVDhTfEoPicpqiNM6HhpE9bbUMYdCfKB+MrMU/oqnYlKnD l9rK9n4JLQ9EQ== From: Mark Brown Date: Tue, 22 Aug 2023 14:57:10 +0100 Subject: [PATCH v5 37/37] kselftest/arm64: Enable GCS for the FP stress tests MIME-Version: 1.0 Message-Id: <20230822-arm64-gcs-v5-37-9ef181dd6324@kernel.org> References: <20230822-arm64-gcs-v5-0-9ef181dd6324@kernel.org> In-Reply-To: <20230822-arm64-gcs-v5-0-9ef181dd6324@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/pANAwAKASTWi3JdVIfQAcsmYgBk5MANh6zZuU8eIQ51uNZ/NOE2FMu2W5WwarFAKQ4/ z+TXFFWJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZOTADQAKCRAk1otyXVSH0GsJB/ 4wKNrGwCSwijToaO8YpJXzGD9AtXsF3A1WkYgSJizhypJazSZrPix+J3YxSC6VvSvp1yAyxQ6HEqpE sDL1EvYX9GSXJbRnHsPE3Jm0uQjbCZRWa8nPi5dJgslWqF5/lALnitZADjBWV+hiyjLEt6kg5wbbyO Ls+zjygM+M8lBrHe0oOBiR5bRJZD9RcB+6HIAW+lqniWADoj7cdAfOa28StXYilwhXMffRAs7XX274 knCUAPnvn3q3YnF36F/uqXOqYBTfGa+vzZSO4I5X2FpWi8fWnaUVmHfnI7/vjtkMGISJn7FhFBJWIj sTYdbVsWLxUbx4Jex1+ysaixwFtpt7 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: 1774954644441787278 X-GMAIL-MSGID: 1774954644441787278 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