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;