From patchwork Thu Dec 21 20:04:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: andrey.konovalov@linux.dev X-Patchwork-Id: 13502607 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0A31C46CCD for ; Thu, 21 Dec 2023 20:06:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7C9FE6B009E; Thu, 21 Dec 2023 15:06:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 74E916B00A0; Thu, 21 Dec 2023 15:06:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 57C206B00A1; Thu, 21 Dec 2023 15:06:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 3D5DC6B009E for ; Thu, 21 Dec 2023 15:06:11 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 179AE1C1620 for ; Thu, 21 Dec 2023 20:06:11 +0000 (UTC) X-FDA: 81591906942.20.9D3485D Received: from out-175.mta0.migadu.com (out-175.mta0.migadu.com [91.218.175.175]) by imf08.hostedemail.com (Postfix) with ESMTP id 51F2B160027 for ; Thu, 21 Dec 2023 20:06:09 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=UstQbyfW; spf=pass (imf08.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.218.175.175 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1703189169; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=jLiJLNrkVOviOAnhN8fsOfgjq7KcvOUpOIZZlqspNbg=; b=tD22rVNShXPw6BGNSgajigWxuAz6xJE9yTpfXZPQ6x5Ro/lKj21xf4r04GfLsO+Fbqf+Se Y7e2c28bekCLMqBEXI8q1fTDNZZtc5U/6qJQDeXoXW+x2QfTcLSVHh7CPGWbsmBJmlQf5X foJsOw4Lz3lZfTpccsSzNrUaTb10kWo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1703189169; a=rsa-sha256; cv=none; b=Fx1NaCKy++FaWO/NinovK5keiCebfJ/o3g0maEAlNqfnLTg6oSS7Glmjilc9uUQAhNJvxh S62+K35pLLQv2I7CSzT/ihajCaZI3RD+PlPjvReFPiXaSuRht2mRoPIGHVNKvZj02wdTEg prmFymZ6ferrdMa7O6bFTg1uMo1b4fc= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=UstQbyfW; spf=pass (imf08.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.218.175.175 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1703189167; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jLiJLNrkVOviOAnhN8fsOfgjq7KcvOUpOIZZlqspNbg=; b=UstQbyfWlazleiIZsd06p6GGsiGbF7Mk+SEC7V7KErkAUJltuZuqjmSUhenEEKoFJe2Ldb 4tUiUzH6Uvv0RFu+cj+WbPn+gOqF8clgrSf7LbqyBVZlfKgonrRaUwbKKmHlfEcXGpHP7+ mC3opDKQo6UxTJoeylICS86c/ZXC9RI= From: andrey.konovalov@linux.dev To: Marco Elver Cc: Andrey Konovalov , Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH mm 11/11] kasan: speed up match_all_mem_tag test for SW_TAGS Date: Thu, 21 Dec 2023 21:04:53 +0100 Message-Id: <6fe51262defd80cdc1150c42404977aafd1b6167.1703188911.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 51F2B160027 X-Rspam-User: X-Stat-Signature: nb1tfecqfhq45z1gb35biku8b7tnxr1f X-Rspamd-Server: rspam03 X-HE-Tag: 1703189169-766979 X-HE-Meta: U2FsdGVkX18A4tTHiZQFR462Mvpe30e4Toy+QzYpCb3FiI0+rgl4kJDNhPFn6m9SBgV8rTQgWAs8tDVstks0wCcug8qWg9R21e6gZBXTGtbclXxsFwZXEO7eXPuZ4x9c60EJA4kVazhm7MPXQYcN++Ip3HXAHYCvBP9Zom4ZrM170s3Mcv+ZFQg7YADvtXCftsWP3DAanaZZIt3tEdUhPEXYjIESXyUg9Vt7i8Vs2Mel5eI4SZl+hVOEWTI4iCSlazrg1/PKSigwzSgjwo1+YfHTPWBlTF+AS1NOVa6K4A3lQibL5fT5mFYQehtF5QMvnayVKgkLYhT1SkVMcdjev6JC1vrrplRI89GzRvf91DX2FLnT06YzV/jJjVSlCYmJ43IaPVDlYzfvUXGLmBB5eu09QXbU6o5J1X8UYzVlG/mgX1By7fEHVrPK/t3JrrYiHjgvG3eui0ILEYf28ud1Qspoq9wXR3HU1QJkNX3Z7e6uYHHUpaRj4jCtP8z2/DMfZz+9WX8NTqEGvr9PWPl+nXMrQdPRWzF06SSqzwr7fvCpQWtb+Xmm9LHYaAh4UHHh7dFPhxzhrx2u740n18EgnoakZmMv+uvJ+ACYgscuWxgzL7Sorulk/ZUesiXJyDsX9RPC+Pz6Kcy3igBdf8Q1hV+kK51wBFFejjm9PzqGqrcYgLJDlIzSj0i2vA+V6Oup2pFSur8mAhrf5BwMjsAdKjJLPRqrDe9/4ME08VJlE7fRgvePPH1tQRpEq/jIcFK75iGq7FbIuHNbGYj+vhf3nmPTWHExcBLb5Wuphxi4DXHXVn+mLvvs3pqpJSFujpXO6180rH5ZqI7DAs709UGJBfsmb76/0k4DHb2nlXout4oXUlIE9vWiymN19UIqqoGg9URkDzIr/8SFgzHWwHgC9Epw6nWCZYfL/g67MMVuxc1nlGg6dZW+mpkGZjRLFXZA5cvDDwJ273R3rn46nnl 6qzvGywj SObZ86g3/cHOSXDrbng5aG8FO2hYUWFbfGCsWHtXslYSopjbIooe8lB0Ai85YptZWw/6+2hjiYLCdRaETgkJ/iGVqLxDQZC87tbo9Quk1a093N+aemSWBQYhWDpwlk6714+RRoZSo2M6Fx099867AniDC7qasG/VXstiY1KNeoXoYyPPk0nKNdtS7MAuP+csA6p53SLNpnBRnpr/Yvh+Vaszmpg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Andrey Konovalov Checking all 256 possible tag values in the match_all_mem_tag KASAN test is slow and produces 256 reports. Instead, just check the first 8 and the last 8. Signed-off-by: Andrey Konovalov --- mm/kasan/kasan_test.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mm/kasan/kasan_test.c b/mm/kasan/kasan_test.c index 798df4983858..9c3a1aaab21b 100644 --- a/mm/kasan/kasan_test.c +++ b/mm/kasan/kasan_test.c @@ -1785,6 +1785,14 @@ static void match_all_mem_tag(struct kunit *test) /* For each possible tag value not matching the pointer tag. */ for (tag = KASAN_TAG_MIN; tag <= KASAN_TAG_KERNEL; tag++) { + /* + * For Software Tag-Based KASAN, skip the majority of tag + * values to avoid the test printing too many reports. + */ + if (IS_ENABLED(CONFIG_KASAN_SW_TAGS) && + tag >= KASAN_TAG_MIN + 8 && tag <= KASAN_TAG_KERNEL - 8) + continue; + if (tag == get_tag(ptr)) continue;