From patchwork Mon Sep 5 21:05:32 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: 12966556 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 C51F1ECAAD5 for ; Mon, 5 Sep 2022 21:08:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9885A80218; Mon, 5 Sep 2022 17:08:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9100780214; Mon, 5 Sep 2022 17:08:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7652E80218; Mon, 5 Sep 2022 17:08:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 5CDF080214 for ; Mon, 5 Sep 2022 17:08:09 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 34330AB84A for ; Mon, 5 Sep 2022 21:08:09 +0000 (UTC) X-FDA: 79879269498.19.EFE5A8A Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by imf17.hostedemail.com (Postfix) with ESMTP id C952840063 for ; Mon, 5 Sep 2022 21:08:08 +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=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 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=mUENtsfi; spf=pass (imf17.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662412088; a=rsa-sha256; cv=none; b=qdHrKuZgylD8TOMhurGc8xNmC8lUBYaZp869jWY2V1Q/I3/u4n/Rs2rXhwiHVR1sUpna/H o2PSmV2wz9CqFlele1E5HQbsquvSZIVfP4YowqRwG6Hm+UU0qUI6qk6bRmnhmNLVpW2bjf FojjnZwY53Moa/gUIZgAHQ4ZsTP/Urs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662412088; 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=QPTLEFKVNhHBs5rA/ZsHhl+NYzDo7/AO4Izo15rUT6s=; b=tZZjcxl5Xt+zolSVrNUNVSeqM0lrIXWNn09frfUaLLB8Op9XwHWMN3dw40vHPLkLSGwH2e rQrw/CuEP6UYg05CIRhtSTYIVyVqyjmprf8HNAL2+1WCw6KEt1JTg2v2d2We97v2k5yqLn cUHHLjHxCrOgN2fG3VRI5ARWW6YDzx4= Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=mUENtsfi; spf=pass (imf17.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Stat-Signature: enbga6jhifo8qh5d5eeysuhuqdz7xk4t X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: C952840063 X-HE-Tag: 1662412088-34194 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 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 {