From patchwork Tue Jan 25 15:09:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 12723955 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 56CA7C433EF for ; Tue, 25 Jan 2022 15:26:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8wRmdt/R3zDtA2RQ+dwf1xS44Au55oDZwwRg3bPdBNU=; b=L7q9TXKkB1Cc+0 8bOw47B+4mFx/ooxpQ8cOTon2AIGrqLZeWnMFGvS8y/UQAwvMv1kGH/RXbnl5sEeJn5C+H9Qqwixj 6l6fD5xgzvminBXxhmBlyvzfpK/tDJZgBILC8Quc23YDJ3ld0nSa5sg6/b/g145T2Uv64XBX12U5f 2qAI3rXjP3wK6aDTjBPKEejNZ/RLIdC/nylf7YI03mEdQtWwDYUD/xEHd6VmzK4x9k8adg/P9EuDI OqAkisSBAo5HJQc8s1YM5sRTSiOXZeqHf7TlFUq9PadhOsRJiTiAo2K0fGv9PgrZLzOOHp8ZVfYjT sQ1QTJz8dMRQK/GWVk7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCNfY-008McF-1g; Tue, 25 Jan 2022 15:23:42 +0000 Received: from mail-vi1eur05on2047.outbound.protection.outlook.com ([40.107.21.47] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCNSR-008IMB-OG for linux-arm-kernel@lists.infradead.org; Tue, 25 Jan 2022 15:10:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HVYoCG8YmVSHrOFzhqytWgLWvM2wgZyVdW2KcEFDVao=; b=AnitAy7jvvPVH1kxY3ZYONT+FbFn4F35NTcoy5t6YI8t28pqc4S8QnEyJvxG/byFrnKf9Y39EPTtd+G5cXREPjbSjB1ydpyPeLv6w+SYNAvamHJ5WduG+Gp8VLyO6BVhU5UbqSvbW28P7eMi2eJkro5CaoHRo4aDo11Xtp+dsHc= Received: from DB6P193CA0017.EURP193.PROD.OUTLOOK.COM (2603:10a6:6:29::27) by PA4PR08MB7482.eurprd08.prod.outlook.com (2603:10a6:102:2a6::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.7; Tue, 25 Jan 2022 15:10:04 +0000 Received: from DB5EUR03FT037.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:29:cafe::25) by DB6P193CA0017.outlook.office365.com (2603:10a6:6:29::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.8 via Frontend Transport; Tue, 25 Jan 2022 15:10:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT037.mail.protection.outlook.com (10.152.20.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.7 via Frontend Transport; Tue, 25 Jan 2022 15:10:04 +0000 Received: ("Tessian outbound 63bb5eb69ee8:v113"); Tue, 25 Jan 2022 15:10:04 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: cbdc38f2ecf9cba0 X-CR-MTA-TID: 64aa7808 Received: from b8824943d22f.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 07CEFB8A-0C2D-43FC-A1DB-1C9B86DE7263.1; Tue, 25 Jan 2022 15:09:58 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b8824943d22f.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 25 Jan 2022 15:09:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tn6/n38ZQ8R+AMZ0XIGaGVS8IqXAELWVLf7BIz5fVtJ0JRc0mV3x4WhI08yAtPtOAYfU4ylR0Jtne3+pwZ0jlf4n5ZqP/b9SdVzSAyIZtGJ1ZDhtZr3q0C9YZqO8Sr4g00xmwTRqpJUiuwz8gAEgAJz8TvBFqaqTrcs6Lzh/1CHY8PXoRJcn/EdhfBCf9m0rmhCSAJZBMQEpLct8csKD03n1DXtJEYQM3eeTbLxD8QHZLHcKKHja7i2aYoWdFsutgxQWsLAEISn/1nZb8gzF9IGeSs/BoXWF/kP7MwEL1ht4szIbNPnQHX8k1IdoLOB+jvcJQsYFcUTCXpMzJ03rUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HVYoCG8YmVSHrOFzhqytWgLWvM2wgZyVdW2KcEFDVao=; b=mFEVxv6t5rrI6prihf4v7Zc8sqbyE3g/E3/6eGTB6CZAw/wV1j2qABe9DsL+BWSDnuiNcM0tNz0BaSSW4XyzAfHRZOi3nEywsLfYym+SNHF8Oc1IaLI9HM1BD0Co754Vb/YGQT7MqLFgcYzXrbOSs7IPc8jGVwPxE9uYutwBrnInQsUjBZbNI8oJUF5L2C7x+1X5CREzG1fedHYrKQ2+KU1SkQahtsj7ASgKB1ds1tfIZE8qrjcdMmlTr27T4tMHZTGYIowkPJT03N8+Otx1AY42LqQHZLkymfo9/6qSSpYd1wPd0GqEdPzyaCindJAU5FGEs116A0IyarC6ndVkLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.infradead.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HVYoCG8YmVSHrOFzhqytWgLWvM2wgZyVdW2KcEFDVao=; b=AnitAy7jvvPVH1kxY3ZYONT+FbFn4F35NTcoy5t6YI8t28pqc4S8QnEyJvxG/byFrnKf9Y39EPTtd+G5cXREPjbSjB1ydpyPeLv6w+SYNAvamHJ5WduG+Gp8VLyO6BVhU5UbqSvbW28P7eMi2eJkro5CaoHRo4aDo11Xtp+dsHc= Received: from DU2PR04CA0299.eurprd04.prod.outlook.com (2603:10a6:10:28c::34) by VI1PR08MB4224.eurprd08.prod.outlook.com (2603:10a6:803:bc::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.12; Tue, 25 Jan 2022 15:09:53 +0000 Received: from DB5EUR03FT020.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:28c:cafe::5c) by DU2PR04CA0299.outlook.office365.com (2603:10a6:10:28c::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.19 via Frontend Transport; Tue, 25 Jan 2022 15:09:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; Received: from nebula.arm.com (40.67.248.234) by DB5EUR03FT020.mail.protection.outlook.com (10.152.20.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4909.7 via Frontend Transport; Tue, 25 Jan 2022 15:09:53 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Tue, 25 Jan 2022 15:09:27 +0000 Received: from e124191.cambridge.arm.com (10.1.197.45) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.20 via Frontend Transport; Tue, 25 Jan 2022 15:09:27 +0000 From: Joey Gouly To: CC: , , , , Subject: [PATCH v1 6/7] kselftest/arm64: mte: add test type enum Date: Tue, 25 Jan 2022 15:09:19 +0000 Message-ID: <20220125150920.23955-7-joey.gouly@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220125150920.23955-1-joey.gouly@arm.com> References: <20220125150920.23955-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 0b5cb7fc-6402-42d3-82a0-08d9e014c3f2 X-MS-TrafficTypeDiagnostic: VI1PR08MB4224:EE_|DB5EUR03FT037:EE_|PA4PR08MB7482:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: EBLO+hRzh50gxSV+2LDh6r3HBUgi2p2Z3nCC9eM3crISXep+jya5MZBZiasQRiH0oJx8Vyi0iF6cf6d/IPVYDvkJNj3fijGK88IesOImFhxZ2x78c3+efViG17ouEANY7NszpkFfu0YsbuN/v3HafOSS0SjmhgG+Pj4O9Lq6vMp1dhoN6bCVtD7aOL1Jf4WEv1UQlAKbt7XeXM31F1YG6XlTjk0mH0BR15H81/c1pMhtCct+UQcMOpKsSeRv2+zYmtaIXJNkfjp3w8H6uK7jMHlHSXDaMS7A2QaB4rVZY0bh7LZ0MoFcbID7tOVFAvvuzUt7cYgtwBfjYehzcCVrnoXEZH/s9o/SIIuJ4nxpXGypw/L/MAr7fyDWA+7qcMe0jKZf/KH3b+tB8at8gfJ+eAr3sUT2NHq23tLpI7TykwMYtt61KsriepVVbhPiiekoC9acHIg4yofH+0lL7EOTwvpUnesvNMsm6NGDjkWmv7aHVw+KRdaXUu59laxmHHSjvxIdnR6+0PB9vPYGMlCoTET48uvQtUCIxgVSyBAVF021w6ljdaLPfDJP/AlPqAKvXNGTfiu5lXYutaBCfCzeoiM1psb+RNIGSTHf8D4H8I/ohyYgTNiLaxXcHpWmb0iFGAhl7Mn+KVu8+A13bKcPUiOCjAEImgT/4oQSNjJw/VY43bA6UbPZGTkzNMRpmMa+ENHYyaheZYI64cXyHbUmeC2Rk9jDe9wBDyXTv4oeJxSxMvJMnzwZ31+tPzycnuMl4R1fn/cx45cJvZ5hPfA8IHa/5olm4jRMp+dOAxz+h2o= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(40470700004)(47076005)(6666004)(44832011)(86362001)(70206006)(336012)(70586007)(508600001)(2616005)(8676002)(426003)(4326008)(8936002)(6916009)(83380400001)(1076003)(7696005)(40460700003)(186003)(26005)(36756003)(5660300002)(82310400004)(81166007)(2906002)(36860700001)(54906003)(356005)(316002)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4224 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT037.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 816d7d25-d5ab-4778-1865-08d9e014bd6d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LCuuRcv2KGL2BPPG1VPmt1tnM8gESKDYdAUveSYRy0fVODaWWCbNjBmL90JJaK0qKp7R8jxB6eDIg9YMSRFlzbNBnBTp5efojrDDPXZuZE2AfX94//Cvju3oDTXV44plw/3vEUVG2q3NIQFLOpFrU9UG3zf3QK5Se7Fzq32Yb4NUBY2IrHVSPfDKj3or6/kf9QvM+P9BEJeWEZpvGwoy2w7UGyRHMC1zdx+8/9daGURC9sMNn7u2gORTA+uQ/YY+JMQP1Jd1JjJUaLhmNToMZtlHb88OpF3T0SkzNKiZzHUMXDde9KNWSRBGdhIDPEMJ+7IGr1G4VUyOGQoisO1MMtEcMUFSrzwR7BNawFjTgqCx7mEd2W4KaenA7GbYtfhOKgUOmlTOFRoOIUY5UJ+w8az+AAHddRWJmFOhJH/izRtAqPw7747e/gnQB9RapuEMT38DIcchwIgVJ6dZnFUks/hQeKQiGht9+gua8JdvDBt22zqIUHRh9FwwoNoM5d1b8f/PQGqfk6vN964QWhKmYO1Jhtx8IowRaJFwBBhsV2Q9rdWoxU06XigcqywXkenZKNuJuOoPxvoLtwq6VSejOH/qGVO58KS8aHC7ZodQPAOIW+oQ9QBZqjtCBUPI34zegx9Oz4elxWkMkylBqJ0To9TEVqJXX9S3mJL2TtRiY/Zu7HBvJTkx/pS47g9yLhpOnL/IFUBZanSpx+ftC2CZvpIvBow2W34AIDyRZPC8HFC+jL1rD/q0AGOZtV1gRdvgUcmrH92PvlcchWytIoHWzQ== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(36840700001)(40470700004)(46966006)(426003)(4326008)(8936002)(83380400001)(47076005)(44832011)(1076003)(36756003)(36860700001)(70206006)(40460700003)(82310400004)(6666004)(107886003)(86362001)(6916009)(186003)(336012)(508600001)(2906002)(7696005)(2616005)(5660300002)(54906003)(26005)(81166007)(70586007)(316002)(8676002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2022 15:10:04.0964 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0b5cb7fc-6402-42d3-82a0-08d9e014c3f2 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT037.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7482 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220125_071008_040429_092CCC6C X-CRM114-Status: GOOD ( 15.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This enum will be used to parameterise the test to perform other syscalls than 'read'. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- .../selftests/arm64/mte/check_user_mem.c | 83 +++++++++++-------- 1 file changed, 50 insertions(+), 33 deletions(-) diff --git a/tools/testing/selftests/arm64/mte/check_user_mem.c b/tools/testing/selftests/arm64/mte/check_user_mem.c index 8b1b586f3df8..d104feab4e86 100644 --- a/tools/testing/selftests/arm64/mte/check_user_mem.c +++ b/tools/testing/selftests/arm64/mte/check_user_mem.c @@ -19,12 +19,18 @@ static size_t page_sz; +enum test_type { + READ_TEST, + LAST_TEST, +}; + static int check_usermem_access_fault_helper(int mem_type, int mode, int mapping, - int tag_offset, int tag_len) + int tag_offset, int tag_len, + enum test_type test_type) { int fd, i, err; char val = 'A'; - size_t len, read_len; + ssize_t len, syscall_len; void *ptr, *ptr_next; int fileoff, ptroff, size; int sizes[] = {1, 2, 3, 8, 16, 32, 4096}; @@ -46,9 +52,9 @@ static int check_usermem_access_fault_helper(int mem_type, int mode, int mapping } mte_initialize_current_context(mode, (uintptr_t)ptr, len); /* Copy from file into buffer with valid tag */ - read_len = read(fd, ptr, len); + syscall_len = read(fd, ptr, len); mte_wait_after_trig(); - if (cur_mte_cxt.fault_valid || read_len < len) { + if (cur_mte_cxt.fault_valid || syscall_len < len) { err = KSFT_FAIL; goto usermem_acc_err; } @@ -73,8 +79,16 @@ static int check_usermem_access_fault_helper(int mem_type, int mode, int mapping for (i = 0; i < ARRAY_SIZE(sizes); i++) { size = sizes[i]; lseek(fd, 0, 0); - /* Copy from file into buffer with invalid tag */ - read_len = read(fd, ptr + ptroff, size); + + /* perform file operation on buffer with invalid tag */ + switch (test_type) { + case READ_TEST: + syscall_len = read(fd, ptr + ptroff, size); + break; + case LAST_TEST: + goto usermem_acc_err; + } + mte_wait_after_trig(); /* * Accessing user memory in kernel with invalid tag should fail in sync @@ -85,9 +99,9 @@ static int check_usermem_access_fault_helper(int mem_type, int mode, int mapping err = KSFT_FAIL; goto usermem_acc_err; } - if (mode == MTE_SYNC_ERR && read_len < len) { + if (mode == MTE_SYNC_ERR && syscall_len < len) { /* test passed */ - } else if (mode == MTE_ASYNC_ERR && read_len == size) { + } else if (mode == MTE_ASYNC_ERR && syscall_len == size) { /* test passed */ } else { err = KSFT_FAIL; @@ -103,14 +117,15 @@ static int check_usermem_access_fault_helper(int mem_type, int mode, int mapping } static int check_usermem_access_fault(int mem_type, int mode, int mapping, - int tag_offset) { + int tag_offset, enum test_type test_type) { return check_usermem_access_fault_helper(mem_type, mode, mapping, - tag_offset, 0); + tag_offset, 0, test_type); } int main(int argc, char *argv[]) { int err; + int t; page_sz = getpagesize(); if (!page_sz) { @@ -127,29 +142,31 @@ int main(int argc, char *argv[]) /* Set test plan */ ksft_set_plan(9); - evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_SYNC_ERR, MAP_PRIVATE, page_sz), - "Check memory access from kernel in sync mode, private mapping and mmap memory (tag_offset: page_sz)\n"); - evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_SYNC_ERR, MAP_SHARED, page_sz), - "Check memory access from kernel in sync mode, shared mapping and mmap memory (tag_offset: page_sz)\n"); - - evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_ASYNC_ERR, MAP_PRIVATE, page_sz), - "Check memory access from kernel in async mode, private mapping and mmap memory (tag_offset: page_sz)\n"); - evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_ASYNC_ERR, MAP_SHARED, page_sz), - "Check memory access from kernel in async mode, shared mapping and mmap memory (tag_offset: page_sz)\n"); - - evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_SYNC_ERR, MAP_PRIVATE, MT_GRANULE_SIZE), - "Check memory access from kernel in sync mode, private mapping and mmap memory (tag_offset: MT_GRANULE_SIZE)\n"); - evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_SYNC_ERR, MAP_SHARED, MT_GRANULE_SIZE), - "Check memory access from kernel in sync mode, shared mapping and mmap memory (tag_offset: MT_GRANULE_SIZE)\n"); - - evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_ASYNC_ERR, MAP_PRIVATE, MT_GRANULE_SIZE), - "Check memory access from kernel in async mode, private mapping and mmap memory (tag_offset: MT_GRANULE_SIZE)\n"); - evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_ASYNC_ERR, MAP_SHARED, MT_GRANULE_SIZE), - "Check memory access from kernel in async mode, shared mapping and mmap memory (tag_offset: MT_GRANULE_SIZE)\n"); - - // In this test, the tag only covers MT_GRANULE_SIZE. - evaluate_test(check_usermem_access_fault_helper(USE_MMAP, MTE_SYNC_ERR, MAP_PRIVATE, MT_GRANULE_SIZE, MT_GRANULE_SIZE), - "Check memory access from kernel in sync mode, private mapping and mmap memory (tag_offset: MT_GRANULE_SIZE, tag_len: MT_GRANULE_SIZE)\n"); + for (t = 0; t < LAST_TEST; t++) { + evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_SYNC_ERR, MAP_PRIVATE, page_sz, t), + "Check memory access from kernel in sync mode, private mapping and mmap memory (tag_offset: page_sz)\n"); + evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_SYNC_ERR, MAP_SHARED, page_sz, t), + "Check memory access from kernel in sync mode, shared mapping and mmap memory (tag_offset: page_sz)\n"); + + evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_ASYNC_ERR, MAP_PRIVATE, page_sz, t), + "Check memory access from kernel in async mode, private mapping and mmap memory (tag_offset: page_sz)\n"); + evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_ASYNC_ERR, MAP_SHARED, page_sz, t), + "Check memory access from kernel in async mode, shared mapping and mmap memory (tag_offset: page_sz)\n"); + + evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_SYNC_ERR, MAP_PRIVATE, MT_GRANULE_SIZE, t), + "Check memory access from kernel in sync mode, private mapping and mmap memory (tag_offset: MT_GRANULE_SIZE)\n"); + evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_SYNC_ERR, MAP_SHARED, MT_GRANULE_SIZE, t), + "Check memory access from kernel in sync mode, shared mapping and mmap memory (tag_offset: MT_GRANULE_SIZE)\n"); + + evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_ASYNC_ERR, MAP_PRIVATE, MT_GRANULE_SIZE, t), + "Check memory access from kernel in async mode, private mapping and mmap memory (tag_offset: MT_GRANULE_SIZE)\n"); + evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_ASYNC_ERR, MAP_SHARED, MT_GRANULE_SIZE, t), + "Check memory access from kernel in async mode, shared mapping and mmap memory (tag_offset: MT_GRANULE_SIZE)\n"); + + // In this test, the tag only covers MT_GRANULE_SIZE. + evaluate_test(check_usermem_access_fault_helper(USE_MMAP, MTE_SYNC_ERR, MAP_PRIVATE, MT_GRANULE_SIZE, MT_GRANULE_SIZE, t), + "Check memory access from kernel in sync mode, private mapping and mmap memory (tag_offset: MT_GRANULE_SIZE, tag_len: MT_GRANULE_SIZE)\n"); + } mte_restore_setup(); ksft_print_cnts();