From patchwork Tue Jul 19 00:09:57 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: 12921911 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 EBF6ACCA482 for ; Tue, 19 Jul 2022 00:12:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4DF30940009; Mon, 18 Jul 2022 20:12:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3A46F940007; Mon, 18 Jul 2022 20:12:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1334E940009; Mon, 18 Jul 2022 20:12:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id F06BF940007 for ; Mon, 18 Jul 2022 20:12:34 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D10BC20FDC for ; Tue, 19 Jul 2022 00:12:34 +0000 (UTC) X-FDA: 79701923028.01.C42DC6B Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by imf08.hostedemail.com (Postfix) with ESMTP id 61874160058 for ; Tue, 19 Jul 2022 00:12:34 +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=1658189553; 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=4Ug+nRhk4S0scNxkqaQhWMyfD8pnsHKB57f6laJzIdM=; b=LQyieyg1ICB2hXD7nyoI+Yg4EYt5bi3rUmzt2PuEluJOu99p4MYMwPczZhfwWen5F70+l+ VLshZJN+OWEMvyYiENeKha1OPzIPTx7mC4urQUrlxY2aDPgoV5BlqiQOItNkoI9TaL7NkO R90LaEavqGGJ00VEHl5fWxChGEvumwo= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko Cc: Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Peter Collingbourne , Evgenii Stepanov , Florian Mayer , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH mm v2 17/33] kasan: only define metadata structs for Generic mode Date: Tue, 19 Jul 2022 02:09:57 +0200 Message-Id: <93569dbf8c3615ae49e62e7be1607b6fea406ae9.1658189199.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; imf08.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=LQyieyg1; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf08.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658189554; 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=4Ug+nRhk4S0scNxkqaQhWMyfD8pnsHKB57f6laJzIdM=; b=EFI7ry4/7Ccye2meMCwe3ROxj0bJ4ggXD9DfsEfFbuxi7A5THKLle+VmjR/FxsnyJePouC gh0G3460Q2XbUB7RbA/tkr9vNSFDllWHfgkqP+GWUWZjjzN8tgDjirQVfGIerFjyFC7yIH 0ES9iNjiIzUQL+OrH9KQeDvtBdfHT+A= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658189554; a=rsa-sha256; cv=none; b=Os5sjNX/Lbbx0UvsqUAmkV57n5G+JsdGJenJGCPtUOGReRQT9HTCVllaJKyCj8Qrh+fhKP j6od/nUBGib36J4Zs4IBRZcyNNFY7PpLIO/Kjr2jiGoHn33cch1Dqh4thYuOe7B+1e7yvo tbH7XhTs5Srag5c26NGDCuhsCI69vu8= X-Rspamd-Queue-Id: 61874160058 Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=LQyieyg1; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf08.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: fgtoia8xah8anquitpjyd1ycnz4twje7 X-HE-Tag: 1658189554-800196 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. 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 {