Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp3580215rwb; Mon, 5 Sep 2022 14:36:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR6nUC082PEfm87iFMnrlmihKEyX/CbZ7Qhkr1herxR9SzDaOkzYNSvlIhM1aQAplk8H6E3C X-Received: by 2002:a17:907:a0c7:b0:734:e049:1af6 with SMTP id hw7-20020a170907a0c700b00734e0491af6mr36641624ejc.439.1662413773068; Mon, 05 Sep 2022 14:36:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662413773; cv=none; d=google.com; s=arc-20160816; b=AuWi2Nf0bszNegfrLk7tgxmqfLDTbbI/xNzCQYW4Fgv0sb3Ud8KR9k7VeobQPfoXVt FDKz4iHsadGwjQAP6XuS1gi1bP66KMnRGN6oz4k39Iu+5/m43spope7izkMgpvY2Q9O8 wRKMHzkbZ3wUyPfBQTk4/o9TiWH7hoaZckKmLZWS+3c4UNEWckaBmP9p23/vjS9l/l0G gB98L4xt960bmew0cMM8XopHJo6iXP9kwlMFC7hRc1c2GCFyJCpk0MlhzBrUW8v1tjap ufx7wHroOuf4TwkUwhK6oiS4KbjQ+1/5j8/R1x32q45rbstUuyN51GOYqG3SzqJ6iOEd tXIQ== 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=QPTLEFKVNhHBs5rA/ZsHhl+NYzDo7/AO4Izo15rUT6s=; b=CJPxe6yzao4/jo5zsRM30EoUVoviP5QoBxRSfgt67iBjM5qUyJEF+O/zO0AdbejchQ 4sZX4vyimtROBznzo+xaIIQ5ck2KrcL2K5tjirRTfQh/NKnMRPyiRrkxhji4FDIfQeZE 1v+xCV5ur1ew7mHqVLyeHcAf4zFKHcs/qa0zDy80O9l5l88UT9W4EcCaDL696bH435xl 3B+5EOMVKpa9IFshP+gf5zkcEFAqKK/fT7rEjbDb4p6V5QSAkXMcEMkfe6lFAtLQ9eJl UR9DSz8ivMoDu32IBVYOho7acb7T2aFiEwdyGpnyqkUjSHSbNIrHIZM3tQHKZFF/N+rp qyDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=mUENtsfi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020a05640235ca00b0044679cbe4a4si9974053edc.187.2022.09.05.14.35.47; Mon, 05 Sep 2022 14:36:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=mUENtsfi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237737AbiIEVIh (ORCPT + 99 others); Mon, 5 Sep 2022 17:08:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233064AbiIEVIK (ORCPT ); Mon, 5 Sep 2022 17:08:10 -0400 Received: from out1.migadu.com (out1.migadu.com [IPv6:2001:41d0:2:863f::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65B91659CE for ; Mon, 5 Sep 2022 14:08:09 -0700 (PDT) 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=1662412087; 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=QPTLEFKVNhHBs5rA/ZsHhl+NYzDo7/AO4Izo15rUT6s=; b=mUENtsfiNSSZ57/PzgN9pQQG9PbLHTRd+0/S6DL+XfWFSCvSqmP8o6NeEYXJ/7Q/9GOpIH /Huz/qHUTNMuzTMP8N3AbEEPfjGjysag9oATl7K2XsheiAQEQn21a/b8AhBpyLJaqBQv9u ROz61qRfhohykc9nwwnYFh7ZtMf0puI= From: andrey.konovalov@linux.dev To: Andrew Morton Cc: Andrey Konovalov , Marco Elver , Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Peter Collingbourne , Evgenii Stepanov , Florian Mayer , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH mm v3 17/34] kasan: only define metadata structs for Generic mode Date: Mon, 5 Sep 2022 23:05:32 +0200 Message-Id: <8d2aabff8c227c444a3f62edf87d5630beb77640.1662411799.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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Hide the definitions of kasan_alloc_meta and kasan_free_meta under an ifdef CONFIG_KASAN_GENERIC check, as these structures are now only used when the Generic mode is enabled. Reviewed-by: Marco Elver Signed-off-by: Andrey Konovalov --- mm/kasan/kasan.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h index 6da35370ba37..cae60e4d8842 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h @@ -193,14 +193,12 @@ struct kasan_track { depot_stack_handle_t stack; }; +#ifdef CONFIG_KASAN_GENERIC + struct kasan_alloc_meta { struct kasan_track alloc_track; - /* Generic mode stores free track in kasan_free_meta. */ -#ifdef CONFIG_KASAN_GENERIC + /* Free track is stored in kasan_free_meta. */ depot_stack_handle_t aux_stack[2]; -#else - struct kasan_track free_track; -#endif }; struct qlist_node { @@ -219,12 +217,12 @@ struct qlist_node { * After that, slab allocator stores the freelist pointer in the object. */ struct kasan_free_meta { -#ifdef CONFIG_KASAN_GENERIC struct qlist_node quarantine_link; struct kasan_track free_track; -#endif }; +#endif /* CONFIG_KASAN_GENERIC */ + #if IS_ENABLED(CONFIG_KASAN_KUNIT_TEST) /* Used in KUnit-compatible KASAN tests. */ struct kunit_kasan_status { -- 2.25.1