From patchwork Wed Feb 9 15:22:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 12740385 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 CC613C433F5 for ; Wed, 9 Feb 2022 15:27:53 +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=EC2AL37AfVBHB2HoIv0BQhgwp/NrN4G7+EjXM8i4r4w=; b=KAZB1/OWakRsIc DgaZTzw+QAlBcaBA3PCr03L3RvYnUCjfNlSQq6VE7gxamEbTQVwi+kIPCy0ntViUQQ6aCvNZKiflD +2lcBSbyOA1Bmu9TPiZwZimSLtcJDNE4Q8jI6f0Zash5UAyhLTZfx3P7VxfgNXZb4/6oqhgLNnwFK aiJv/f1dJsQyGMk9JObL3EBw4z6iThk+5Y+761ZLrWYLma3SRcEFyaj0ZuYHkXd4AAs9FihrBm3ot Od1Gelz/uNCDBGFEhVBQykcFrbBtZGrKb02/rj/PHFzF5yILcvjXhytvBwSwBpx7Yr/cjzKlfoJv8 HN/uTtku1ZP/sXsmx/iw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nHor3-000Z8y-Jw; Wed, 09 Feb 2022 15:26:02 +0000 Received: from mail-ve1eur02on061d.outbound.protection.outlook.com ([2a01:111:f400:fe06::61d] helo=EUR02-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nHooe-000YJA-Gi for linux-arm-kernel@lists.infradead.org; Wed, 09 Feb 2022 15:23:34 +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=vBWkP3xTDqEI9nZFAGoaqV6fBxjZyDpGtlpDd0o4wHg=; b=rJuu4RIa7MnnraHG6gJzRLPMmNfl2Ad3QTXW8cZiikWbousyWghwHRAcXjK7e4GprlBcH1oA4Z6nYWEm69D4QM8XuqqpzP8Vnqar+G7wZtOXReGh1ofRsan2tcIOHGSSEMSgH8xHt0F56pnWETyjjaRGQZ/nK29tSJ602iJZJ14= Received: from AM6P193CA0094.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:88::35) by AM8PR08MB5796.eurprd08.prod.outlook.com (2603:10a6:20b:1d1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Wed, 9 Feb 2022 15:23:23 +0000 Received: from VE1EUR03FT034.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:88:cafe::71) by AM6P193CA0094.outlook.office365.com (2603:10a6:209:88::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.12 via Frontend Transport; Wed, 9 Feb 2022 15:23:22 +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 VE1EUR03FT034.mail.protection.outlook.com (10.152.18.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.12 via Frontend Transport; Wed, 9 Feb 2022 15:23:22 +0000 Received: ("Tessian outbound 63bb5eb69ee8:v113"); Wed, 09 Feb 2022 15:23:22 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 797637f393daa84b X-CR-MTA-TID: 64aa7808 Received: from 75e4919ea095.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A75D58E6-37C5-4AEC-ADFA-5EF4F6699137.1; Wed, 09 Feb 2022 15:23:15 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 75e4919ea095.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 09 Feb 2022 15:23:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j9NQ6gm+yEc0d7UI8fdaiothQiRlvwanVPtl5vDHcvdOE/XAiCf/r1KbwCwH+jSBVmbLpJ1l75TWHfHq8dt0ovahqt3CCGlWcQKx7hEpF4z99I2xsoyKEufwS3p7Ffrlaqb3Rso7Ri/2aVZpggVN0ln3URMgyApAhSxUWnzT0gXiYQvIp8ST9h7fk9RIOBtDp9oLSFi+Dg6yqw3pOhJEiW2yug63DRLGM9+GEnNGSRgBQIwhQAgOVJwYb9Dy4EYbPkrypI0w7oMhja5mZtbQHxW1xyEcnyiBgdEs9i1/DqkNjjoe/wFAYMI7uHfQc0awUBGYiaE+rdWXl4UfudkISQ== 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=vBWkP3xTDqEI9nZFAGoaqV6fBxjZyDpGtlpDd0o4wHg=; b=KH/5VEqNn+O1TV/fVK1wH87LfUO++JmueX588e5pTcndEAvhrP2Nzad7C/dc6FRPrGd7GoMdOBV7oJ+XPhGpzIgGqMxb6WABhaXftC1GjbMDrwfA1E8FRRGHnKO1vEl9/bgQfqn196kTZ/YQZls0tJitDOtHcxl6Ey1OYG0/xUmscNudfTcAj94wR35TV9nqxC4PEU3R1lUq7H5GCFfOE7ZdqIIERQ9ARfTggtLAX5lX0WturguRqs/NGYTtSw5BnTaYzzkLEO0anQtsXga0hT+UkuAmUe/omkXPnnP3lXBWTzl0MHDCB8SSpwzTk3rE6taXAPnIjvr4Rp0+hlVopQ== 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=vBWkP3xTDqEI9nZFAGoaqV6fBxjZyDpGtlpDd0o4wHg=; b=rJuu4RIa7MnnraHG6gJzRLPMmNfl2Ad3QTXW8cZiikWbousyWghwHRAcXjK7e4GprlBcH1oA4Z6nYWEm69D4QM8XuqqpzP8Vnqar+G7wZtOXReGh1ofRsan2tcIOHGSSEMSgH8xHt0F56pnWETyjjaRGQZ/nK29tSJ602iJZJ14= Received: from AM6P194CA0038.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:84::15) by DB9PR08MB7219.eurprd08.prod.outlook.com (2603:10a6:10:2be::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.12; Wed, 9 Feb 2022 15:23:13 +0000 Received: from AM5EUR03FT022.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:84:cafe::bd) by AM6P194CA0038.outlook.office365.com (2603:10a6:209:84::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.12 via Frontend Transport; Wed, 9 Feb 2022 15:23:13 +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 AM5EUR03FT022.mail.protection.outlook.com (10.152.16.79) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4951.12 via Frontend Transport; Wed, 9 Feb 2022 15:23:13 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 9 Feb 2022 15:22:50 +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; Wed, 9 Feb 2022 15:22:50 +0000 From: Joey Gouly To: CC: , , , , , , , Subject: [PATCH v3 5/6] kselftest/arm64: mte: user_mem: add more test types Date: Wed, 9 Feb 2022 15:22:39 +0000 Message-ID: <20220209152240.52788-6-joey.gouly@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220209152240.52788-1-joey.gouly@arm.com> References: <20220209152240.52788-1-joey.gouly@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: d8e714ef-6489-4167-b164-08d9ebe01c38 X-MS-TrafficTypeDiagnostic: DB9PR08MB7219:EE_|VE1EUR03FT034:EE_|AM8PR08MB5796:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:3044;OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: mEJayZ/8YA66+sLfsjUZOCL649PGRprNRJ8fMzYIYkonVSqiyGu9yzFUqtwwMXCsVETqljsZ1Q0SZqMdC+YRoMOFJA4EDo02incDFjNT0jZlhjYTa9QKeCoD6rR0/pWcPx/T0+f8u3uv6dccd9ut0QrXkIF1jmd4HAyrZrKddBOXQ6hSfyPs+M5VXvPr6NmTPoLf7zNVZR0K0yaOlQRno2xNhvIpHaQxbmKc9gJ5XMUvDuvcdTxetwm09VUHhsfWlqS+oRRFIO6U4mslixTPLYU4KnulSb8WHv5cYD5IME/MG/G93wIOTNAfM4R6sFxQzXRBmG/zX7jtxeq7Rm8iGKS3NiQLrcyAHUxLMckE6nzHFj5SAIU9nGsKSdZxxTfpOpw4to+YodSF+sDe37cRi26VOiuwO/cqb/XIYWfcBwugTqpDdXvTcnqDyWenD81JP8XvbppIvIfjbVtL8BMg2lhL+6HFrZ4qv+8EgS9NMqwWjoC57C/HXLs6zhIG2vFYOCP2x0JhF//f/kwnI4VsJvVaGksOTipiNdv8dcI2VPUp4fQ4N8b9LsXCnh7tInTJzHWhk2X7JiPN3ISugVVYrQNPIDs3pRMpklcdCoKlx7BGKVxgvWV5MBe9KDmP9dASKfmpjBIhowauhDP7IpLaO9FOINwMKHPWvms9ki7U18LixdAa3GUXz11DaTQDhhCTWO+O6TFNPrNLwKYKoE9pjA== 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:(13230001)(4636009)(36840700001)(46966006)(40470700004)(2616005)(356005)(36756003)(40460700003)(508600001)(8936002)(4326008)(70586007)(5660300002)(83380400001)(1076003)(47076005)(26005)(8676002)(81166007)(36860700001)(6916009)(44832011)(70206006)(186003)(82310400004)(426003)(336012)(7696005)(86362001)(316002)(54906003)(2906002)(6666004)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB7219 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT034.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: a838568f-9ebb-4d85-aaa4-08d9ebe016d5 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UT/UUoNR879GhAZdW999CNI2R4ufzcnk6Znd61WfPQfG3KvIj85fiyQuCM/RPWGeaGxJrK6RRTr9HLG31Mo7POtF90XQ3mLzfD27fIqgiRAh1yvb/XTwTeFWkIOY8GgbncESnDxU1uKBchE7p0l6hbkwwwG38gbCLLJie+tYXncSAcOzd+1sR8uNreZ1yFUqw9aVR/Xq1oPeHMaXpEMkFWXD3sx8bXx1KVODKNeaQ7WRd9DSlbMLAo0gKw34ElV2QooLUlhJm/8VgUnTRa3bRj9QKzM28J+JC1jDP+dO+IajYPds2VfyJbyVIW9ZBX/K4r519Qieivu6SeXhlGE/c91kyaM204A4iD5KYyk5B5HExzZInlK5xbtG18hZzYz0qQ10gMQ36RJfKl+NF7GjZDiKrIwe4RVss00JngUXl35tfsIeYGUCfQPz3Wm4LoMShu1W77MttcDuPVBATP5o36MB+pci+43Qose+x5b6DnE2hfQCOnylJFt3NmO5tWYC7jcvItCHYXg2x12dQXGQWbUI4/Xge0JleYJjb8doq1VQB4mhtbO9ciuRqsE9vvkJg49B/KjLVv6or0ClR3AdnFsuDwXD4MUEVHH4gMyjhe/tLqSnmBE8Rx0Ytwb2lCev6jcNtCZlbPbtb8vyWR22jNtv5SdobOKhAr+HQ/YFZbI= 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:(13230001)(4636009)(46966006)(36840700001)(40470700004)(1076003)(7696005)(107886003)(186003)(2616005)(6666004)(26005)(83380400001)(36860700001)(47076005)(82310400004)(44832011)(2906002)(8936002)(5660300002)(40460700003)(336012)(426003)(70206006)(70586007)(316002)(508600001)(8676002)(4326008)(54906003)(81166007)(86362001)(36756003)(6916009); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2022 15:23:22.7377 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d8e714ef-6489-4167-b164-08d9ebe01c38 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: VE1EUR03FT034.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB5796 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220209_072332_601314_9B56FDD6 X-CRM114-Status: UNSURE ( 9.78 ) X-CRM114-Notice: Please train this message. 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 To expand the test coverage for MTE tags in userspace memory, also perform the test with `write`, `readv` and `writev` syscalls. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Cc: Mark Brown Cc: Shuah Khan Reviewed-by: Mark Brown Tested-by: Mark Brown Reviewed-by: Shuah Khan Reviewed-by: Catalin Marinas --- .../selftests/arm64/mte/check_user_mem.c | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tools/testing/selftests/arm64/mte/check_user_mem.c b/tools/testing/selftests/arm64/mte/check_user_mem.c index 58b1b272ca80..bb4974c437f8 100644 --- a/tools/testing/selftests/arm64/mte/check_user_mem.c +++ b/tools/testing/selftests/arm64/mte/check_user_mem.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include "kselftest.h" @@ -21,6 +22,9 @@ static size_t page_sz; enum test_type { READ_TEST, + WRITE_TEST, + READV_TEST, + WRITEV_TEST, LAST_TEST, }; @@ -81,6 +85,23 @@ static int check_usermem_access_fault(int mem_type, int mode, int mapping, case READ_TEST: syscall_len = read(fd, ptr + ptroff, size); break; + case WRITE_TEST: + syscall_len = write(fd, ptr + ptroff, size); + break; + case READV_TEST: { + struct iovec iov[1]; + iov[0].iov_base = ptr + ptroff; + iov[0].iov_len = size; + syscall_len = readv(fd, iov, 1); + break; + } + case WRITEV_TEST: { + struct iovec iov[1]; + iov[0].iov_base = ptr + ptroff; + iov[0].iov_len = size; + syscall_len = writev(fd, iov, 1); + break; + } case LAST_TEST: goto usermem_acc_err; }