From patchwork Tue Jan 25 15:09:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 12723951 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 94BF5C433F5 for ; Tue, 25 Jan 2022 15:21:58 +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=SIU8NaMAk4CCBmIPHLke8dxB+sW90eraJv28NrSbCwk=; b=Kn0TN3ax/6F81y 9dHndKK/hfqn5ZsT8Y11F6mKioqltFicBOF10wbBVYYTrHxiiqb/pjHccoU/pa7bv+OEPa8o1cR5p 1QIFSqO4aKUZlOUy+elY1aijhY5SjL8oOqt+2Q/WLNJWRnG2Jic80eevQrQ10AbyzQ8Z1H+fY0gU/ +38K/NR9Njw4UI/k5WfYQao2/m1TqKUKizEjHb/FUSXoKTvLZZHqWZbswA3mLGOkE6oaOQi3nKpsg zVsALdxrfPLn2KartwVbmqU9yyz6j60L8fJc+JLMzUOE5jxBU8nLpTuFBg1EiFgS2Q6dmSCFmoOKN Y7UB/tVzpPOy/C5aU6fA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCNbg-008LYl-8K; Tue, 25 Jan 2022 15:19:43 +0000 Received: from mail-vi1eur05on2089.outbound.protection.outlook.com ([40.107.21.89] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCNS6-008IEk-6Q for linux-arm-kernel@lists.infradead.org; Tue, 25 Jan 2022 15:09:50 +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=QMJi8uFYymIM0ARGNVOUAIiG3Ms/PzE0TW/+HYIpYBs=; b=MbUnm5VkLjIuVb2c3u7ZBbNWi3NJIM12NNlyQbgmZPoaN2W3QFpK2ycLa0mmHdcWaqgrYCLvHgCtChNs0aiO11RqQV5iTR0pCSxr94aIar3OQf6bwkYDszll1LwaieqDg1QEXkIr/i6VR4to+4OSc3HyTZngcorgI7pLK44gen4= Received: from AS9PR06CA0113.eurprd06.prod.outlook.com (2603:10a6:20b:465::30) by VE1PR08MB5008.eurprd08.prod.outlook.com (2603:10a6:803:116::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.10; Tue, 25 Jan 2022 15:09:39 +0000 Received: from AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:465:cafe::c8) by AS9PR06CA0113.outlook.office365.com (2603:10a6:20b:465::30) 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:09:39 +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 AM5EUR03FT059.mail.protection.outlook.com (10.152.17.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.12 via Frontend Transport; Tue, 25 Jan 2022 15:09:39 +0000 Received: ("Tessian outbound 826a6d8e58c3:v113"); Tue, 25 Jan 2022 15:09:39 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 4fee606afc5c5ef6 X-CR-MTA-TID: 64aa7808 Received: from 9455f8ba51a7.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id BCB709F7-E19D-419F-A7E5-641DEFD696BA.1; Tue, 25 Jan 2022 15:09:32 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9455f8ba51a7.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 25 Jan 2022 15:09:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AEZMCP8EJx1M9XbaqP8wpfYVzYR47s0kmKCeReD5fv24XPqYuEC466N/yy3/Mht5ngCqjXXQBtSZwi7AYFf1jM6dv7zC5LpXAlvDNHcLskU8mE/KZiBdNqiwpwRT9PIGMU/Zo1MLC+u7jtB7/6XrSdtpj3VrkyXXZ+s3LsFOp+nEMA3vSeutB7xUJZEG1muRtKXCTEG3AnSNM4tkASmD3XNiDQ2oUDB8KUI1q16E3XhksFTmQxoMUxz2Pleb12z6vpOhMMlOazDxs1SFPID0PHWuo34/E62lepPnVUrIufjJzPwlG3Jk5PVsZ5xtLl/Mv12h26Rzekgtflm+BwnQeQ== 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=QMJi8uFYymIM0ARGNVOUAIiG3Ms/PzE0TW/+HYIpYBs=; b=Nhqu+amQrYIYtXlQOsgr7+CM7H15CvqxoaafC0wobBfGiNDUfUT7vjIXMbvmME3U5FpCCuv564/9HOpxlrfABMsUWBD4+1G2cmG3NlWii9/KU0de3L6T3rUwxFKsnZDjPYrZDVtS1SKz0C623uSCJtrx5axYTLROPsu5dgJr6CvKIleJccKw7JB6M33KtACWZcDWBz5/DaVhl0vbpyeqpaL5EJqmFrTWqc/+uIYnOI2dSWF+FzZ3hovYVh637rxR5PGqGO/dmw5blIL+MNk5U05RdHzYg+6cQCJ+mHjSuSJW42nfxjpgPIunghllOVtOrreArMRm7JIeG/O3phvWQw== 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=QMJi8uFYymIM0ARGNVOUAIiG3Ms/PzE0TW/+HYIpYBs=; b=MbUnm5VkLjIuVb2c3u7ZBbNWi3NJIM12NNlyQbgmZPoaN2W3QFpK2ycLa0mmHdcWaqgrYCLvHgCtChNs0aiO11RqQV5iTR0pCSxr94aIar3OQf6bwkYDszll1LwaieqDg1QEXkIr/i6VR4to+4OSc3HyTZngcorgI7pLK44gen4= Received: from DB8PR06CA0064.eurprd06.prod.outlook.com (2603:10a6:10:120::38) by DB8PR08MB5113.eurprd08.prod.outlook.com (2603:10a6:10:e1::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.10; Tue, 25 Jan 2022 15:09:30 +0000 Received: from DB5EUR03FT033.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:120:cafe::e2) by DB8PR06CA0064.outlook.office365.com (2603:10a6:10:120::38) 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:09:30 +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 DB5EUR03FT033.mail.protection.outlook.com (10.152.20.76) 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:30 +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:26 +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:25 +0000 From: Joey Gouly To: CC: , , , , Subject: [PATCH v1 1/7] kselftest/arm64: mte: user_mem: introduce tag_offset and tag_len Date: Tue, 25 Jan 2022 15:09:14 +0000 Message-ID: <20220125150920.23955-2-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: d421a482-e423-482d-c2fe-08d9e014b559 X-MS-TrafficTypeDiagnostic: DB8PR08MB5113:EE_|AM5EUR03FT059:EE_|VE1PR08MB5008:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:2803;OLM:2803; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 5LmCF2hwMmv3d+WxbSlp+4/ALx3GkI9W2F7kFPfFaqvIRueWpzoD/J32TGW1dOugEFWVExgf1r2yT6SSmAoKyX750QLjYfdPP/Eao9r48okOY+MwV9SXPPybbezx1cD/K1I6i5fwEdI7gPbgg1T60HBhVgZNliOOX9pW3tTaABq/ufYDiCiqaUj6Xx+ZtLUWRiv8mnBtWDk0E7agCa5b4yl7crKvIdf0t4aikyIQBnrPZrBtdUPot/XLHVdU0klNOqukNoDd8RF5C6c1gH8Lil0leEQrDB1+dH5+F+gpscpQPAVYTECwc+XP3ZDE1oQn67WssGzkXlrnJh0PcEHyvPVSY6j/bMZ82m2Rv1tj1Ar26tXt8JwFefE0yM+Ccdi0uiHL9yf/bMAUknJwEcJ4tDtb/zXRWf+FukIMDhE+YrobmSufNDlqRCmXtUqtlTZx6zTwzjOgFocN5oXKT1vgIKPL2VcM9K3R/isY5p1jRMXXxzZnNK3BhWwVRFoEWzq5uvG0fo8vUPz9ACOxqggRZ+nlptVvGER+lXFr1qwZg4ChTaHqVE/weJEnO/r8T/mRzBEjDUZF0/SR45xKV3Sav/6lxplvD9G/fCw/+LO7/3Cdx+D/Tdn4/+4nqsEhg70aDu2iMQgNB5WQAI1EOuBXauwPzi93QAUcSPDjlbGn4zqbr4MW6p5+yXS6mTjhKwmLi6aNjaCrxU5fiCDfrvpk45alHbB41HIXKl8jVFB5qVJ1t/bB4rIB1+HT4qr6zOuovkt0XCp+u988e8oUJjQe3qqErWFGHytLaYhOFWReELs= 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)(40470700004)(46966006)(36840700001)(8676002)(336012)(40460700003)(6916009)(508600001)(2616005)(316002)(83380400001)(426003)(81166007)(6666004)(7696005)(356005)(82310400004)(86362001)(36756003)(2906002)(70586007)(186003)(70206006)(4326008)(54906003)(44832011)(36860700001)(26005)(1076003)(8936002)(47076005)(5660300002)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5113 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 7b0a0a27-2941-4322-6160-08d9e014b01e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M9kFeB0KFCEz2vq/v7ZkpfXk8yHQxXWdnS0fTu2p+XCGBAoAE36S6HVnLepHim2t7evy/soZWi1/nkjigs3Ft5H/qG6Au1J6VNYxkd8YIhjCkVqOPsBlf9V7mtq9216NJ1KpwRadXjIXnu45RDfAfNnN26AfXkaPK5Vdgrgf6RVxZum528FzL6fFRDLU+fXG9P6ZwO/RcJ2tqY5VAeWRgiUQ3MdOcMokYCjkSSGDF/RUHs7bS4Hi4CFWMNCBl9k9uOJXOfMZy/3h23jWVyIq8VHSiRujlPOdVeb1p/i34ERpzn3TwlAemqbArOxM5L47zfVBNCMRFNNYRfBWDYalz+TWOpSicyGedbsijBE4S5Rc7YW6thUqu+4CSNSqUr2pZMdgrL+Y9NIpUgtw41d6b17vag6hxCggw1i2RByPwuBH8SkI9zFfUq5C5ffsa+wGn0zenNHl5Bgr00jpCOsBeOZoEz89UId7ZrQVaxdXtvhsUV9yFziC6kQgl/A1vUG6eblDX+eenDLnqDlEQKQOQ04Kx/ZRPi4oML6QA4LwXaYSWVQauzHmV5bVrB7DmW5yCidsz4z6gMBiK9v1007S6zI1DBaVw38YDoYt2Ujyr9kz1ERioNIWDyCu78VijgMI++yzt1ATR31qMgglInS+CiMrYIlD+A1X0TFwPCuXA4W44geuyzVn5/K1wMZ8fASrNXKpjjm9v47NqQe7vcnjvqYSK+/xLghZ+XfgV1tTBkmF6a5n3Vkz7REbtMCBaJ1dMa9ffi5YV7BkEhhSmuuFqw== 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)(44832011)(82310400004)(2616005)(316002)(426003)(336012)(36756003)(70206006)(70586007)(26005)(186003)(86362001)(54906003)(40460700003)(5660300002)(1076003)(7696005)(47076005)(83380400001)(81166007)(2906002)(36860700001)(6916009)(6666004)(107886003)(4326008)(8676002)(8936002)(508600001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2022 15:09:39.5593 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d421a482-e423-482d-c2fe-08d9e014b559 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: AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5008 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220125_070946_352710_5E5CE965 X-CRM114-Status: GOOD ( 12.88 ) 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 These can be used to place a different tag not at a page size boundary. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- .../testing/selftests/arm64/mte/check_user_mem.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/arm64/mte/check_user_mem.c b/tools/testing/selftests/arm64/mte/check_user_mem.c index 1de7a0abd0ae..3ad9d85ca9b7 100644 --- a/tools/testing/selftests/arm64/mte/check_user_mem.c +++ b/tools/testing/selftests/arm64/mte/check_user_mem.c @@ -19,7 +19,8 @@ static size_t page_sz; -static int check_usermem_access_fault(int mem_type, int mode, int mapping) +static int check_usermem_access_fault_helper(int mem_type, int mode, int mapping, + int tag_offset, int tag_len) { int fd, i, err; char val = 'A'; @@ -54,10 +55,12 @@ static int check_usermem_access_fault(int mem_type, int mode, int mapping) if (i < len) goto usermem_acc_err; - /* Tag the next half of memory with different value */ - ptr_next = (void *)((unsigned long)ptr + page_sz); + if (!tag_len) + tag_len = len - tag_offset; + /* Tag a part of memory with different value */ + ptr_next = (void *)((unsigned long)ptr + tag_offset); ptr_next = mte_insert_new_tag(ptr_next); - mte_set_tag_address_range(ptr_next, page_sz); + mte_set_tag_address_range(ptr_next, tag_len); lseek(fd, 0, 0); /* Copy from file into buffer with invalid tag */ @@ -81,6 +84,10 @@ static int check_usermem_access_fault(int mem_type, int mode, int mapping) return err; } +static int check_usermem_access_fault(int mem_type, int mode, int mapping) { + return check_usermem_access_fault_helper(mem_type, mode, mapping, page_sz, 0); +} + int main(int argc, char *argv[]) { int err; From patchwork Tue Jan 25 15:09:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 12723950 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 DD083C433F5 for ; Tue, 25 Jan 2022 15:20:36 +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=8P7ALCAD75NI3Xc5wXDmp2ovJajT/n434R2KXccO2BM=; b=KH5plNtYntKMQi Spmr/KhBq8IIQCVsc+mLnDuqkhueEuwM5CXDeOAOZDAmRpDQmZx98kOMSUPIrBPJ8Oq1f9XR8/Nv7 t8tgeK8yFBdX8J5GhMJzU1cQsSVpHZeA/G79vvdJ4aKwnrQicAch2bv9uWKZoHghazsNhIXZOGLKi wANWVoCLrauUWEXh2aA7dOrSxLhhaM3DQyUIb4SqJB+clhjLCqIgfGyK5F73l/IwtoFn97YeP0uUJ d5e0+R9dlUYDggkkRkEG54OzGfIn5sYNkrSfxwNgPhbAw29heDe7EQdpzdGnA7JIN8XXpK/ULSWYZ tj6Rd/Q5gCWgWj4HaXMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCNaA-008L2p-Gs; Tue, 25 Jan 2022 15:18:10 +0000 Received: from mail-db8eur05on2042.outbound.protection.outlook.com ([40.107.20.42] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCNS5-008IDn-Qf for linux-arm-kernel@lists.infradead.org; Tue, 25 Jan 2022 15:09:48 +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=fH0ALn0ZZEkKk6aYHX4zlG/XoTruJ/raCMCZnzswGO0=; b=El3+nyGAvnSQu1CiawF33FzDDSN+omPChoC2LQd8NT1Rs9/CgHiMQbW1Zet4o4A7j2s308I5OCBzb+VlzGuxaRDVOV03eLP1ItLiaNJIfCMWM27fq6bwrEQtEbDEtjxxRMkVmbweKNJmwGVuMpxsBb05W3ID/K5vGaMZvcs0AgM= Received: from AM6PR10CA0104.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:8c::45) by AM0PR08MB3748.eurprd08.prod.outlook.com (2603:10a6:208:fb::25) 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:09:40 +0000 Received: from AM5EUR03FT049.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8c:cafe::68) by AM6PR10CA0104.outlook.office365.com (2603:10a6:209:8c::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15 via Frontend Transport; Tue, 25 Jan 2022 15:09:40 +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 AM5EUR03FT049.mail.protection.outlook.com (10.152.17.130) 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:09:40 +0000 Received: ("Tessian outbound 31aeb3346a45:v113"); Tue, 25 Jan 2022 15:09:40 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 0aacc08fbf5fbe91 X-CR-MTA-TID: 64aa7808 Received: from d1635c683cdd.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 48B6C361-A5B0-4DB5-B593-CA1559244E7C.1; Tue, 25 Jan 2022 15:09:33 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d1635c683cdd.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 25 Jan 2022 15:09:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l4ftz1MsRl5q8WOuMG1opdo/uzx3H+oljdPYlmkaKCrDU7yDQQGUanPVYsnifVHpucd+B/vRyS6c3PxDEBKQtKkUCiaDUmYgXmihelmZNdOOK8EF6mUH63B1S2OumKDJdQxHVfXiezfpuf/AF/bFTS4Coou3ro+kBlE6CyFwG99bhql7B0afJGfgehaMYWBjLNPa64fAG6VOyi7+GmLvIlXSAfD2bB3WKpV0Peer4SRBnwhoJ4aCdT21ZHL0rJC5NIJtHU7rrnw0G8/7mkb4t/HZEis9hSBSlZlX9RAYWXnuhPjuDIw9mmnTQsoGuYzWzblBFm3qb8peokpm/sKFXg== 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=fH0ALn0ZZEkKk6aYHX4zlG/XoTruJ/raCMCZnzswGO0=; b=KffeAxXfjNR4sRvpZtcWAorVtaleBNqM/DYkzI+uGDqf8pYhCc5MIFlIWVBXFO+XAVM+pQKJ9kouaWWTQQYLRpP5bLpJI3RCO57x9D7wpK46ywA3J/UhBL9UHyX3boB8QP5HAkXK4lGXRsTQraAvRJQ8/QSqV0fEogV46T042o9Wt77aQIg20GzD3Eauvy2G1gee/pvQ1rRUutKIM9lhlUXppoZQoerXKwoTqf/FjF/E+YxQhvfryvXi0rz2nv/1OYMUhWGLPvhKA+HjMq3Ip/JDqRDSdJyghUzG25CTlt3gXymN4hfILPTWa2JFTqLW6NSjz3oSDTB6SwV+VxO0Lw== 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=fH0ALn0ZZEkKk6aYHX4zlG/XoTruJ/raCMCZnzswGO0=; b=El3+nyGAvnSQu1CiawF33FzDDSN+omPChoC2LQd8NT1Rs9/CgHiMQbW1Zet4o4A7j2s308I5OCBzb+VlzGuxaRDVOV03eLP1ItLiaNJIfCMWM27fq6bwrEQtEbDEtjxxRMkVmbweKNJmwGVuMpxsBb05W3ID/K5vGaMZvcs0AgM= Received: from DB8PR06CA0040.eurprd06.prod.outlook.com (2603:10a6:10:120::14) by DB6PR0802MB2150.eurprd08.prod.outlook.com (2603:10a6:4:85::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.11; Tue, 25 Jan 2022 15:09:31 +0000 Received: from DB5EUR03FT033.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:120:cafe::12) by DB8PR06CA0040.outlook.office365.com (2603:10a6:10:120::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15 via Frontend Transport; Tue, 25 Jan 2022 15:09:31 +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 DB5EUR03FT033.mail.protection.outlook.com (10.152.20.76) 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:31 +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:26 +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:26 +0000 From: Joey Gouly To: CC: , , , , Subject: [PATCH v1 2/7] kselftest/arm64: mte: user_mem: add tests using tag_offset Date: Tue, 25 Jan 2022 15:09:15 +0000 Message-ID: <20220125150920.23955-3-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: a5dc1bac-f256-4f5d-9be1-08d9e014b5d3 X-MS-TrafficTypeDiagnostic: DB6PR0802MB2150:EE_|AM5EUR03FT049:EE_|AM0PR08MB3748: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: DDo3Io+K9G0hYbFBRDII0/viBJ7zBy9W2BJtXtWUYJgCjz4NixLeKzU8We5xoEOgmllkAzoD0kOjmjQNqPxUfNzndBDFotB+tZ1pD1plLdktJr3/y5LC6RLvKCVDWbV4eCt0Ej+OMZmrh+qo+7A+xyB1ZbQloSCjuqokyobfM/qGfSE080NJ/sI2nj1XEcHiUudWofFa2Evpi/oQgQSoaNFQQCTq+bdv0k/pv2MlxLJ9kw+y9Tvo4uR4Voz4yKCyRFxZSEfQfqbWXNH6Q6nNAHVxhN3DsLbeJGgnDKRqQJWjjAlog/4FuKVk+bZ8ChgsCsijDJys2eX3A6E8WfA9y7lt7BQb8d9nLp6KvdweqyCLLuVnm6nc9OVp10nNgZCTdvp20OHCvFma8Q/B86iQE/0L1hc8ulAOWKWWbrpPt9RuBV0rfq+h7etD6epDu+5D2xewXMouTC1CabXOkpU2JmUnmB8/QBA1j9HcwtEJcTQym0o9fuiyXfa2qv4/FPF3y4o0ty2rWWlbF9dA4iGz3Q45teTNDCiU68OLWf28unRkk7erW7ESKs7dP4/7TysIv6+HSXAhQWw0dy3vdq/W5AeauzaQuO49Eegfa7yJBG71Hp61m8z9h8I3tVuGBGFe0lv3zFTrV2KpgMle2AYtffeoAhKoRFQJSU+l/iGXTtlyiYEYiMgYH7xkJvSBzviK+oC+PYdFnesStKMbkVPU5hwoIdFdEPkFfSj8okeIsTmj8k19JSTWYgpQqX8e9PwOG2kYTl4zOiTEJCLE3SDVOtUOW4AAS3Jd3Q19Jc90SQA= 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)(40470700004)(36840700001)(46966006)(4326008)(36756003)(508600001)(82310400004)(86362001)(8936002)(6666004)(54906003)(7696005)(47076005)(70586007)(356005)(5660300002)(26005)(40460700003)(44832011)(81166007)(2906002)(8676002)(6916009)(2616005)(36860700001)(1076003)(186003)(426003)(70206006)(316002)(336012)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2150 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT049.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: b6230049-25e9-460a-58d5-08d9e014b09a X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TR7JiA0eXK95hMqMTk1eOcjPkMsUfATXWjCtx/7hYmu2OJ3R1515FASLC+3DGqqiZj4Ni79emxVjdcCMP2/j+gc1ycAX13RXctDb+BCYALExpHdojWDOXDfzrJe6kWTd0EQrK0ulRhy5/qo5YzRs+NAUHXT1wNu0H/gUb4+7dICrJ2RhVVibfbrfn1vmZDxXMGYYfw8lhXYVeN/zgBcwWu4LCgfUOWLUK0Be8wjgzJdc/rmVMNJBCFBg2gYTCZwW9Ez75WUURh5WcCpjxmF3UOPVANW0vfQk2SXkTRJxUY4SrtofMX07qf/rcHEZB2pGrT/GFa4yY0y0X8PrM8c9MlCHcLeKv2h6FlqGg0eRUO7tQdMyMj3wCeub+OW1puNcVvnnetCt4dIMW4a0OzheRx//lvuiZbB18S2eitIleOlpQ3HN4Y//plOu5ZZK9b83ZF3eZJEkgf64z5pjn0BO/LOtr6tReY78l4mRsTRCYaLCEOa/Mm7PYr6xurXarLKJktV0oSgFlV6U/ufn1ioPakqYJLeFDKjI4tzmNHcRqnRSVTvFg0WBmxeMAJ0hyH9+gQ90WBun2HHMogMZIyyHpMaXrQ2K5/Yc5S/rmwM3/VPxPWe4KqX7DFueCkLkSdjuqXMuMqgE9JoBv9K/1lFXhQ9/gSuExbehYeylpOnSAxMmmqX0dB6PrVECETCexUSVH5EedDtiTArMjxfaJEvPtBAtyCesRoxrJQxumRJvNKyCFHen102+UxxeepE+f96beQ4MXW2NaiPq6kxhiOU+5w== 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)(40470700004)(46966006)(36840700001)(36756003)(47076005)(7696005)(86362001)(6666004)(36860700001)(26005)(54906003)(107886003)(186003)(8936002)(5660300002)(1076003)(508600001)(82310400004)(70586007)(6916009)(44832011)(316002)(81166007)(83380400001)(40460700003)(2906002)(2616005)(70206006)(426003)(336012)(8676002)(4326008); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2022 15:09:40.3678 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5dc1bac-f256-4f5d-9be1-08d9e014b5d3 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: AM5EUR03FT049.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3748 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220125_070945_950185_8F25F8B5 X-CRM114-Status: GOOD ( 10.41 ) 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 Add some tests that place the different tag at MT_GRANULE_SIZE to check that less than a full page can also be read. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- .../selftests/arm64/mte/check_user_mem.c | 38 ++++++++++++------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/tools/testing/selftests/arm64/mte/check_user_mem.c b/tools/testing/selftests/arm64/mte/check_user_mem.c index 3ad9d85ca9b7..d33b262ccdb0 100644 --- a/tools/testing/selftests/arm64/mte/check_user_mem.c +++ b/tools/testing/selftests/arm64/mte/check_user_mem.c @@ -84,8 +84,10 @@ static int check_usermem_access_fault_helper(int mem_type, int mode, int mapping return err; } -static int check_usermem_access_fault(int mem_type, int mode, int mapping) { - return check_usermem_access_fault_helper(mem_type, mode, mapping, page_sz, 0); +static int check_usermem_access_fault(int mem_type, int mode, int mapping, + int tag_offset) { + return check_usermem_access_fault_helper(mem_type, mode, mapping, + tag_offset, 0); } int main(int argc, char *argv[]) @@ -105,17 +107,27 @@ int main(int argc, char *argv[]) mte_register_signal(SIGSEGV, mte_default_handler); /* Set test plan */ - ksft_set_plan(4); - - evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_SYNC_ERR, MAP_PRIVATE), - "Check memory access from kernel in sync mode, private mapping and mmap memory\n"); - evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_SYNC_ERR, MAP_SHARED), - "Check memory access from kernel in sync mode, shared mapping and mmap memory\n"); - - evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_ASYNC_ERR, MAP_PRIVATE), - "Check memory access from kernel in async mode, private mapping and mmap memory\n"); - evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_ASYNC_ERR, MAP_SHARED), - "Check memory access from kernel in async mode, shared mapping and mmap memory\n"); + ksft_set_plan(8); + + 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"); mte_restore_setup(); ksft_print_cnts(); From patchwork Tue Jan 25 15:09:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 12723949 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 0D3E1C433FE for ; Tue, 25 Jan 2022 15:19:07 +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=XJF3FhI63N22pXdq5V60WdkuKBYxbiYO7Jq3MaYZj2A=; b=pP1bGf8yckDrAU PbARC/K0PYZEHVyG63aF24Bh0cImqGA+4ycvE4eA5c+ssGstPrcbFBVm3oiPIDL/KGL0GSgi5nIW/ 9JrJYLJnUX0Oy6NImSbUIcr7vjdLXKHCy8kHE1A9WU6F6hDItjgMiwuZLdb2MQhd5OOyJoKCrYW+8 Oj5IZqetvpVEtB95HCV5FEBEIK8n6vEkkL8F3ODaL6x994z/WIQzM2s7cgm1pjMAWI2ZOZGIulRqE 48Fq+dy5n2+s0//RQozb2iFst8LnOMvnj0P3zbzeG7dtaq70UIZ9ycQVrHst1JUTJTuqeSxYpR2FG WYT7f5xhqFACVWpd3WzA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCNYn-008Kbe-Ij; Tue, 25 Jan 2022 15:16:43 +0000 Received: from mail-eopbgr60040.outbound.protection.outlook.com ([40.107.6.40] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCNS5-008IEe-Qy for linux-arm-kernel@lists.infradead.org; Tue, 25 Jan 2022 15:09:48 +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=67nT5bwAOjBc8AC+sVSr8dTrNVtH3lJmXHaTwlb4cq8=; b=0lfp7P9UEWGXvwVGkNcDRwESXsU/87W9iUEi45vbtRZS8d4KZFEH/+gpiy0i+MGpPTNWfubqkqV3EUIAPo1wTM5PYgI2PBvw/R08scqm+I8uwPN5O0wWVrQG2jzMRSo6pdpQfL4Sc0wpMqst1C/UJVzehZ2WPizL3NMIV31Trmw= Received: from AS9PR06CA0102.eurprd06.prod.outlook.com (2603:10a6:20b:465::19) by DB7PR08MB3050.eurprd08.prod.outlook.com (2603:10a6:5:22::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.11; Tue, 25 Jan 2022 15:09:37 +0000 Received: from AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:465:cafe::38) by AS9PR06CA0102.outlook.office365.com (2603:10a6:20b:465::19) 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:09:37 +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 AM5EUR03FT059.mail.protection.outlook.com (10.152.17.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.12 via Frontend Transport; Tue, 25 Jan 2022 15:09:37 +0000 Received: ("Tessian outbound 826a6d8e58c3:v113"); Tue, 25 Jan 2022 15:09:37 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: bf4f932cbbc22e55 X-CR-MTA-TID: 64aa7808 Received: from f6bf28d2becb.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E9645A30-EAD2-481D-A1A0-F6ACB2A75953.1; Tue, 25 Jan 2022 15:09:29 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f6bf28d2becb.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 25 Jan 2022 15:09:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ne48GyD2wkUdTGBPn7cp0mIt9ej57MxG69XQW6DUDbyp4l9BO7wcGQ9Iy/qVVtmAoGU3elzmPRHszi4jyquTW7cNDUxADUYFJeDvf2jtoegr0cOHnPS6WaOPbxwiqkjm4z2+3BmihuUtk/lycQ9p60wOm8p/dXgDfRAmBWztPPmHFikaB8n/ojxUFHj4eB9Xo/WsLwJ+MFy4/0W4DkGhQ3hjQUEL485cv3naMn3Z6RYOP/chrr2jqD8fOpN+g/7G5zjUbWGZ60bcS0JVMrpP67xSiDn1qsQHr5nssr9AZIyh0N/LuJhn5AJjajSmvaDYn71MEe8j3F9VzaBlF25HAg== 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=67nT5bwAOjBc8AC+sVSr8dTrNVtH3lJmXHaTwlb4cq8=; b=I9WnIXjD4tyv4509ZYeK7lKP+0u5qYRpr7AHzHEJRnobQa+D+cf5NzNSJWExtGen3Mg5coSy3VCcF5rWdf/RDEP3GQHGoSQNVqx9dYIPcdICDRz0BCc3SGzlL47yP02+CxFX3JbT2leY5BeMLSTMufIKsXIpT7i5k8sUPP87AGMoBkSEtiCTrGo5Ehjyu61idWprqkGj/behWS6p1LORdqSPnhZkYRKBAk+QPoQCtSxQ1gGpnsnwvZG8QLSemSwvQfxTyk7UnfwdeAZmurPEAqxZzYlFjS+I4ahyqaLjbvqC+DykVr+EkQHj21rjAuAdh8gSi7NDWt//ydvYWPf8Hw== 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=67nT5bwAOjBc8AC+sVSr8dTrNVtH3lJmXHaTwlb4cq8=; b=0lfp7P9UEWGXvwVGkNcDRwESXsU/87W9iUEi45vbtRZS8d4KZFEH/+gpiy0i+MGpPTNWfubqkqV3EUIAPo1wTM5PYgI2PBvw/R08scqm+I8uwPN5O0wWVrQG2jzMRSo6pdpQfL4Sc0wpMqst1C/UJVzehZ2WPizL3NMIV31Trmw= Received: from AM6PR10CA0051.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:80::28) by VI1PR08MB3696.eurprd08.prod.outlook.com (2603:10a6:803:bf::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.10; Tue, 25 Jan 2022 15:09:28 +0000 Received: from AM5EUR03FT004.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:80:cafe::cb) by AM6PR10CA0051.outlook.office365.com (2603:10a6:209:80::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.10 via Frontend Transport; Tue, 25 Jan 2022 15:09:28 +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 AM5EUR03FT004.mail.protection.outlook.com (10.152.16.163) 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:28 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.20; Tue, 25 Jan 2022 15:09:27 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.20; Tue, 25 Jan 2022 15:09:26 +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:26 +0000 From: Joey Gouly To: CC: , , , , Subject: [PATCH v1 3/7] kselftest/arm64: mte: user_mem: add test with mte tag inside a page Date: Tue, 25 Jan 2022 15:09:16 +0000 Message-ID: <20220125150920.23955-4-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: 7c26fa1c-18ce-49ff-1d41-08d9e014b431 X-MS-TrafficTypeDiagnostic: VI1PR08MB3696:EE_|AM5EUR03FT059:EE_|DB7PR08MB3050:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7691;OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 90o6TqpKcZXQ5zJFNkg6cnkIE9clG1kU3dIVZc0lzAaUludALXDoMCdDGkhhPzsaJ7cKQyL2uyPi4qBnN2mFY3BFTXaDzz6yf8ygX7LUJn/Tqx3wjd5K/YTYUe/KKJ8rqzmm+a5Tt1xMfdWTWtgmvqdzCZDjuTL5pBTRu7gQvxL5GFJ0nSoWJeXWxmUn+gwj7U4gtmGENWkxgezEzBWrp9C7aAbv4SazLEV0sBrlJfF7J1i+WXELMoSJi+EFa6KoXCingsih/Ha5dOE96/0w0DEo4AaIz+WzTNM3ylPnrUCeYktq+XIvcmyXxgfQ0tWwhZsxmg3SGiK/0ty7rzzj5Cap3s/UTGoVyHp7KpyB9ZxRp9mpxZEVq2ZxN4tcZ6iCYitHFJbLSPjJwepy6c5myuMBBOujUCHkKYp3sPI4CAXQSj2yJuEwnhcSZQ1UckJQQ+KgBZYxxiMTWiVqz/bydfE6l1QiaShmi/JfCOz1KcXhOoV5A9I6mROqYgR2rwWr82FxMNPQpX/P+HmHvzpPGwlNQKLRIOE/iGBM57MWMvyPao0MKZDwNKacOjHxGBEyltRnENANSi/1Zo8zjo1l6Z2GkqmfPgQ2yvNGafNhFrRBjB/VY3fAC0v0ziAk8nHgOXDm12If5kAHKMNbABW1Z5vVH9nfav97PJXJjFdoDUICkmytFZ6RAbqEyonlZJTM9utsQ2VF2RdUsI9WqI0gQBOvKeLuRswJha8ejGf3g7YFnLVVNkgfCP/S4UCtdGOVR18Em/4jAUDJd8azT6PJBdRZA3UGSEjGukLmnWKLTJk= 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)(40470700004)(36840700001)(46966006)(8676002)(6666004)(36860700001)(54906003)(8936002)(4326008)(70206006)(426003)(336012)(47076005)(44832011)(316002)(2616005)(86362001)(508600001)(2906002)(7696005)(40460700003)(1076003)(6916009)(81166007)(356005)(26005)(82310400004)(186003)(5660300002)(36756003)(70586007)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3696 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 29ff98b7-065f-4d13-a2d4-08d9e014ae7f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j1GsYi8MDMGYbryxEMKa388VYuxUTy7+f4xsR0ZjASubYzYfuXZYoqSNgU2kvJigwqViCRQ6Kz+T3WPfpNfXaqlKGOJcZg583I4g1gLwWPcs99PcoviyC48C8/LSZJt0CIMS3cut5SKENRBw70JIWE1ZS90lnbA+WvAI87aoGuNUO0sZfttlDmNpwxe5RWK3MQ+BPgyEtoxDYNznRH8CsR5vs8O0KuxsXwOVyugWanNICOMn7kgVEsuIpq2D6Ia2tpFOsAB3RaBTx/Jr3dTN4apGQdcUsO0sj0bv3/Cb99GkJcTYPnaok4Wrd8ozvAb5Z+eKabiH7uQ/LPWxE94BNXEu6xgw/N77qo6P6COTVzJ70kBDfRSDM7fhg0THvo8llit1O3/VT8KJls1sZ1ruEEwAUrs5h3KkX/eGkxAqZB0c8E/4nU+21KiS+dpsIQOjgwse/DahxmUyocxOvBw2FtKQ15gCG7jOS2SKyvAfjCHyAEmr9Arigzq+vEMsmqp1EEq+8JM0GqBTIlRh00ADlE5WxjtMNiMfCJQkOaEpY2p9L70I3eT4V20MkcdLakGyLaMVrKVXmUaXCKATzAzuhFIfY/17cUzkKbtrzirpSaNjYN+2ixesPEYX85CQaakMWCW7WFi0yQ1Idf6UmQgGD3ZbzvVaSa9z8guhCyRpj/kebOHw9bjxa4OQ+ipepsACsp4qA2wEOAPWLh2kolOODqGbW6qDfCmhgmJbOrjV4vt5ongZjhMrj+sz7X6Fj9E5bKQ6ZVtWqgHI9Aakll85kg== 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)(46966006)(36840700001)(40470700004)(81166007)(36860700001)(26005)(83380400001)(5660300002)(2616005)(7696005)(6666004)(2906002)(8676002)(4326008)(336012)(6916009)(107886003)(40460700003)(36756003)(82310400004)(1076003)(426003)(44832011)(70206006)(186003)(70586007)(54906003)(316002)(508600001)(86362001)(47076005)(8936002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2022 15:09:37.6137 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7c26fa1c-18ce-49ff-1d41-08d9e014b431 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: AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3050 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220125_070945_944003_60613924 X-CRM114-Status: UNSURE ( 9.31 ) 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 This new test has a tag that is only a single MT_GRANULE_SIZE large. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- tools/testing/selftests/arm64/mte/check_user_mem.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/arm64/mte/check_user_mem.c b/tools/testing/selftests/arm64/mte/check_user_mem.c index d33b262ccdb0..3497960851a9 100644 --- a/tools/testing/selftests/arm64/mte/check_user_mem.c +++ b/tools/testing/selftests/arm64/mte/check_user_mem.c @@ -107,7 +107,7 @@ int main(int argc, char *argv[]) mte_register_signal(SIGSEGV, mte_default_handler); /* Set test plan */ - ksft_set_plan(8); + 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"); @@ -129,6 +129,10 @@ int main(int argc, char *argv[]) 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"); + mte_restore_setup(); ksft_print_cnts(); return ksft_get_fail_cnt() == 0 ? KSFT_PASS : KSFT_FAIL; From patchwork Tue Jan 25 15:09:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 12723954 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 3AF53C433FE for ; Tue, 25 Jan 2022 15:24:56 +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=5uZHddbm3FEl0lJsBiLrPZmHbGc+3tM/3V+oCAzCHvM=; b=glqObuUVVOcGJt gdNoyrFshDDwhHZ3Kj8PkHaovJVuNZabudHgep6R2SEDIUNZD2Jj07aJli0wUIeFU+1gw3macLaGW Sh1Q/OmL3bQRxqUY6XGhy8QXUJCTfq9+GaI0oHtFqutp19EssLtncVMCIJXRmwd1j7+7uXdpPLET9 oZfbHXBS75jqf9e2i/WEugfsjoF27JXIlEga5AkRq17jKbbOd+g9p9mOXoVjnOx0H4KoHiJv8A8Cd mCit8wJAKinx66GBHdOz2gOaxy/EBMXxVUIylqFTvDj8X4u3ew2LjIC/oTl5hmyCplvieNbpoPGAd mmYi8BXmla32+t6kvsXA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCNeD-008MGW-PC; Tue, 25 Jan 2022 15:22:19 +0000 Received: from mail-eopbgr30087.outbound.protection.outlook.com ([40.107.3.87] helo=EUR03-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCNS8-008IGG-8e for linux-arm-kernel@lists.infradead.org; Tue, 25 Jan 2022 15:09:52 +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=n8RZXb3UAJqcQfKRAYKnk/ciO5TVsCERIQCGQGGTdo8=; b=j8M9lozo4H5s2s+fuTtDnzhkpe0A4NqlSjBl0kpEG/F5EM4za5hekJAaQw1TpjXNq2Ql9tNOyV7BDgBovbYkyc2HB0419z72Q5yrT8rAt1pCWCNRBuinVWNLWTIvC5Cgvh7Hk/7T+zDj3O8WaKJgyAxheqlLMfGAsGb/di54Hms= Received: from AM6PR10CA0043.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:80::20) by AM0PR08MB4611.eurprd08.prod.outlook.com (2603:10a6:208:10c::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.10; Tue, 25 Jan 2022 15:09:37 +0000 Received: from AM5EUR03FT004.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:80:cafe::93) by AM6PR10CA0043.outlook.office365.com (2603:10a6:209:80::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15 via Frontend Transport; Tue, 25 Jan 2022 15:09:37 +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 AM5EUR03FT004.mail.protection.outlook.com (10.152.16.163) 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:09:37 +0000 Received: ("Tessian outbound 1f399c739551:v113"); Tue, 25 Jan 2022 15:09:37 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: d045720f2df44ff8 X-CR-MTA-TID: 64aa7808 Received: from 3662a102de8a.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A4A84CFD-9130-481A-8696-C457EFBCFFB0.1; Tue, 25 Jan 2022 15:09:30 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 3662a102de8a.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 25 Jan 2022 15:09:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LHquMVrsQBB21sv/CG2gtu3ZNzDv3hO52FvOJNixZZyH2a/kNRHQgrmkgFh8hkgn8WGH445Vi2ok/fydl6PaClfcDa3l9Vy5AfxACAz4xkojJjEuR6DFL83cLvhh4nKHmi36msiHSUWBCDhpsG6lm0dcFTOl2qLPg7PM9uR0UhZbXH0RF0Jby+qLmF+m+Mf3GC1q7PxUGZ6my3WuoENDeKnlxv9sGGF0wXbnxq1Nk0YCxUBS4PeYCyDgSrs47dlbSGgm1bURy4qHLJ2HHEpQnsHmlmEMmhYKZudjKk85AItZk0G5F+2IblVOxDkzwL982mn4F+x/RS9wi/qPBdAN1g== 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=n8RZXb3UAJqcQfKRAYKnk/ciO5TVsCERIQCGQGGTdo8=; b=S+UfFQiyohPfbyhmyKB6iO7i4DAjEKBtUMWcx0jDTDSZhsY2Amza+rgvneCiP0owJyAX0xgXsoxFtPoVdMh7wTaAYkVRVq1LFA2QGlX0kaER5dZM4RWFZma8pjANJfXQVVoWYDFXonpETSmILpq1DKQDGGL2EnyUVIjHc80SL8xwHygFCTMpxy1b9wReahW0cv9GacMcD/vJHWoJXXDtoIX4mqlcsUE2KiRjsYaMaio1z5XHo7fCFF0QJPftYutsyQ6m+zWYjaLYsDO21a7egtEDYYJDO95wyiGlOnkKAxSikvCPA7gQq94+Ky1Tp6QsGx3IPZdIfeL2H88yOvLwfA== 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=n8RZXb3UAJqcQfKRAYKnk/ciO5TVsCERIQCGQGGTdo8=; b=j8M9lozo4H5s2s+fuTtDnzhkpe0A4NqlSjBl0kpEG/F5EM4za5hekJAaQw1TpjXNq2Ql9tNOyV7BDgBovbYkyc2HB0419z72Q5yrT8rAt1pCWCNRBuinVWNLWTIvC5Cgvh7Hk/7T+zDj3O8WaKJgyAxheqlLMfGAsGb/di54Hms= Received: from AM6PR10CA0048.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:80::25) by AM9PR08MB6274.eurprd08.prod.outlook.com (2603:10a6:20b:2d5::24) 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:09:28 +0000 Received: from AM5EUR03FT004.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:80:cafe::81) by AM6PR10CA0048.outlook.office365.com (2603:10a6:209:80::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15 via Frontend Transport; Tue, 25 Jan 2022 15:09:28 +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 AM5EUR03FT004.mail.protection.outlook.com (10.152.16.163) 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:28 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.20; Tue, 25 Jan 2022 15:09:27 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.20; Tue, 25 Jan 2022 15:09:26 +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:26 +0000 From: Joey Gouly To: CC: , , , , Subject: [PATCH v1 4/7] kselftest/arm64: mte: user_mem: rework error handling Date: Tue, 25 Jan 2022 15:09:17 +0000 Message-ID: <20220125150920.23955-5-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: 4edd93c9-33bd-4330-60ea-08d9e014b443 X-MS-TrafficTypeDiagnostic: AM9PR08MB6274:EE_|AM5EUR03FT004:EE_|AM0PR08MB4611:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:6790;OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: abgnwWTfQEVWW+aUOOitPC/HmuheBFbQ77DSYb1KvzYGlVLYFm/MnNsTE3Y+suvUzxMylZReDI5mAJc+aFtQWHsU1HeKpVpTUFi6I86fj/5vx1PKOUhFyRa73nJUnOzhKzkRMLyFrSMFlZkMnzs9HmCTKHux/CBQPSvq+vgwanNyaA1NKjg/v+PAdHGuwAt6VndsGE6FeliYRwNRTTk8yEMClqiOJE71nFRnL6M43LgerT1iCJRxwXhBHp04rP7BHJPtz8ZvxKc5DDnsK0YQLQLFtfajWmklHsotVlzJLfWG2ndlv/t2WxT5k6mxjyP9ILzF1vZGgWU42L8RbWPK0XEwfgubRY3EgU5ivPVsAV2zu6YWSq5AEW3IevpFukleqHGd5XH38/6vaZsaNf0vy7P87qTUAOQ+BoozX/I0hgTAwJdM0W6gSWPidtMjoFH46MqqaA2XPj6rRmUUWa6Q3spWOf9m2+N4lOChO65PuP1FHMeoLvbF28hb70Gtvt7NRU2wiigO+0Hi/eYizXZJuieYO2/GiGfVzYnrqBv/iJAtmuURCMWUlK+HXfcucGkWGFNEFCLjB3ZPMSs7yJoj+IO8ESn2scclfN+NSxGqNpr2rescUsAlIcUtIefvMQBhp0VFTrGGGFlPLFNq13hx5QsR+3gpkiYY3aARuOW2GW9veAjt7Iv4UZVVUTWZMyMjsRt+GiFUV8DCZpdD2Ws3yQ1fMlvmhzm7IG4fKGyAQU58RxLvsWM0R4NMj7bBokSI8e/G0XNTkFyEVgCT+VhBpV1KcVZYIEqWneK8TVKH21o= 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)(40470700004)(36840700001)(2616005)(5660300002)(4326008)(36756003)(7696005)(26005)(336012)(316002)(426003)(1076003)(36860700001)(70586007)(2906002)(508600001)(83380400001)(356005)(54906003)(86362001)(82310400004)(44832011)(81166007)(6916009)(8676002)(6666004)(47076005)(40460700003)(186003)(8936002)(70206006)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6274 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT004.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: adf20e93-cd45-4658-74ac-08d9e014aef4 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QUCL8kAM577Qcy2mTBaTAvcbo2tkLdMIm/SGLfuyurVFsSoy2aryksoofLm9tNCP8XHvDDePTgi2eeQhMosJhnQdOjaSPuQTSmUvg9oRuJOb9xtgOgqUIt678qn7abevUK80kMtz1FUzeWituQ5Fn3+93Vh/J65+1oVvrpJ1DxGSHqMALkORPUksAfcbdPM4W+CBimprmkHnIOgDPn5dJUW67NNENhFnEgG9uSbTk4Seof7V38f8fdzGD1prykb9cpADuZxlb9IHqkqJfQ+OO5Tj7vzEzT2YusKmThhzFypHOYhF7KEgb3cZZEdZ/Gz5BjVPWyrU8AaXRzVOq3bzRUiGYABPwVn7uVLDQ0N4/zgBD1QcZ8LfxK5mkV8wCbULSgtfVEpeUx+LfP9vXwf9+a+4bTG4BZq4cPO9pItHM7Ewt12tX36aRMUrEGThaBm6jWC5l1BkSTlFUa5aQVNf5R6v93vrMEDzWyN/9cRw/VmOuoh/MiuXDaig4PZeR5L4Flykaj9IncNxad0eGDJT9YFQOSiToC0CPMLd7og5Bhm7EibUMQC9Oa2R8vZb2loD6QQ1wlXclFiguHRtTVifD2aBlO9goh/Q7ETykMeR3zGxt4rnl5do1SBFIvwMBsTCwHpMxZQkCuZ1OCnegYDSyHaL5OksKyzl+WRe36kQAo3gzrTHeqmWLBnFKcxEIiiCmhOTCVAJDo9a5INlBxM0roOvP/qRus0lIcmhUb1Ay4Nx6E2N9eYdLS5ROxn7p0mScSzyDsG0i/HacH5IJqmsJw== 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)(46966006)(40470700004)(5660300002)(36860700001)(2616005)(54906003)(6916009)(70586007)(26005)(36756003)(47076005)(6666004)(508600001)(44832011)(4326008)(81166007)(86362001)(186003)(8676002)(2906002)(107886003)(336012)(426003)(8936002)(316002)(70206006)(83380400001)(82310400004)(1076003)(40460700003)(7696005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2022 15:09:37.7293 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4edd93c9-33bd-4330-60ea-08d9e014b443 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: AM5EUR03FT004.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4611 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220125_070948_454004_16EC97B6 X-CRM114-Status: GOOD ( 14.93 ) 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 makes it easier to have multiple iterations in the test. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- .../selftests/arm64/mte/check_user_mem.c | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/arm64/mte/check_user_mem.c b/tools/testing/selftests/arm64/mte/check_user_mem.c index 3497960851a9..f54143ec057a 100644 --- a/tools/testing/selftests/arm64/mte/check_user_mem.c +++ b/tools/testing/selftests/arm64/mte/check_user_mem.c @@ -27,7 +27,7 @@ static int check_usermem_access_fault_helper(int mem_type, int mode, int mapping size_t len, read_len; void *ptr, *ptr_next; - err = KSFT_FAIL; + err = KSFT_PASS; len = 2 * page_sz; mte_switch_mode(mode, MTE_ALLOW_NON_ZERO_TAG); fd = create_temp_file(); @@ -46,14 +46,18 @@ static int check_usermem_access_fault_helper(int mem_type, int mode, int mapping /* Copy from file into buffer with valid tag */ read_len = read(fd, ptr, len); mte_wait_after_trig(); - if (cur_mte_cxt.fault_valid || read_len < len) + if (cur_mte_cxt.fault_valid || read_len < len) { + err = KSFT_FAIL; goto usermem_acc_err; + } /* Verify same pattern is read */ for (i = 0; i < len; i++) if (*(char *)(ptr + i) != val) break; - if (i < len) + if (i < len) { + err = KSFT_FAIL; goto usermem_acc_err; + } if (!tag_len) tag_len = len - tag_offset; @@ -71,12 +75,17 @@ static int check_usermem_access_fault_helper(int mem_type, int mode, int mapping * mode without fault but may not fail in async mode as per the * implemented MTE userspace support in Arm64 kernel. */ - if (mode == MTE_SYNC_ERR && - !cur_mte_cxt.fault_valid && read_len < len) { - err = KSFT_PASS; - } else if (mode == MTE_ASYNC_ERR && - !cur_mte_cxt.fault_valid && read_len == len) { - err = KSFT_PASS; + if (cur_mte_cxt.fault_valid) { + err = KSFT_FAIL; + goto usermem_acc_err; + } + if (mode == MTE_SYNC_ERR && read_len < len) { + /* test passed */ + } else if (mode == MTE_ASYNC_ERR && read_len == len) { + /* test passed */ + } else { + err = KSFT_FAIL; + goto usermem_acc_err; } usermem_acc_err: mte_free_memory((void *)ptr, len, mem_type, true); From patchwork Tue Jan 25 15:09:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 12723953 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 15B22C433EF for ; Tue, 25 Jan 2022 15:23:39 +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=pGbV4c8bLpjNeLaSJpIuuiQXo/EtsgQIpN670aeSP0A=; b=VPh0quvS0Px47b APBG442eKir9VxAPiSZlflq18QkAyQ0vpbRM5aNcsrmO5nAvOU+O5HYCY6xwMDF0fr+3E0EhAqPmv Tq//C4eUi2WEuNpFxN4jQHynH54D9bvRKZRgyZElAqSTkfd1N0IYgmkivHcvynfQKsz8WmA6PWZM2 sAd9MISgTuXGgx4v93Ntf/EqH/S9eMddVSiP8JrApEqPKCUMeojAWRI8FtpUXIkHoLAPegaNTwUjZ O8E6AEqe9SJFc7atAqu4gUZR7VpO3WLphtW97xW4OQDUWDK9o+YKJPHVpyWNF6dJdeaivqRC9SxjE UtZpk07E+owkyBnK3cfA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCNcy-008LvK-Ak; Tue, 25 Jan 2022 15:21:02 +0000 Received: from mail-vi1eur05on2068.outbound.protection.outlook.com ([40.107.21.68] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCNS5-008IEf-TD for linux-arm-kernel@lists.infradead.org; Tue, 25 Jan 2022 15:09:50 +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=rtkOfjJPSAw2fJiTl86U5jpp+ihaR3Yu+Fenu5m+P5c=; b=3IQpQJlCncTBpTc4ba6gID0h6oCZzSFT12sTBucdC3G15PDbw76bqSn4WzC47J3wJ4zDmOtSpG0uXgjRQdS3MmW5usGREo4+xX5mQHlYu0wvS916HbZXnBk5v1Nnz4lqE9ZJiNuBZwumR7aqGO2HyRXVKGqQvt4ubefSSFYgZ2A= Received: from AS8PR04CA0088.eurprd04.prod.outlook.com (2603:10a6:20b:313::33) by AS8PR08MB6759.eurprd08.prod.outlook.com (2603:10a6:20b:395::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.10; Tue, 25 Jan 2022 15:09:40 +0000 Received: from AM5EUR03FT057.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:313:cafe::17) by AS8PR04CA0088.outlook.office365.com (2603:10a6:20b:313::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.17 via Frontend Transport; Tue, 25 Jan 2022 15:09:40 +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 AM5EUR03FT057.mail.protection.outlook.com (10.152.17.44) 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:09:40 +0000 Received: ("Tessian outbound 18e50a6f0513:v113"); Tue, 25 Jan 2022 15:09:40 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a12cb82f27904e3d X-CR-MTA-TID: 64aa7808 Received: from f9017ecfe735.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 69400553-1735-4CF8-BB72-97EC5EE6EA6C.1; Tue, 25 Jan 2022 15:09:34 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f9017ecfe735.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 25 Jan 2022 15:09:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J/hH6RoimzQnnT3sNjL5P3nmXWCBVWXbLwdfgBLb0d8c7oHBnWRyNzQylTXSCB7BeilZUPRqFxK4Iy9cHCogOBHFrWmMe8XEV251mWHtcAqr04e1rUzoWdTeT+SMg+SfZt6o1FCLgHsJiLRvYdzIXaPUD6zepW4iB+UQKs4mmmcga99JECiwBkXbN5POKrX1RbJgB+yzyWZWBM2a0vZzYZWvDz2rr8lvaPF/nThIc3dZip+cZ9ypM+thKgii0rkYpcqNphpgalbHshYttVzMtLCjTxai+YU6m6Amzxx8U0hkp0Z+IViE8ZW/mym/9WJs0LZ/F5DisBU7E4nSzdCu3Q== 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=rtkOfjJPSAw2fJiTl86U5jpp+ihaR3Yu+Fenu5m+P5c=; b=RXywJXGD23BfM4UBF/nzNU7132HVXzf2+wr/ofsD+3ZtJHFqm8KC7rWEqjviaIGTtp54Ko19UgHqGfxS+hwdoBuZUbOCQ3Jw+Rnvesd1FNYhhiIpS9USELnMh9AN9exGBMenflCoEJPpKjDLQxUvAckRQo7cfdmLEXtnxvY4fixYlIjwfTK2JKSYfLaYCBkSvuu618Jd/Cq3CWL1l29+2+izKFZXXelLbvVBL/ya0OEZ1xe+HgbD5sb2aIudPv7SyDx+C0IO9XddOcrgryhG/C+70wLUwPiNUONEje+JMO64qxBeJNKrLLMtuPv/TPpLP3lmpbreudXQG+06jMnhXA== 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=rtkOfjJPSAw2fJiTl86U5jpp+ihaR3Yu+Fenu5m+P5c=; b=3IQpQJlCncTBpTc4ba6gID0h6oCZzSFT12sTBucdC3G15PDbw76bqSn4WzC47J3wJ4zDmOtSpG0uXgjRQdS3MmW5usGREo4+xX5mQHlYu0wvS916HbZXnBk5v1Nnz4lqE9ZJiNuBZwumR7aqGO2HyRXVKGqQvt4ubefSSFYgZ2A= Received: from DB8PR06CA0053.eurprd06.prod.outlook.com (2603:10a6:10:120::27) by PAXPR08MB7490.eurprd08.prod.outlook.com (2603:10a6:102:2b7::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.8; Tue, 25 Jan 2022 15:09:33 +0000 Received: from DB5EUR03FT033.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:120:cafe::f) by DB8PR06CA0053.outlook.office365.com (2603:10a6:10:120::27) 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:09:33 +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 DB5EUR03FT033.mail.protection.outlook.com (10.152.20.76) 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:33 +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 5/7] kselftest/arm64: mte: user_mem: check different offsets and sizes Date: Tue, 25 Jan 2022 15:09:18 +0000 Message-ID: <20220125150920.23955-6-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: 0d87b884-07fe-4d18-c0fd-08d9e014b611 X-MS-TrafficTypeDiagnostic: PAXPR08MB7490:EE_|AM5EUR03FT057:EE_|AS8PR08MB6759:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:6790;OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: ewtdZRuLQ7by7a/JvepHYtHV4qGHc+OJQWPx0CHh2+uBtmnWT8P4GNsFm0nG+cxP50/WZOE42V5WLMjiRMdI7BalcvSvaqdFbpd0x5iUiMg2o50zaCbdfVCm37lc0lJnqDUEMLNytYlKUDzVvLGQ7QSrTPrQCdhW03Tg4vhrMA8JJZktu+Wswzx0umnfMfUn0+TMKKik+H0Sw9Xw07LFXBpd9HOka0lQ+TxVFwfL03dbAJJBpZIRsC6KY/lRMv4oiQbHnKq0jq85GDfTLY8jY4Jl3DQx3k7NlsuP5/QsSkuCLCXW09j6xSQhYVlnlSFqrxQ2dO9AEEw6C6dx1ZsErvDEbhDFFhgZeFf6dY6nbKXcBgXWVAxJl6/O3YgYVB1ax94YdQldLG3UEMSW8CaeuGIl2T3t2Zo0pEAykMIqDrEfyXnBxDa9APGllLW4J8A8LlWjjK9inIXMJlOT5IKM9Tf9UoVoqGuzrfAzL2Ou2nU7yXUAFIidVNwUQcpqWMc64OV1DbyOklWIkASL0BH8xRTF3cNNPKYHxRXXWtpoGHV57QaG9YAlns4TbQN++GaxJ2sVdapxHChw5bjRKjKvIkbRt3/OJMzd4SWZNw9gqP5gWO0E53Dfd8V3vOLFQrtwaFay2VX+q0zHTBOaw+tA6JHgAwDybhlnsDoXoz05b3Yb6FC+TgBPm0XodkcLpMl1svxmwduBXZn7o036lrLZvFYkYQAO4thonldlKIdYtg6H19phdBSpRLI6HYrLiaj+uT2QBMl7wJTfBT0uUx7Zpa0BBRMDEYQbq1WfWhfWQ5Y= 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)(40470700004)(36840700001)(1076003)(6666004)(2906002)(83380400001)(186003)(40460700003)(47076005)(336012)(2616005)(6916009)(81166007)(8936002)(4326008)(54906003)(44832011)(356005)(82310400004)(8676002)(26005)(7696005)(36860700001)(70586007)(5660300002)(426003)(86362001)(508600001)(70206006)(36756003)(316002)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB7490 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT057.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: b2116992-c7d8-483e-232c-08d9e014b16c X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9GpV63amuC1IethV5PGnG9tIHE3m4wpB31GygzanuacvN4sG1FV1CqVzox8HqJtFBnagBfjGtZzNN+IgwS/rxpDfr+Ax2AxVjBHrO14z8pywU0SlO9lZ3TQTmuVQJcDQYwWqC/PJp9gZnY68znCISiaCVisD7LlFz9JeJmfgsxyc6CL41tlKFaHzdu1w+sCNKcYI8nJORKSXZLnInPm74PthQFdtYgF1A+Z1WIOHEE0JSl0jHO8eYQ218CJ2D9V5cPwuRtHn6MBRoUcxLBsyeMIh13jvmVYVhQosiytRunlmsYBwr0ahKDuBgOIQdevFsxI6O8mN+cK5sokTbfO1l0fSJQ92QBpUJQw/GNBN2XrG0NaZhxJO6WhFS1W4S/LEO1I/+GVCmTdGF9MlXKKBoqPrfESVZb9+rMQ9Lzy2ySjLCUPr5mxZyGGM9bJWf9FumfxQkTN7NZ1/nDYWCr152h8DJ+BOc5yO5oJnP2JuAvmscJpQCGBrOn+C94l1SYY9HDUaH+QGyYYluIIhyn4/ZG+hh/UzkAHxBBUSGRwo4Dp6AzT1nR7qwP47VQ7mL0jNXCeAxnI9Du8ojqGvtvySw2ziWvVUHWM7pSq2HjLkClSoxEjKuPjXTXkUsrFpfkoeQArhCyIo6sZDSiQPYPXm4wzI4k63Yk+u9ZrijIFjvu9N2Z2kg20ZzOsSMjXWD1Q5IfTcvZxhu7SsTJBxlt4T6j2ou87Yj9W8C/TG2Y+y5I/B/5LQdLKJ9Mt7Vu9/VvHyKqnKgD5Vgw/rqhM89Tf9Eg== 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)(40470700004)(36840700001)(46966006)(1076003)(426003)(4326008)(8936002)(70206006)(2906002)(2616005)(7696005)(8676002)(44832011)(26005)(186003)(40460700003)(508600001)(54906003)(336012)(107886003)(86362001)(6666004)(36860700001)(5660300002)(316002)(70586007)(6916009)(47076005)(36756003)(83380400001)(82310400004)(81166007); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2022 15:09:40.7595 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0d87b884-07fe-4d18-c0fd-08d9e014b611 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: AM5EUR03FT057.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6759 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220125_070946_022245_D5A92342 X-CRM114-Status: GOOD ( 15.82 ) 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 Iterate over different file offsets, pointer offsets and buffer sizes to exercise and test different behaviour. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- .../selftests/arm64/mte/check_user_mem.c | 49 +++++++++++-------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/tools/testing/selftests/arm64/mte/check_user_mem.c b/tools/testing/selftests/arm64/mte/check_user_mem.c index f54143ec057a..8b1b586f3df8 100644 --- a/tools/testing/selftests/arm64/mte/check_user_mem.c +++ b/tools/testing/selftests/arm64/mte/check_user_mem.c @@ -26,6 +26,8 @@ static int check_usermem_access_fault_helper(int mem_type, int mode, int mapping char val = 'A'; size_t len, read_len; void *ptr, *ptr_next; + int fileoff, ptroff, size; + int sizes[] = {1, 2, 3, 8, 16, 32, 4096}; err = KSFT_PASS; len = 2 * page_sz; @@ -66,26 +68,33 @@ static int check_usermem_access_fault_helper(int mem_type, int mode, int mapping ptr_next = mte_insert_new_tag(ptr_next); mte_set_tag_address_range(ptr_next, tag_len); - lseek(fd, 0, 0); - /* Copy from file into buffer with invalid tag */ - read_len = read(fd, ptr, len); - mte_wait_after_trig(); - /* - * Accessing user memory in kernel with invalid tag should fail in sync - * mode without fault but may not fail in async mode as per the - * implemented MTE userspace support in Arm64 kernel. - */ - if (cur_mte_cxt.fault_valid) { - err = KSFT_FAIL; - goto usermem_acc_err; - } - if (mode == MTE_SYNC_ERR && read_len < len) { - /* test passed */ - } else if (mode == MTE_ASYNC_ERR && read_len == len) { - /* test passed */ - } else { - err = KSFT_FAIL; - goto usermem_acc_err; + for (fileoff = 0; fileoff < 16; fileoff++) { + for (ptroff = 0; ptroff < 16; ptroff++) { + 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); + mte_wait_after_trig(); + /* + * Accessing user memory in kernel with invalid tag should fail in sync + * mode without fault but may not fail in async mode as per the + * implemented MTE userspace support in Arm64 kernel. + */ + if (cur_mte_cxt.fault_valid) { + err = KSFT_FAIL; + goto usermem_acc_err; + } + if (mode == MTE_SYNC_ERR && read_len < len) { + /* test passed */ + } else if (mode == MTE_ASYNC_ERR && read_len == size) { + /* test passed */ + } else { + err = KSFT_FAIL; + goto usermem_acc_err; + } + } + } } usermem_acc_err: mte_free_memory((void *)ptr, len, mem_type, true); 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(); From patchwork Tue Jan 25 15:09:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 12723956 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 949FCC433F5 for ; Tue, 25 Jan 2022 15:27:30 +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=LWSCqi3Gx9IPa7jW/bGaXIYN3qF2zDVEkdfAI9oLA8Y=; b=HVl/ixvDW7jK21 7xApwNTGDQnSH8kSSYElNWglkrOtjgbIhvg4A1EjqgyEND6RpUt+HMWc+oaREcf0OwZpNDj+MRals EPdxIjQapSsvN1DdDmMHSvgnGNhpL6UMgC0FgtleRQtV+gTISRyiLyKx3RQfDnJ1xAniRggKXzg8o vcRU88HHFfdku9FiesdN0jq/wrFRya3dRFcRoe0CavUjdhEgMp6K5+MMDs7bp0ve85WtYB5Qi0qXm zbt//EwnbzkwjCduiAu+VUrzn+WTu9ByTTw/kFxkiS6Zda5H1GdU1TStRDNG8OXmLbYbIbMDvsKLD yKEcJUIUm2duf8xTWllg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCNgx-008N2N-2c; Tue, 25 Jan 2022 15:25:08 +0000 Received: from mail-am6eur05on2078.outbound.protection.outlook.com ([40.107.22.78] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCNST-008IMi-8M for linux-arm-kernel@lists.infradead.org; Tue, 25 Jan 2022 15:10:12 +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=hWHYlHYciBAhEyWxsh4TWgWkE1jyB2F2YvqdYCZ7fGQ=; b=BjMR7xrpDMC+UG7/WI7IMDU+wTr5/kLsmLraiq54SdEwJDToTyBaMc/GboOx8RobDjF1+d78fNEYW+HG1NQKsfR0mpx+tEGcicBHeoipJvUkmdk7aSOLlvjkAyVf8ykQQDC8SDYxkGkvtw7Hnq6TilykMjv58I1Gn1Rz+CEJoaE= Received: from AM6PR0502CA0068.eurprd05.prod.outlook.com (2603:10a6:20b:56::45) by AM6PR08MB4325.eurprd08.prod.outlook.com (2603:10a6:20b:71::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.8; Tue, 25 Jan 2022 15:10:02 +0000 Received: from AM5EUR03FT043.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:56:cafe::dc) by AM6PR0502CA0068.outlook.office365.com (2603:10a6:20b:56::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.17 via Frontend Transport; Tue, 25 Jan 2022 15:10:02 +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 AM5EUR03FT043.mail.protection.outlook.com (10.152.17.43) 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:02 +0000 Received: ("Tessian outbound 1f399c739551:v113"); Tue, 25 Jan 2022 15:10:02 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 3a491c9e006a103e X-CR-MTA-TID: 64aa7808 Received: from 365f9e2f412e.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 8BE48E25-346C-42A8-B462-4F5E97E5FD09.1; Tue, 25 Jan 2022 15:09:55 +0000 Received: from EUR03-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 365f9e2f412e.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 25 Jan 2022 15:09:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZocjOAoC3usI4PiZA+ymO4xjE/Ir2378QYxmAefsBFN0av/fk2yW6JaCGQiW1vpgWELrxCCtIL281P2HD3Vt4fgs0g3OLEf2Di7LItPB6Fz3nVVgbSQOs8DXK0+d12dV4ulRyA4NQqRFIOi8aP/1Autca/lKVVeZDCSPffUiZooyCsFcXkjRvj+63uYjcsBjPwtS4Z0JdolVJpiA+VGLqN0ZEGPcEIzCefCs3MTdvvZt141xtTAA89r7KgTqM3HqfVO3yFLIpcTF/wpDBcTdCA3/JQ8co2wOIdV7GKPxhwCndKBhdoa1pqzTDhz32vTBKDDpSWD6ydWhaGm/dRNWkg== 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=hWHYlHYciBAhEyWxsh4TWgWkE1jyB2F2YvqdYCZ7fGQ=; b=V9Mpqtk7DlGJGUprrCRpqbjq83P1RSKUjy6exxABusnSWWsbFw7LCa/zSrdvhgqoXmcoK4nqtvVwET7K5hHrbilJ/OoQTWIbxH0QMEgzfS1zHyrpmnSaex05KRncukvXa0imhgswueTe9iN87x86ZzA8jmnyeTPXvYPKLZog8mG1r8nckD9TyW5e/ciDZ/8geSp/BnpYG/mULACYrFgaVrqxkValGipe6NOIw+g4bE8wy0mzUiFSi3tqfJ1D3SlRv6yCPzXN3esGn/8ETbdV97XLYVcN5rdjrToHe3tzSZG57hFu5a4DtvlaFNVuYkLBB6BaYFSTiLyp6j1L7XKmzw== 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=hWHYlHYciBAhEyWxsh4TWgWkE1jyB2F2YvqdYCZ7fGQ=; b=BjMR7xrpDMC+UG7/WI7IMDU+wTr5/kLsmLraiq54SdEwJDToTyBaMc/GboOx8RobDjF1+d78fNEYW+HG1NQKsfR0mpx+tEGcicBHeoipJvUkmdk7aSOLlvjkAyVf8ykQQDC8SDYxkGkvtw7Hnq6TilykMjv58I1Gn1Rz+CEJoaE= Received: from DB3PR06CA0024.eurprd06.prod.outlook.com (2603:10a6:8:1::37) by PA4PR08MB7483.eurprd08.prod.outlook.com (2603:10a6:102:2a7::20) 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:09:53 +0000 Received: from DB5EUR03FT040.eop-EUR03.prod.protection.outlook.com (2603:10a6:8:1:cafe::5) by DB3PR06CA0024.outlook.office365.com (2603:10a6:8:1::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15 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 DB5EUR03FT040.mail.protection.outlook.com (10.152.20.243) 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 7/7] kselftest/arm64: mte: add more test types Date: Tue, 25 Jan 2022 15:09:20 +0000 Message-ID: <20220125150920.23955-8-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: a1434101-2d5b-438c-dd8b-08d9e014c2e0 X-MS-TrafficTypeDiagnostic: PA4PR08MB7483:EE_|AM5EUR03FT043:EE_|AM6PR08MB4325:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:4125;OLM:4125; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: TZRQ/RZgYIw0d9YvmpJnInB1jgqNwhdemZ3aaarHbx2yeS+x5mfBCGmOuWxq++qDj/a5HqatCVtYMRZq1Jut/NFqNHXSh1ft2QLNzw0sW3JsySs9UUVKszlxm2liF7uRc8R4aXlrpWIorH9pMv2P+cdteL9FinLM11sbgBWAcNADrOnAYcCL/RILvZ4mFFKl3nn9BfDJ0FeLaEV/52t0xM4MzPqSGsv4BDBXxgKYpcVhDK2sv1shpWlS4o3nZRDrohlX+zIzGdqKgbfuJ7uANABpX3u8EzgxFjPZdCJfq+JHgY/D4+ifbFaNKC268SNIMSeK/PoCDlW9THecDo4tQfdIPJEs+EoqsMm/i1Z3KY/8eLJVrpaUd5lQbWxbhSdp22G9/Lafi65SMjp3HlZa5xXwq5rZ0CLczmolhkH0+3+YN0uVBBju3wKuDx+50xZLmTi9zcUU5hlkiL4jbtCq4ZM3vZH6S6XfhVd2537xIMXXUChT+rszruucrv/D7KnsJeqm73dJXyK0b4/XL7BqH5woqXaMg/XSp/mHzAIWk3RiRzX/mxg7gast8xSAD3efyJTX56nv3eXVM6+/pUgvt1Td4vfNE2hHCyVpgLZxD3pgXoPRxJnVse90LPd/NttAwa2++fNIS3Hy66iky9fQcUyw4QJP+MsNkSZEeQzLMoRS050FEk9M5FVsL91m+zujfo0a4gNiPn2pEIq5wBk0x8zDTBc7UyTSBz58ugpxxcK0WaC1c0VII9HGF41hySG/VfhVSkYAoPO9oRjjfVG1dr5snWQpgHgymTWpCL3D7SM= 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)(26005)(186003)(7696005)(6916009)(2616005)(8936002)(4326008)(36860700001)(54906003)(316002)(36756003)(44832011)(508600001)(5660300002)(40460700003)(82310400004)(86362001)(336012)(70206006)(6666004)(2906002)(70586007)(1076003)(8676002)(81166007)(47076005)(83380400001)(356005)(426003)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7483 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT043.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 71fb05cd-e6f8-4cc2-e101-08d9e014bdb4 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 75wfddseYqTHxqYRWM9hUrvYcRgprDPptIxx6o8vzp6N20s9ZIt/P6T2tgVRhSdbSxUN8gvFMqYn4lPriqCRP7B8YmfP51tt44lSICCS4tdktSX75VAOSI5q82wvOwJF1BqijqdAOvqGCbxmu/YiN/SSO55J+BjJ2TftLMnj5VELzR8duEebcK3fcMzJ/IeeHEzZnodgshgWliKRrkLnxnGfDkvzR656QN7J1j46c98AAIp0TBTXTPI2YFd6yv9v92ZBn0GivbbSMS/81Zqq5hWq/iH+S9zFHKBLdicItDNqGUGI7y5cRiviTK4AMqBbBU5EnG+Rplzp8jvQBg38I6BjqadJHC7FWtckSer//0KmKRDnYI1nsY6oUVW0Dp0iqcCfDtjpPfZQUOjBbPbU+2M7HnHNb05qJMH8BBZVVPDPQOyrS0lR1D5q+5wSOHF2zb/iibdjFVeZAo2haQVCgBrzygBNLjFbAwYVtww+kZ6zayPAMicLsFLDPBJ0JnT5CukWdxosD6rCDHDud/5fIxAT03++eY9mvMHGG5pj5D+VsKnor1/hkGY+ZzYU0vHMEuIxLtXJeLQ6j4YYNen/A9uyPAhOiChX30MJ3bxqNacfiAAUkCeCnNP1y3KTqsDGKhdIFvUA/qAQd05VfIqdJpjzVyjjHMafSG5rwSKxBqmgVig6o0i3Xw0i1nRknx8jfEWW9e5HU9jDsBn2h/TTR4cxC0IAbfNlm7NZgbAkcFCbnYqXOyPna950edlSfIwR 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)(46966006)(40470700004)(36840700001)(7696005)(40460700003)(316002)(6666004)(2616005)(26005)(70206006)(426003)(82310400004)(54906003)(70586007)(107886003)(6916009)(47076005)(5660300002)(44832011)(86362001)(83380400001)(4326008)(336012)(8936002)(1076003)(186003)(36860700001)(508600001)(36756003)(8676002)(2906002)(81166007); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2022 15:10:02.2651 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a1434101-2d5b-438c-dd8b-08d9e014c2e0 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: AM5EUR03FT043.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4325 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220125_071009_356726_AAE3C73D X-CRM114-Status: GOOD ( 12.35 ) 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 Add test support for write, readv, and writev. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- .../selftests/arm64/mte/check_user_mem.c | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/arm64/mte/check_user_mem.c b/tools/testing/selftests/arm64/mte/check_user_mem.c index d104feab4e86..df4c8d8c9c17 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, }; @@ -85,6 +89,23 @@ static int check_usermem_access_fault_helper(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; } @@ -140,7 +161,7 @@ int main(int argc, char *argv[]) mte_register_signal(SIGSEGV, mte_default_handler); /* Set test plan */ - ksft_set_plan(9); + ksft_set_plan(36); for (t = 0; t < LAST_TEST; t++) { evaluate_test(check_usermem_access_fault(USE_MMAP, MTE_SYNC_ERR, MAP_PRIVATE, page_sz, t),