From patchwork Mon Jun 13 20:14:08 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: 12880084 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 87AA0C433EF for ; Mon, 13 Jun 2022 20:17:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 85E7C8D01D1; Mon, 13 Jun 2022 16:17:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 80E3E8D01CC; Mon, 13 Jun 2022 16:17:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 54F2C8D01D2; Mon, 13 Jun 2022 16:17:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 33D998D01CC for ; Mon, 13 Jun 2022 16:17:39 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 1567160C02 for ; Mon, 13 Jun 2022 20:17:39 +0000 (UTC) X-FDA: 79574323038.03.6B1E20D Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by imf22.hostedemail.com (Postfix) with ESMTP id 8FE55C00A0 for ; Mon, 13 Jun 2022 20:17:38 +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=1655151457; 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=vo/QgRsJex180B/MZOFV4gS3W10znq++oNOGcslvwl0=; b=Dl9JaXiPgE3KB2W9PytyX2Ydb8CErjoRbyqdS1Z4vTV2EHG4vJto9UgmTzKVC+tzN4k6r4 KDwziMj6rUu7nd8whB1jFF7vvWI6sRETVADmv38Uoj7/ZNOexQsxpkRPRqeeSDyuwqGEvH BwEOie7GxwDdyuGfRMy3sQ8YZis7ANg= 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 17/32] kasan: only define metadata structs for Generic mode Date: Mon, 13 Jun 2022 22:14:08 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=Dl9JaXiP; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf22.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=1655151458; 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=vo/QgRsJex180B/MZOFV4gS3W10znq++oNOGcslvwl0=; b=1jY2zY51m9UN39Aq+xpXv/0I1BS30O4/S3kOkB9K9P8gzZOy0qa6ADh99zSy0Jzn4Ru8FN kfPyM5j/0QbBSrKhERmbP1xU1Dt1v+Ke/U/9PorLqSwLDfd2DEZ0YdQp6VNW0/BYMB8hGI yFg9lcX0xFrduSTlMo3d1YUcqTaTM+A= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655151458; a=rsa-sha256; cv=none; b=Mhd7c7OzsGor3NiYg4X0FtFmucsVVIkI7kvpxyYpv4Ua7GGCYAT6aApRYPpOnmX9ZXue0S C5Xs/9+4vGz1QvsP2dbvIIQWSkbwsOTLSLZ2HfSgpvZBrlBMLBKAP23huzBpLWPLgWWJSd RsTLEMiDUSnCCElR6NxChHsWPG9HIw0= X-Stat-Signature: dwxu3ac3j6qoxwnjxpff6s7yb6emu595 X-Rspamd-Queue-Id: 8FE55C00A0 X-Rspam-User: Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=Dl9JaXiP; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf22.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev X-Rspamd-Server: rspam10 X-HE-Tag: 1655151458-155878 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 ab2cd3ff10f3..30ec9ebf52c3 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h @@ -192,14 +192,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 { @@ -218,12 +216,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 {