Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3543017pxb; Mon, 24 Jan 2022 11:50:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyur70Vvo5uMf0DKqTwhiio2vzCT0BvcIv3AdNdPa/MsDXncK0FRJCpwQROhMeB0u/jsuN1 X-Received: by 2002:a17:902:b105:b0:14a:b4c8:2ac7 with SMTP id q5-20020a170902b10500b0014ab4c82ac7mr15427166plr.148.1643053829784; Mon, 24 Jan 2022 11:50:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643053829; cv=none; d=google.com; s=arc-20160816; b=yJhldP0ubsD9Mis0vYwvC5osIHYxHo7ooSHWt+jDaojgWhWLpDyXua9BBDuoPuCQa0 Sh4pHQKmc5kCb2NUfifC+Le4hLRV0xJj9Of9kCK5Zf8rqohp4PQ5TmhpA4B/D7tHEo7R si1gapF6C6fw5wlypyuIrJdjU+3wfN8UgJnkdKC+19q8nCcmDoJqf/T9tnq+rNtxNCxo +S/acQrUEI6pQwaHqzfovEFsqcAx6kT5CKgMbHSMHx26XjnWP3ULfu1k2BRrnk2t7I1L cLHwvOhDI3rjDYtMZgy4iW5NzXj0bgVbrPzC3B8OZzrkGV5WT5wWRtlNoIlCWVP5JnFW A94w== 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=60ognrjQYhvO9ri8tnI6aAPda5fVQLb01YF0/tgqKOQ=; b=Xjur1pUqa3gaPcifToGyk0PGn/BKTuB6nTA6kUPHuNsFX5hE1desYXoTZEXH1BGBO2 PmWEAb6pme7odERpp1yzf5iWVJJluenwFqjVqD2DSlBYgzuYei1HmLFaBfqsGBGS3KnR QW8ywSJq4Mr1sIUs2neZ73GuZGe892bM/SHvi3kV4K8vJdHHpQRT7yUVim4uPn2jEYcf Smu6/3s1WiyWZOqP8QBsi78xI+Yx/OQC3nQByJ9Ue9oHhgXFC5oNVsLuvdgvZhW/3lGb lwK4RDJnxIXuIiHp69NnZ0HVWp8hGrcT41HbSLopveT3MPK0llxbjkfUd+lavSQBE9x5 UtRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=anLPN68h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x4si268121pjl.40.2022.01.24.11.50.17; Mon, 24 Jan 2022 11:50:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=anLPN68h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S245054AbiAXSGe (ORCPT + 99 others); Mon, 24 Jan 2022 13:06:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245031AbiAXSG0 (ORCPT ); Mon, 24 Jan 2022 13:06:26 -0500 Received: from out0.migadu.com (out0.migadu.com [IPv6:2001:41d0:2:267::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4A84C06173D for ; Mon, 24 Jan 2022 10:06:25 -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=1643047584; 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=60ognrjQYhvO9ri8tnI6aAPda5fVQLb01YF0/tgqKOQ=; b=anLPN68h0xEJlZECCTYno/C1j4tKYGA2LXMTpiKjxkBrzvjd4Fj7O6JGIFZNq1IazaTINM gkJCqz3jDEHYjsPQJgH2R7puW2ETtRdc3HzQ0kjRU58QrTdAl8aX6XBEgXUy0b33Ejin5a wz45H2Ux7jU0SM/Fu+pUy/eRhqHAQJU= From: andrey.konovalov@linux.dev To: Andrew Morton Cc: Andrey Konovalov , Marco Elver , Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, linux-mm@kvack.org, Vincenzo Frascino , Catalin Marinas , Will Deacon , Mark Rutland , linux-arm-kernel@lists.infradead.org, Peter Collingbourne , Evgenii Stepanov , linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH v6 27/39] kasan, mm: only define ___GFP_SKIP_KASAN_POISON with HW_TAGS Date: Mon, 24 Jan 2022 19:05:01 +0100 Message-Id: <44e5738a584c11801b2b8f1231898918efc8634a.1643047180.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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrey Konovalov Only define the ___GFP_SKIP_KASAN_POISON flag when CONFIG_KASAN_HW_TAGS is enabled. This patch it not useful by itself, but it prepares the code for additions of new KASAN-specific GFP patches. Signed-off-by: Andrey Konovalov --- Changes v3->v4: - This is a new patch. --- include/linux/gfp.h | 8 +++++++- include/trace/events/mmflags.h | 12 +++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 581a1f47b8a2..96f707931770 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -54,7 +54,11 @@ struct vm_area_struct; #define ___GFP_THISNODE 0x200000u #define ___GFP_ACCOUNT 0x400000u #define ___GFP_ZEROTAGS 0x800000u +#ifdef CONFIG_KASAN_HW_TAGS #define ___GFP_SKIP_KASAN_POISON 0x1000000u +#else +#define ___GFP_SKIP_KASAN_POISON 0 +#endif #ifdef CONFIG_LOCKDEP #define ___GFP_NOLOCKDEP 0x2000000u #else @@ -251,7 +255,9 @@ struct vm_area_struct; #define __GFP_NOLOCKDEP ((__force gfp_t)___GFP_NOLOCKDEP) /* Room for N __GFP_FOO bits */ -#define __GFP_BITS_SHIFT (25 + IS_ENABLED(CONFIG_LOCKDEP)) +#define __GFP_BITS_SHIFT (24 + \ + IS_ENABLED(CONFIG_KASAN_HW_TAGS) + \ + IS_ENABLED(CONFIG_LOCKDEP)) #define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) /** diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index 116ed4d5d0f8..cb4520374e2c 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -49,12 +49,18 @@ {(unsigned long)__GFP_RECLAIM, "__GFP_RECLAIM"}, \ {(unsigned long)__GFP_DIRECT_RECLAIM, "__GFP_DIRECT_RECLAIM"},\ {(unsigned long)__GFP_KSWAPD_RECLAIM, "__GFP_KSWAPD_RECLAIM"},\ - {(unsigned long)__GFP_ZEROTAGS, "__GFP_ZEROTAGS"}, \ - {(unsigned long)__GFP_SKIP_KASAN_POISON,"__GFP_SKIP_KASAN_POISON"}\ + {(unsigned long)__GFP_ZEROTAGS, "__GFP_ZEROTAGS"} \ + +#ifdef CONFIG_KASAN_HW_TAGS +#define __def_gfpflag_names_kasan \ + , {(unsigned long)__GFP_SKIP_KASAN_POISON, "__GFP_SKIP_KASAN_POISON"} +#else +#define __def_gfpflag_names_kasan +#endif #define show_gfp_flags(flags) \ (flags) ? __print_flags(flags, "|", \ - __def_gfpflag_names \ + __def_gfpflag_names __def_gfpflag_names_kasan \ ) : "none" #ifdef CONFIG_MMU -- 2.25.1