Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp279541pxm; Wed, 2 Mar 2022 15:16:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJw7enc8UQcshOh5yy6PXgQ7OhTjc0xyWmqgu0QNI5WH7FKzgJzwCiY7xkT4HTdOdCbkvxNs X-Received: by 2002:a63:1c21:0:b0:374:104c:e4eb with SMTP id c33-20020a631c21000000b00374104ce4ebmr27837590pgc.556.1646263018064; Wed, 02 Mar 2022 15:16:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646263018; cv=none; d=google.com; s=arc-20160816; b=g7MLYZsfQkYxfhRz8yGL1tQd75d2mbLPIX/vpAo7P9Ax3a3pZB7GeqLG/8qXTe2moq 4KrL4E6WWSY1Q3BhQ/S2VL/nbC+Z44I5YtSkDKpUYggkNA6QI91Ai5isosZ8rdnQUTS7 NW/lx6ZS8ZJiUWXcvWsO5apjr6260AO8ME/hINTJsSJ8nR9T7Y6rC2jnMRVrMFy4j3Sp qNg2qSDQvdRlyAoD277X9zVKpcQ6rOPJ7drMltlMVPMk5zaBkg9bOsRtwnbKz6kqekih AmDD7njtPK5+QgnaqtvhaouiavMRrtbYUf6J5FxExEqT1p24VoHnILoXvHfZVOnpZuy3 H64Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=L6CSCTWOxlFTjCUaDQCg92iZqD/oJAA5cp+h5CudQM0=; b=EyAoHinrdWNbfqknWjV0AtIjO2ITUzVz7thqJiaOtMfHM0+BPm4lqBqNvjegAACRFK 2tu4zxLtfXucCxS2AHqoTgZE/iT1eYIOtKubVVZ9Fs1afsaaFWXylE2vhqiiaEqJurYD QthNtfMtm3Xxpw/nbBLAvRG5JqGZKZGc8dCfuIBKkSSSaNkKORmAMH32+Y4i3oi+BW9N nNiIj4VhJZA8ezN5Hcn96droDSrvM29FjMGjmkyyOPeHEGcSMqtROYds7y6fE+8n0qGo HKK+lVDRBqc7j3EVcv+iaweJh++hchpxpTqIN0imXlppTvGFgGAl0njOaR3S1CwYJePa SOiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=IEetNTQJ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id u14-20020a056a00158e00b004c1d0b702ffsi480543pfk.113.2022.03.02.15.16.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 15:16:58 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=IEetNTQJ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EA2D9BD2F9; Wed, 2 Mar 2022 14:53:58 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243092AbiCBQik (ORCPT + 99 others); Wed, 2 Mar 2022 11:38:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240929AbiCBQii (ORCPT ); Wed, 2 Mar 2022 11:38:38 -0500 Received: from out1.migadu.com (out1.migadu.com [IPv6:2001:41d0:2:863f::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D47CD201AC for ; Wed, 2 Mar 2022 08:37:54 -0800 (PST) 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 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; -- 2.25.1