From patchwork Mon Aug 15 13:32:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 597409 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A463AC3F6B0 for ; Mon, 15 Aug 2022 13:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240848AbiHONdP (ORCPT ); Mon, 15 Aug 2022 09:33:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242755AbiHONcw (ORCPT ); Mon, 15 Aug 2022 09:32:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0185D175B2 for ; Mon, 15 Aug 2022 06:32:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A3F4EB80EBB for ; Mon, 15 Aug 2022 13:32:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF100C43470; Mon, 15 Aug 2022 13:32:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660570369; bh=pk7Q79jKBzZEn+CCEUhIxWG1JcQQiZbxATsJw8fMdG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uW59T6LjlQr67aU9gYrcKAXoCb8WskckNjJGtcryJpaewZCQZPVYVug47NwbQgSex N/2VcIplMu/1N3vxg2LIkG3pnQkGzEyDx11BlDPkKMsf+KYnH/A3DUZP4wDXLGLY8K sBF0Wbf16XcXyBiKvq2S9C7Q1GbJ0xwRW9/lfCv9zi8wIsVeinRm/WlqCrC8N4tNlo VZgL3WULtR40RaODZvCKWzCdE7eAAlKkSAclZ6blp6xTIXFzWnW/j1b5oWifbDJb9O M6385Ytnhg6vkGwRRLSyjFmJekN18dM3cmk15hLCM5wZKeAXunggmIAPbF1cKOSh29 ssnnAsjWv1LVg== From: Mark Brown To: Catalin Marinas , Will Deacon , Shuah Khan , Shuah Khan Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown Subject: [PATCH v1 01/10] kselftest/arm64: Enumerate SME rather than SVE vector lengths for za_regs Date: Mon, 15 Aug 2022 14:32:27 +0100 Message-Id: <20220815133236.235464-2-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220815133236.235464-1-broonie@kernel.org> References: <20220815133236.235464-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1039; i=broonie@kernel.org; h=from:subject; bh=pk7Q79jKBzZEn+CCEUhIxWG1JcQQiZbxATsJw8fMdG8=; b=owGbwMvMwMWocq27KDak/QLjabUkhqRfXq+n6bjnuWk72JrZBddnBXke3MD+8O0H8ac/7Nd8v7Ft ZwRjJ6MxCwMjF4OsmCLL2mcZq9LDJbbOfzT/FcwgViaQKQxcnAJwkSL2//7fhR/xts1Y8mhP7Du5gt R9pikfDNZkvsvSODpHb8XLv+mfeQPu5qXP5buSz3NYevXbg/fFYgqSEr+bxli7bxa0Lw5f4po+daXy Ge+3k1NVZp9NqQ3o2fxq4skNSosnrPvt8fD0qoYDZb4SLi19HkYOmblOx1wTfx5uuVlv3P362p6miz kLdSauex61gvfR6+cdOoU7e8WjlM+onqqeXrqE00lbPdVt4Uy59xNMtcXCHbTsfKryzn+KMORrjJ1X cH2+2fZ4eYezW14uVDt78uJ1plgxSe0ST99I85QKfd1AbVuLp5aLO49dLl52PD24xNzMsiZKmElOzf 6jtdWiwDWus045HvD9eFszL9MCAA== X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org The za_regs signal test was enumerating the SVE vector lengths rather than the SME vector lengths through cut'n'paste error when determining what to test. Enumerate the SME vector lengths instead. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/signal/testcases/za_regs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/arm64/signal/testcases/za_regs.c b/tools/testing/selftests/arm64/signal/testcases/za_regs.c index b94e4f99fcac..9f1dd70289be 100644 --- a/tools/testing/selftests/arm64/signal/testcases/za_regs.c +++ b/tools/testing/selftests/arm64/signal/testcases/za_regs.c @@ -22,10 +22,10 @@ static bool sme_get_vls(struct tdescr *td) int vq, vl; /* - * Enumerate up to SVE_VQ_MAX vector lengths + * Enumerate up to SME_VQ_MAX vector lengths */ for (vq = SVE_VQ_MAX; vq > 0; --vq) { - vl = prctl(PR_SVE_SET_VL, vq * 16); + vl = prctl(PR_SME_SET_VL, vq * 16); if (vl == -1) return false; From patchwork Mon Aug 15 13:32:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 597407 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC33AC25B06 for ; Mon, 15 Aug 2022 13:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242071AbiHONdQ (ORCPT ); Mon, 15 Aug 2022 09:33:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242838AbiHONcy (ORCPT ); Mon, 15 Aug 2022 09:32:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6FD817053 for ; Mon, 15 Aug 2022 06:32:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 90B44B80EBC for ; Mon, 15 Aug 2022 13:32:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2418C433D6; Mon, 15 Aug 2022 13:32:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660570371; bh=Dxt22W8Em96QEF9sjlP0/VfqCLzptWgJwiuX8Wed7dw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RVfREFIgYH/ba8Dn0zby6B5NIAwHYKMFxbbhQUzTZriH9pDHDM27KOQ2jfkzly0BB 744HG8OKf3gK8pOcFahr/SGA2bR6pDwW8ubtt+Zk/MXWty0XMRErxGOs36KzcdWZQX t7ixkVz0GTojK5PuSIQi5HOrJE08Bx7Jun5JQa7XViEr6GDSjsBKfGW/9TNqFXwBuG oFKoGlFc6LZvjlv7TSfepOxwqMC31QvkPp9NcxPpeyXZBE1foYjXHOE3X5g9euYuki /F7HtbrLNR6kXNGMEreqySj4mYijQqmcBmfu5fB3JpV8S/iOohZCnnIXoYJdeKCoeW SQt9Gycyh9HEQ== From: Mark Brown To: Catalin Marinas , Will Deacon , Shuah Khan , Shuah Khan Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown Subject: [PATCH v1 02/10] kselftest/arm64: Validate signal ucontext in place Date: Mon, 15 Aug 2022 14:32:28 +0100 Message-Id: <20220815133236.235464-3-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220815133236.235464-1-broonie@kernel.org> References: <20220815133236.235464-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1680; i=broonie@kernel.org; h=from:subject; bh=Dxt22W8Em96QEF9sjlP0/VfqCLzptWgJwiuX8Wed7dw=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBi+krsrr6pXSdNsaCjPzZcsv9NuPUamlQgH8zMcvpo Nhmt7KiJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYvpK7AAKCRAk1otyXVSH0LwYB/ 0UNOOLBubNtJoAJf+3G4GxyvIPFx3sdmm2hr2Hc21/KpGoiNb6woKL1Nw/esHVywTjnONJjYRH/2+W 786cRMtBRJcKOzwtdqy38dQo7elMCai3NA/Rk8yVhEkdO5LiHd+O1qcZq2rEJZGqccBIpuEqqb6tBH vrIu+jQCvr1RCzAmdc9vAb8rLs1+FQzszrCtTVjNQP/hD7xZsxKnciUfSCZrsqU0oGxZcC/XxYj5Yk 3n+4Zau3dcQ5pPMqtN62EylDcwDll5+wr42uHUJmMl6tNk94k/IV+yXzLxc0sUBUTxMnuxr+XdhcWI 1SBD4AdLCIMzP2P3BGSZWCP898c1Z5 X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org In handle_input_signal_copyctx() we use ASSERT_GOOD_CONTEXT() to validate that the context we are saving meets expectations however we do this on the saved copy rather than on the actual signal context passed in. This breaks validation of EXTRA_CONTEXT since we attempt to validate the ABI requirement that the additional space supplied is immediately after the termination record in the standard context which will not be the case after it has been copied to another location. Fix this by doing the validation before we copy. Note that nothing actually looks inside the EXTRA_CONTEXT at present. Signed-off-by: Mark Brown --- .../testing/selftests/arm64/signal/test_signals_utils.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/arm64/signal/test_signals_utils.c b/tools/testing/selftests/arm64/signal/test_signals_utils.c index b588d10afd5b..a54dc1b6f35c 100644 --- a/tools/testing/selftests/arm64/signal/test_signals_utils.c +++ b/tools/testing/selftests/arm64/signal/test_signals_utils.c @@ -165,12 +165,15 @@ static bool handle_signal_ok(struct tdescr *td, } static bool handle_signal_copyctx(struct tdescr *td, - siginfo_t *si, void *uc) + siginfo_t *si, void *uc_in) { + ucontext_t *uc = uc_in; + + ASSERT_GOOD_CONTEXT(uc); + /* Mangling PC to avoid loops on original BRK instr */ - ((ucontext_t *)uc)->uc_mcontext.pc += 4; + uc->uc_mcontext.pc += 4; memcpy(td->live_uc, uc, td->live_sz); - ASSERT_GOOD_CONTEXT(td->live_uc); td->live_uc_valid = 1; fprintf(stderr, "GOOD CONTEXT grabbed from sig_copyctx handler\n"); From patchwork Mon Aug 15 13:32:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 597408 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B50CDC25B0E for ; Mon, 15 Aug 2022 13:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242234AbiHONdS (ORCPT ); Mon, 15 Aug 2022 09:33:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242929AbiHONc5 (ORCPT ); Mon, 15 Aug 2022 09:32:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66ECD17053 for ; Mon, 15 Aug 2022 06:32:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 00FA860EC3 for ; Mon, 15 Aug 2022 13:32:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC049C43470; Mon, 15 Aug 2022 13:32:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660570375; bh=OEluHX2rINw79r1ixw5NAaWYr6eeAln8ZyuAwVaM4PU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FqjpqSdtvTVR00WtioVTRz5w/dnUqxr+tjd9LZ2lSuHIdHFgGxhp8kxhjAbMc+UIS RRHYBBHJKbh2vZOVwjuxcwP3OvEE5CJuRRE1XcphY7aCVU8ZV9d3TqZjgO9cyta0DP wpFyizqH3vVy7UWSPeq3D3HbSV+lqzvAf29ru6U0JErenhdHQDr6/u6zKINM0r9E3b L+dV24zCOysKUIWlJveydO4P4hOVKliUddsiu53/ryrHNqEvfsTVs4EIRn0pPeFTBM xWJK8OhfAOCJ/qRHOt7NVLDELfLuJcYNcxcI4ysz3sEpmtiTjXTWoZCEIjBbO7zh0m J5NI2ThtI1asQ== From: Mark Brown To: Catalin Marinas , Will Deacon , Shuah Khan , Shuah Khan Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown Subject: [PATCH v1 04/10] kselftest/arm64: Fix validation of EXTRA_CONTEXT signal context location Date: Mon, 15 Aug 2022 14:32:30 +0100 Message-Id: <20220815133236.235464-5-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220815133236.235464-1-broonie@kernel.org> References: <20220815133236.235464-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1431; i=broonie@kernel.org; h=from:subject; bh=OEluHX2rINw79r1ixw5NAaWYr6eeAln8ZyuAwVaM4PU=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBi+kru53ACy+qtRh8Sc/w53mW6y7ChJCJBs5P7thFO wOL9vv+JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYvpK7gAKCRAk1otyXVSH0NIuB/ 0aTbFeU+6+7i0uom74XxllgBVR1jaf2adLdxxjq9sFkVP/mwEn3dcjTcX0pVk0HDRN0DoIKDHlyj8s AN8iCu4tSc1Xu1O5k5iyi01PDfTBc0NL4/de/agnPCWmVittKaZmG7rO4j7WWkP+HTmb7kaSQSF7Qh Mzp8lRSsn16zenytVTG7IpxDCnqEjK/rwXv5otETzrS2z9yZZ3R5ZGQQfyVMFLDDpsrdWzK7ebF45q 5xypYIGgABWqureil5VhROjWZ+RG+uBps0ifi+4/biHGLf87leMwDQl0+0fPsAMj2Q9k36iWWcyENA 1sPLBZ7not5WRTFRBd2NVc94Qa6K7T X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Currently in validate_extra_context() we assert both that the extra data pointed to by the EXTRA_CONTEXT is 16 byte aligned and that it immediately follows the struct _aarch64_ctx providing the terminator for the linked list of contexts in the signal frame. Since struct _aarch64_ctx is an 8 byte structure which must be 16 byte aligned these cannot both be true. As documented in sigcontext.h and implemented by the kernel the extra data should be at the next 16 byte aligned address after the terminator so fix the validation to match. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/signal/testcases/testcases.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/arm64/signal/testcases/testcases.c b/tools/testing/selftests/arm64/signal/testcases/testcases.c index d98828cb542b..16dc916939f9 100644 --- a/tools/testing/selftests/arm64/signal/testcases/testcases.c +++ b/tools/testing/selftests/arm64/signal/testcases/testcases.c @@ -42,7 +42,7 @@ bool validate_extra_context(struct extra_context *extra, char **err) *err = "Extra DATAP misaligned"; else if (extra->size & 0x0fUL) *err = "Extra SIZE misaligned"; - else if (extra->datap != (uint64_t)term + sizeof(*term)) + else if (extra->datap != (uint64_t)term + 0x10UL) *err = "Extra DATAP misplaced (not contiguous)"; if (*err) return false; From patchwork Mon Aug 15 13:32:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 597406 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F19FFC28B2B for ; Mon, 15 Aug 2022 13:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242413AbiHONdV (ORCPT ); Mon, 15 Aug 2022 09:33:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242981AbiHONdB (ORCPT ); Mon, 15 Aug 2022 09:33:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F29017053 for ; Mon, 15 Aug 2022 06:33:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0C7E160EC2 for ; Mon, 15 Aug 2022 13:33:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6DA6C4347C; Mon, 15 Aug 2022 13:32:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660570379; bh=+LI8T2tA3D0W4jHBlk8SZzjrz3GUYnCv7SGlY2zQn2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r1GmFRBFM0w+tDwWi23iCgrRV4kJa2wKqSBSZieRVWbZjH2NiSGHIAYlMi5934kJc HZ4mbYoUR5FCNDj2c+r+kWAPUtQxZr+NcewuWTlsh32OHfYSfZwLVdgxwG/+f4fb8z puJXvCD+gHxn7BP//8f7v0CoKz+ds8raakUo2YGDCyZ4r2F1aWlulhObL88MjXfaRj NaGye+1BYexCl3/1qNfMGmMiykPqx375L147hGO6+Q7q7HRTENH7MF9w5UhQj+eJPe T8Yye6IPYS+gZetzGbAKwAHZ62Df7/xq+Jb4JQ7UkHrPSNQcxWV3HTY44HQ65XpM0N jKPDjXDDhJA8g== From: Mark Brown To: Catalin Marinas , Will Deacon , Shuah Khan , Shuah Khan Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown Subject: [PATCH v1 06/10] kselftest/arm64: Only validate each signal context once Date: Mon, 15 Aug 2022 14:32:32 +0100 Message-Id: <20220815133236.235464-7-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220815133236.235464-1-broonie@kernel.org> References: <20220815133236.235464-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3258; i=broonie@kernel.org; h=from:subject; bh=+LI8T2tA3D0W4jHBlk8SZzjrz3GUYnCv7SGlY2zQn2Q=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBi+krwJUXK/s/g3rF4Rh7MBT99qYdZEnt7xAeJcKyV 7ykOlU6JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYvpK8AAKCRAk1otyXVSH0L8rB/ 9/XHTCkhHe24fXfDewMBsFjhJxRy0vhgiB1aPOa9ssT5vDJkpaiuFpoithcaX0KYt+pAOSiZC5Bdax yhTCEDMEKLqDjwbMe+4Q6/STB36uEtXkUzg0eVp/G4o6QqT7BIf0C9ZguhrAYzollZl6HX5fyNbHVa /QvWZOGnZiLe5aH0ztl7lmnujeOX4/b8/7+xZxVYk2RS01u2++kRidYcPIP0nFpQmnqEvsP6AvSbPF bDG/rJePfmrGW+JiKHJ/+WQ3W5DhJfNFSL2W8wVXUeGRIOMjApyeo5h3AJ/uThP6PlJ9pcNIg3Xym7 1i+MRNmUpUiQnT1JT/l55qtGSNQ8BR X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Currently for the more complex signal context types we validate the context specific details the end of the parsing loop validate_reserved() if we've ever seen a context of that type. This is currently merely a bit inefficient but will get a bit awkward when we start parsing extra_context, at which point we will need to reset the head to advance into the extra space that extra_context provides. Instead only do the more detailed checks on each context type the first time we see that context type. Signed-off-by: Mark Brown --- .../arm64/signal/testcases/testcases.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/arm64/signal/testcases/testcases.c b/tools/testing/selftests/arm64/signal/testcases/testcases.c index 16dc916939f9..0b3c9b4b1d39 100644 --- a/tools/testing/selftests/arm64/signal/testcases/testcases.c +++ b/tools/testing/selftests/arm64/signal/testcases/testcases.c @@ -105,6 +105,7 @@ bool validate_reserved(ucontext_t *uc, size_t resv_sz, char **err) bool terminated = false; size_t offs = 0; int flags = 0; + int new_flags; struct extra_context *extra = NULL; struct sve_context *sve = NULL; struct za_context *za = NULL; @@ -120,6 +121,8 @@ bool validate_reserved(ucontext_t *uc, size_t resv_sz, char **err) return false; } + new_flags = 0; + switch (head->magic) { case 0: if (head->size) @@ -133,7 +136,7 @@ bool validate_reserved(ucontext_t *uc, size_t resv_sz, char **err) else if (head->size != sizeof(struct fpsimd_context)) *err = "Bad size for fpsimd_context"; - flags |= FPSIMD_CTX; + new_flags |= FPSIMD_CTX; break; case ESR_MAGIC: if (head->size != sizeof(struct esr_context)) @@ -144,14 +147,14 @@ bool validate_reserved(ucontext_t *uc, size_t resv_sz, char **err) *err = "Multiple SVE_MAGIC"; /* Size is validated in validate_sve_context() */ sve = (struct sve_context *)head; - flags |= SVE_CTX; + new_flags |= SVE_CTX; break; case ZA_MAGIC: if (flags & ZA_CTX) *err = "Multiple ZA_MAGIC"; /* Size is validated in validate_za_context() */ za = (struct za_context *)head; - flags |= ZA_CTX; + new_flags |= ZA_CTX; break; case EXTRA_MAGIC: if (flags & EXTRA_CTX) @@ -159,7 +162,7 @@ bool validate_reserved(ucontext_t *uc, size_t resv_sz, char **err) else if (head->size != sizeof(struct extra_context)) *err = "Bad size for extra_context"; - flags |= EXTRA_CTX; + new_flags |= EXTRA_CTX; extra = (struct extra_context *)head; break; case KSFT_BAD_MAGIC: @@ -192,16 +195,18 @@ bool validate_reserved(ucontext_t *uc, size_t resv_sz, char **err) return false; } - if (flags & EXTRA_CTX) + if (new_flags & EXTRA_CTX) if (!validate_extra_context(extra, err)) return false; - if (flags & SVE_CTX) + if (new_flags & SVE_CTX) if (!validate_sve_context(sve, err)) return false; - if (flags & ZA_CTX) + if (new_flags & ZA_CTX) if (!validate_za_context(za, err)) return false; + flags |= new_flags; + head = GET_RESV_NEXT_HEAD(head); } From patchwork Mon Aug 15 13:32:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 597405 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A083C2BB43 for ; Mon, 15 Aug 2022 13:33:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242588AbiHONdW (ORCPT ); Mon, 15 Aug 2022 09:33:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243008AbiHONdH (ORCPT ); Mon, 15 Aug 2022 09:33:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C4BC15718 for ; Mon, 15 Aug 2022 06:33:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DAA72B80EC0 for ; Mon, 15 Aug 2022 13:33:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF3F7C433D7; Mon, 15 Aug 2022 13:33:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660570383; bh=6rK/9PZALGAoGA9wCW1CCtvSgsEbMadnadvWyxX6Jfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RNSFYZHn14/n2pUZUyWgxyEkLiMDJSW+EXMKXQlUvXLvRx5jtva1eX2YNPCE1bwtt GjxS6TSr4eDdjOgl32eGd2H1rYgAFBeP5+rJaLASvZMn6Ac7aNCTcn9wvNMAQed+Ss ILcaDz1Dj3YJKqSXMrCQTwbqwuDcXh7GKFCSpZqJg/WqsWt32kIqWasqHYoY9ec9Ug GBTYwAp2lCsVR6MzU3e8vbZBwSRWpa9OivQnxeiQ2gnmSek4/aOE04TMnhn/DL+8tr A5D2Rr0UNbnF7wUvrD7UW3r5O7qfqjR4MKF9cXvlgFqTYT5zNDAGnD6y9zIfC9JzBi 7i3rOyf9QYY6w== From: Mark Brown To: Catalin Marinas , Will Deacon , Shuah Khan , Shuah Khan Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown Subject: [PATCH v1 08/10] kselftest/arm64: Preserve any EXTRA_CONTEXT in handle_signal_copyctx() Date: Mon, 15 Aug 2022 14:32:34 +0100 Message-Id: <20220815133236.235464-9-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220815133236.235464-1-broonie@kernel.org> References: <20220815133236.235464-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3106; i=broonie@kernel.org; h=from:subject; bh=6rK/9PZALGAoGA9wCW1CCtvSgsEbMadnadvWyxX6Jfw=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBi+kryODfg/LpIpbn9yartoDqNbxpiXcDV5WNM7X2h 3GTCDmSJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYvpK8gAKCRAk1otyXVSH0FoBB/ 9KLCPXutzCqwR69nUAzD9nI23dyi0S9x5MXZpaqrRmnAwZfnfu0ckrGZUiLArQt6Ocr9sJUXItCfhC CSaudvgkoeSYR83i9dMKH4l631l0AS+VqoZitDtnfB8Pb3Xs6aNMXHFdglZdObE7UJq5WvFk6+/anF lqms00PLPMw4fh1oEhwEvFcnbJoopEon1qUnhR5tWjK0m0MCuvOycRVAu7cSnonZvI6OaFLoPRCl8O V73MVF0zX7bCGMlfa8Gi272G1IE9WURgPRqFLAt7mGTcyqS6AxpByEAenI05p2B3mNPqVMQX9Z056A AkNSkZ5vaUsmnF0mOExjefN3FQQ2nl X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org When preserving the signal context for later verification by testcases check for and include any EXTRA_CONTEXT block if enough space has been provided. Since the EXTRA_CONTEXT block includes a pointer to the start of the additional data block we need to do at least some fixup on the copied data. For simplicity in users we do this by extending the length of the EXTRA_CONTEXT to include the following termination record, this will cause users to see the extra data as part of the linked list of contexts without needing any special handling. Care will be needed if any specific tests for EXTRA_CONTEXT are added beyond the validation done in ASSERT_GOOD_CONTEXT. Signed-off-by: Mark Brown --- .../arm64/signal/test_signals_utils.c | 50 ++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/arm64/signal/test_signals_utils.c b/tools/testing/selftests/arm64/signal/test_signals_utils.c index a54dc1b6f35c..308e229e58ab 100644 --- a/tools/testing/selftests/arm64/signal/test_signals_utils.c +++ b/tools/testing/selftests/arm64/signal/test_signals_utils.c @@ -168,15 +168,61 @@ static bool handle_signal_copyctx(struct tdescr *td, siginfo_t *si, void *uc_in) { ucontext_t *uc = uc_in; + struct _aarch64_ctx *head; + struct extra_context *extra, *copied_extra; + size_t offset = 0; + size_t to_copy; ASSERT_GOOD_CONTEXT(uc); /* Mangling PC to avoid loops on original BRK instr */ uc->uc_mcontext.pc += 4; - memcpy(td->live_uc, uc, td->live_sz); + + /* + * Check for an preserve any extra data too with fixups. + */ + head = (struct _aarch64_ctx *)uc->uc_mcontext.__reserved; + head = get_header(head, EXTRA_MAGIC, td->live_sz, &offset); + if (head) { + extra = (struct extra_context *)head; + + /* + * The extra buffer must be immediately after the + * extra_context and a 16 byte terminator. Include it + * in the copy, this was previously validated in + * ASSERT_GOOD_CONTEXT(). + */ + to_copy = offset + sizeof(struct extra_context) + 16 + + extra->size; + copied_extra = (struct extra_context *)&(td->live_uc->uc_mcontext.__reserved[offset]); + } else { + copied_extra = NULL; + to_copy = sizeof(ucontext_t); + } + + if (to_copy > td->live_sz) { + fprintf(stderr, + "Not enough space to grab context, %lu/%lu bytes\n", + td->live_sz, to_copy); + return false; + } + + memcpy(td->live_uc, uc, to_copy); + + /* + * If there was any EXTRA_CONTEXT fix up the size to be the + * struct extra_context and the following terminator record, + * this means that the rest of the code does not need to have + * special handling for the record and we don't need to fix up + * datap for the new location. + */ + if (copied_extra) + copied_extra->head.size = sizeof(*copied_extra) + 16; + td->live_uc_valid = 1; fprintf(stderr, - "GOOD CONTEXT grabbed from sig_copyctx handler\n"); + "%lu byte GOOD CONTEXT grabbed from sig_copyctx handler\n", + to_copy); return true; } From patchwork Mon Aug 15 13:32:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 597404 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3D0AC00140 for ; Mon, 15 Aug 2022 13:34:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232727AbiHONdp (ORCPT ); Mon, 15 Aug 2022 09:33:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233194AbiHONdN (ORCPT ); Mon, 15 Aug 2022 09:33:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E66D515718 for ; Mon, 15 Aug 2022 06:33:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7704CB80EBC for ; Mon, 15 Aug 2022 13:33:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63358C43141; Mon, 15 Aug 2022 13:33:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660570388; bh=uQocCmCf8k/A6P+eCrG+zLjWeDLQEf5/ywHNv0Ynfis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H3G3598s/baZt5rgiF3jEwTzM8CII+mZaW5LbZEvhZcH1KNE524sqPAEnjScQUTMC jkBVsbcqCgIlamzPugFSnAurQw7wa7+LxpvnZZ1hSVmjnGjkY9dpUA8pBCKoC7lXwk Kl99MNRNn+z9WrSLI5p59HHpXVl6dUvDmMhTcknFpoBvWYwlI59eOP7R44K0/2RhNG 0ltrByo+G0G5DPAK3IDSwNLbeBjb3lWNp2kCJnN3ED4nNDw41YnXXde+5wUvwNvJCk hkHPZXfppCP86pwiyRgtq784wb8zRku2qbb8PcqsO8Bi5ChRPK1qJFaiLtbUmgtsWD k9NEoGWPxBArw== From: Mark Brown To: Catalin Marinas , Will Deacon , Shuah Khan , Shuah Khan Cc: linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown Subject: [PATCH v1 10/10] kselftest/arm64: Include larger SVE and SME VLs in signal tests Date: Mon, 15 Aug 2022 14:32:36 +0100 Message-Id: <20220815133236.235464-11-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220815133236.235464-1-broonie@kernel.org> References: <20220815133236.235464-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=7369; i=broonie@kernel.org; h=from:subject; bh=uQocCmCf8k/A6P+eCrG+zLjWeDLQEf5/ywHNv0Ynfis=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBi+krzhmkNqeBcht3FxXt1jcBGuQuERWUJEr1epuio CRPgrGOJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYvpK8wAKCRAk1otyXVSH0AY/CA CDLgmbH3piu8jzJ2VKWtqdQGghV55g4H16MSqzYVbfpurgVU0OJ/GYsT0gxYuL4GtbKofAiU1HEJLB /S6bR84uCEzYmS2/1ZOwQuV/9UMEhWFJZB7KQL++T4uSDWRGSRnbuUFpdnTyvWUokS6HgCeobsIARO Uo2I+Ynkx5WK4EPGlC5GDLki73f/67Aq8RSqCHcVBT1E8PsL1THeWFu280oizii/XmE87yBvKSOWSR R+Bs+XlJhZ/AIF6PsBm5ujag8379gO7IvUji2Y+Rv7r8ttbWvbYKKQNgjWfLPZgkKTLZpkmKgLNdpj LBy9xy0NaPEd5sYqyYWnAL1nMrtTIg X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Now that the core utilities for signal testing support handling data in EXTRA_CONTEXT blocks we can test larger SVE and SME VLs which spill over the limits in the base signal context. This is done by defining storage for the context as a union with a ucontext_t and a buffer together with some helpers for getting relevant sizes and offsets like we do for fake_sigframe, this isn't the most lovely code ever but is fairly straightforward to implement and much less invasive to the somewhat unclear and indistinct layers of abstraction in the signal handling test code. Signed-off-by: Mark Brown --- .../arm64/signal/testcases/ssve_regs.c | 25 +++++++------------ .../arm64/signal/testcases/sve_regs.c | 23 +++++++---------- .../arm64/signal/testcases/testcases.h | 7 ++++++ .../arm64/signal/testcases/za_regs.c | 24 ++++++------------ 4 files changed, 33 insertions(+), 46 deletions(-) diff --git a/tools/testing/selftests/arm64/signal/testcases/ssve_regs.c b/tools/testing/selftests/arm64/signal/testcases/ssve_regs.c index 71f14632c524..d0a178945b1a 100644 --- a/tools/testing/selftests/arm64/signal/testcases/ssve_regs.c +++ b/tools/testing/selftests/arm64/signal/testcases/ssve_regs.c @@ -13,7 +13,10 @@ #include "test_signals_utils.h" #include "testcases.h" -struct fake_sigframe sf; +static union { + ucontext_t uc; + char buf[1024 * 64]; +} context; static unsigned int vls[SVE_VQ_MAX]; unsigned int nvls = 0; @@ -55,8 +58,8 @@ static void setup_ssve_regs(void) static int do_one_sme_vl(struct tdescr *td, siginfo_t *si, ucontext_t *uc, unsigned int vl) { - size_t resv_sz, offset; - struct _aarch64_ctx *head = GET_SF_RESV_HEAD(sf); + size_t offset; + struct _aarch64_ctx *head = GET_BUF_RESV_HEAD(context); struct sve_context *ssve; int ret; @@ -73,11 +76,11 @@ static int do_one_sme_vl(struct tdescr *td, siginfo_t *si, ucontext_t *uc, * in it. */ setup_ssve_regs(); - if (!get_current_context(td, &sf.uc, sizeof(sf.uc))) + if (!get_current_context(td, &context.uc, sizeof(context))) return 1; - resv_sz = GET_SF_RESV_SIZE(sf); - head = get_header(head, SVE_MAGIC, resv_sz, &offset); + head = get_header(head, SVE_MAGIC, GET_BUF_RESV_SIZE(context), + &offset); if (!head) { fprintf(stderr, "No SVE context\n"); return 1; @@ -101,16 +104,6 @@ static int sme_regs(struct tdescr *td, siginfo_t *si, ucontext_t *uc) int i; for (i = 0; i < nvls; i++) { - /* - * TODO: the signal test helpers can't currently cope - * with signal frames bigger than struct sigcontext, - * skip VLs that will trigger that. - */ - if (vls[i] > 64) { - printf("Skipping VL %u due to stack size\n", vls[i]); - continue; - } - if (do_one_sme_vl(td, si, uc, vls[i])) return 1; } diff --git a/tools/testing/selftests/arm64/signal/testcases/sve_regs.c b/tools/testing/selftests/arm64/signal/testcases/sve_regs.c index 4cdedb706786..8b16eabbb769 100644 --- a/tools/testing/selftests/arm64/signal/testcases/sve_regs.c +++ b/tools/testing/selftests/arm64/signal/testcases/sve_regs.c @@ -13,7 +13,10 @@ #include "test_signals_utils.h" #include "testcases.h" -struct fake_sigframe sf; +static union { + ucontext_t uc; + char buf[1024 * 64]; +} context; static unsigned int vls[SVE_VQ_MAX]; unsigned int nvls = 0; @@ -55,8 +58,8 @@ static void setup_sve_regs(void) static int do_one_sve_vl(struct tdescr *td, siginfo_t *si, ucontext_t *uc, unsigned int vl) { - size_t resv_sz, offset; - struct _aarch64_ctx *head = GET_SF_RESV_HEAD(sf); + size_t offset; + struct _aarch64_ctx *head = GET_BUF_RESV_HEAD(context); struct sve_context *sve; fprintf(stderr, "Testing VL %d\n", vl); @@ -71,11 +74,11 @@ static int do_one_sve_vl(struct tdescr *td, siginfo_t *si, ucontext_t *uc, * in it. */ setup_sve_regs(); - if (!get_current_context(td, &sf.uc, sizeof(sf.uc))) + if (!get_current_context(td, &context.uc, sizeof(context))) return 1; - resv_sz = GET_SF_RESV_SIZE(sf); - head = get_header(head, SVE_MAGIC, resv_sz, &offset); + head = get_header(head, SVE_MAGIC, GET_BUF_RESV_SIZE(context), + &offset); if (!head) { fprintf(stderr, "No SVE context\n"); return 1; @@ -99,14 +102,6 @@ static int sve_regs(struct tdescr *td, siginfo_t *si, ucontext_t *uc) int i; for (i = 0; i < nvls; i++) { - /* - * TODO: the signal test helpers can't currently cope - * with signal frames bigger than struct sigcontext, - * skip VLs that will trigger that. - */ - if (vls[i] > 64) - continue; - if (do_one_sve_vl(td, si, uc, vls[i])) return 1; } diff --git a/tools/testing/selftests/arm64/signal/testcases/testcases.h b/tools/testing/selftests/arm64/signal/testcases/testcases.h index b39f538c7be1..040afded0b76 100644 --- a/tools/testing/selftests/arm64/signal/testcases/testcases.h +++ b/tools/testing/selftests/arm64/signal/testcases/testcases.h @@ -30,6 +30,13 @@ #define GET_SF_RESV_SIZE(sf) \ sizeof((sf).uc.uc_mcontext.__reserved) +#define GET_BUF_RESV_HEAD(buf) \ + (struct _aarch64_ctx *)(&(buf).uc.uc_mcontext.__reserved) + +#define GET_BUF_RESV_SIZE(buf) \ + (sizeof(buf) - sizeof(buf.uc) + \ + sizeof((buf).uc.uc_mcontext.__reserved)) + #define GET_UCP_RESV_SIZE(ucp) \ sizeof((ucp)->uc_mcontext.__reserved) diff --git a/tools/testing/selftests/arm64/signal/testcases/za_regs.c b/tools/testing/selftests/arm64/signal/testcases/za_regs.c index 1c008bca73a1..d334fe210595 100644 --- a/tools/testing/selftests/arm64/signal/testcases/za_regs.c +++ b/tools/testing/selftests/arm64/signal/testcases/za_regs.c @@ -13,7 +13,10 @@ #include "test_signals_utils.h" #include "testcases.h" -struct fake_sigframe sf; +static union { + ucontext_t uc; + char buf[1024 * 128]; +} context; static unsigned int vls[SVE_VQ_MAX]; unsigned int nvls = 0; @@ -55,8 +58,8 @@ static void setup_za_regs(void) static int do_one_sme_vl(struct tdescr *td, siginfo_t *si, ucontext_t *uc, unsigned int vl) { - size_t resv_sz, offset; - struct _aarch64_ctx *head = GET_SF_RESV_HEAD(sf); + size_t offset; + struct _aarch64_ctx *head = GET_BUF_RESV_HEAD(context); struct za_context *za; fprintf(stderr, "Testing VL %d\n", vl); @@ -71,11 +74,10 @@ static int do_one_sme_vl(struct tdescr *td, siginfo_t *si, ucontext_t *uc, * in it. */ setup_za_regs(); - if (!get_current_context(td, &sf.uc, sizeof(sf.uc))) + if (!get_current_context(td, &context.uc, sizeof(context))) return 1; - resv_sz = GET_SF_RESV_SIZE(sf); - head = get_header(head, ZA_MAGIC, resv_sz, &offset); + head = get_header(head, ZA_MAGIC, GET_BUF_RESV_SIZE(context), &offset); if (!head) { fprintf(stderr, "No ZA context\n"); return 1; @@ -99,16 +101,6 @@ static int sme_regs(struct tdescr *td, siginfo_t *si, ucontext_t *uc) int i; for (i = 0; i < nvls; i++) { - /* - * TODO: the signal test helpers can't currently cope - * with signal frames bigger than struct sigcontext, - * skip VLs that will trigger that. - */ - if (vls[i] > 32) { - printf("Skipping VL %u due to stack size\n", vls[i]); - continue; - } - if (do_one_sme_vl(td, si, uc, vls[i])) return 1; }