From patchwork Wed Mar 2 16:36:28 2022 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: 12766295 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 DDD38C433EF for ; Wed, 2 Mar 2022 16:37:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5ED008D0001; Wed, 2 Mar 2022 11:37:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 59AFD8D0009; Wed, 2 Mar 2022 11:37:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3EE748D0001; Wed, 2 Mar 2022 11:37:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id 139408D0009 for ; Wed, 2 Mar 2022 11:37:55 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id D7E7661B3F for ; Wed, 2 Mar 2022 16:37:54 +0000 (UTC) X-FDA: 79200002868.12.757DEC9 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by imf12.hostedemail.com (Postfix) with ESMTP id 4EF734000C for ; Wed, 2 Mar 2022 16:37:54 +0000 (UTC) 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=1646239073; 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=L6CSCTWOxlFTjCUaDQCg92iZqD/oJAA5cp+h5CudQM0=; b=IEetNTQJKp8rSFcLOgVkVj+JLPu8/d9JDYmmx9tBOAw5O8yADVRymYyXX7dCZVZTfdDojh t7OQUZtYSynSIzMGT6pcoEY7lpO5HnGdUxrvS6Sc4MVKQ4lko8XLsusJLla0BXr/MKdyAj KML1RT69q8S4HTyr7ZbSuaFLKu19EZ0= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko Cc: Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH mm 08/22] kasan: check CONFIG_KASAN_KUNIT_TEST instead of CONFIG_KUNIT Date: Wed, 2 Mar 2022 17:36:28 +0100 Message-Id: <223592d38d2a601a160a3b2b3d5a9f9090350e62.1646237226.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 4EF734000C X-Stat-Signature: m5m5ttxm1qw8bkspr1f93g5mwc1pqmzp Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=IEetNTQJ; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf12.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev X-HE-Tag: 1646239074-762219 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: From: Andrey Konovalov Check the more specific CONFIG_KASAN_KUNIT_TEST config option when defining things related to KUnit-compatible KASAN tests instead of CONFIG_KUNIT. Also put the kunit_kasan_status definition next to the definitons of other KASAN-related structs. Signed-off-by: Andrey Konovalov Reviewed-by: Alexander Potapenko --- mm/kasan/kasan.h | 18 ++++++++---------- mm/kasan/report.c | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h index 4447df0d7343..cc7162a9f304 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h @@ -7,16 +7,6 @@ #include #include -#if IS_ENABLED(CONFIG_KUNIT) - -/* Used in KUnit-compatible KASAN tests. */ -struct kunit_kasan_status { - bool report_found; - bool sync_fault; -}; - -#endif - #ifdef CONFIG_KASAN_HW_TAGS #include @@ -224,6 +214,14 @@ struct kasan_free_meta { #endif }; +#if IS_ENABLED(CONFIG_KASAN_KUNIT_TEST) +/* Used in KUnit-compatible KASAN tests. */ +struct kunit_kasan_status { + bool report_found; + bool sync_fault; +}; +#endif + struct kasan_alloc_meta *kasan_get_alloc_meta(struct kmem_cache *cache, const void *object); #ifdef CONFIG_KASAN_GENERIC diff --git a/mm/kasan/report.c b/mm/kasan/report.c index 59db81211b8a..93543157d3e1 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -356,7 +356,7 @@ static bool report_enabled(void) return !test_and_set_bit(KASAN_BIT_REPORTED, &kasan_flags); } -#if IS_ENABLED(CONFIG_KUNIT) +#if IS_ENABLED(CONFIG_KASAN_KUNIT_TEST) static void update_kunit_status(bool sync) { struct kunit *test;