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: 182443 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp660352dyi; Thu, 21 Dec 2023 12:07:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IGavMKYRo5fOgDcJIJjRO42nZC3QBv3L7RROajnkoMlvb5Ylf9y2XOQXDIJIpqSrylWtnpf X-Received: by 2002:a05:6a00:b49:b0:6d9:352f:c24 with SMTP id p9-20020a056a000b4900b006d9352f0c24mr243477pfo.63.1703189275853; Thu, 21 Dec 2023 12:07:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703189275; cv=none; d=google.com; s=arc-20160816; b=dF2AOYsh45nyM9CWVhsb3OTtqSVoEekiQcxq/dp3b5Y/LoNFEPx3NJO5Q0BpqE9/QQ WcdxkSjmeb/iY9cGZhOMRX6GdJ/CflOM22ftulFyeKA2HMTap0PEJ6OYDWPY/43yWNGq jfT0zzOAM0elREt+oLrfCS2/XaUdyRQ7t3ZVIu0qs36EPWDRCJmpzIaJkQXS0LHamPfd HWicRFX2+MGP7TUL42NVEVVz1NGx3D/OyCyGPVNyCtMkx3w7+ORueRyIsFWGCoHTmXOc 9VAHOSN3UPSBoTHyGIWYy8Yy/c6/XPwGFgmkelAywv5AkiEge/JmBFBXg5ktNBEr+zEo bUcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=jLiJLNrkVOviOAnhN8fsOfgjq7KcvOUpOIZZlqspNbg=; fh=GyTEpUCUNPwsl1pqA0jDPXgvja+iZTM9USlQd9sQtQg=; b=elms/IgJtoJyiaD6vypqDHJwhlY1kAUuQC4fdIOZJoNV0uHRwsx58PlkUAIxcdJfzQ /JSUS4unZigzX2pw2fduDHxTFYI0RVYDWKLkmI4piVreYVjywmvk91naHJxlJSWPmGVE /KddCkWMYSc6EUVt3EFnpi/c9RHTLGWZw7usnwtw1e4JklcSYHBjmxgfuj216IlJDwUk UzWEKXhvLjwZO1nKaO6T3Zcxeco4otXXSoBvZBZ/PSW06huhQ/BiBiJRtJ5XvIBstvi/ oLS1uYAQXuAUhDLw9LaYHA6u+QyHsYN5/N3DqhFtssPXizZB40JEtd10/VvJTRMsKB6r irPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=UstQbyfW; spf=pass (google.com: domain of linux-kernel+bounces-9029-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9029-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h2-20020a056a00000200b006cbb7b7bed0si2019494pfk.201.2023.12.21.12.07.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 12:07:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9029-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=UstQbyfW; spf=pass (google.com: domain of linux-kernel+bounces-9029-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9029-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AA433288B42 for ; Thu, 21 Dec 2023 20:07:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D3EA77F11; Thu, 21 Dec 2023 20:06:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="UstQbyfW" X-Original-To: linux-kernel@vger.kernel.org Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56F8D745FC for ; Thu, 21 Dec 2023 20:06:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=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: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785923398071972923 X-GMAIL-MSGID: 1785923398071972923 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;