Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp4809844pxb; Mon, 28 Mar 2022 03:53:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjs3c5TkezsP5bkdb3gs6Y7h9HnZOmS9vpv/cEFc22DNIUF08LB+TW5r1ZjwqwISE4eatQ X-Received: by 2002:a17:907:97c5:b0:6da:c285:44f5 with SMTP id js5-20020a17090797c500b006dac28544f5mr26995789ejc.208.1648464837549; Mon, 28 Mar 2022 03:53:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648464837; cv=none; d=google.com; s=arc-20160816; b=f8bs4hiaoVgBxBlIoh+4rSZY+tkXUtwpbW2X/ACbZwdpqFyaU3O503+fdKbOITa70L vo2POONsONGIdRuI/T9ktyOjUJqFfKFawyVKRzF7iJtPw42KdizDo8d09lW46RYxAAh/ /kw+2c/8DHD8h5IvdSXhyHSmAjGtxZPchms6h3Ivkl4bCdCROV53tDMeoJ/qM5G9yyZn UzyN4k1TbmiVmV2GBx5UmI21TZouk6SlQX/FLYtTq76LV0Kn19gzKdWcJSaZNO5OfZzR lcDoq8sJHNod+xC/bQkaKU4BwsFTb0BlGDhXclrozutJz+hW2Cp9EFQ5FQblVtjTMx6J FXYQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=mNdfGwODQpy307VgfLm6WxBMSo9tvm6XjaGTK6OBfVE=; b=XM7Hotdyg3CLIaA7p4VLHZ4j3PhXKw8zT3GxeTDNOqIzT3mEu9ahE1gQnvLZegOHwL sirEAJqC5YREVuFiSrQC2iAKxiYAyotaCzzFHiJpHRFJdkfZz+MZTu+LaiYNiv7PJiFF kSXYB7U/VMQ4SpH5NosfGK9sALkBHu08F6Mk1wIpFUR/KJi/lp9xb2dQRODyo2o6BEAa a9WwOp2Z+L6IW1IoPWBOKnf4ryDUlLWaeFZ+OWoio7JurytDVQmSS1yQ2o+H81OgyVxU cif/qMOV2EAlRMrjeT8nAeEUOIir3Oj5TjRXHX/4Nil+g0FD3NzJJ+MdU1KOE2GPe9qj If3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=iphgMXGF; 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 e6-20020a50e446000000b004192dc4cde1si16207904edm.331.2022.03.28.03.53.31; Mon, 28 Mar 2022 03:53:57 -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=iphgMXGF; 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 S235196AbiC0RCR (ORCPT + 99 others); Sun, 27 Mar 2022 13:02:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232480AbiC0RCP (ORCPT ); Sun, 27 Mar 2022 13:02:15 -0400 Received: from out1.migadu.com (out1.migadu.com [IPv6:2001:41d0:2:863f::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B02B735861 for ; Sun, 27 Mar 2022 10:00:35 -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=1648400433; 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; bh=mNdfGwODQpy307VgfLm6WxBMSo9tvm6XjaGTK6OBfVE=; b=iphgMXGFANTgMnApo6nGOZQdSL1x+NxCCao2zcWcVYgIy/3XApMWT6d7f984sbgtRsMVwB KZ6P4JxKamKuFYJsYod4/r7gHM1Arg2Li8ca77TpaZU3N0iAv1XcnNWWoCqA/9WO0dF3Na X5GuK5Rxv71hWptLPiBnmESQPEygptY= 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, Vlastimil Babka , Matthew Wilcox , Sebastian Andrzej Siewior , linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH] mm, kasan: fix __GFP_BITS_SHIFT definition breaking LOCKDEP Date: Sun, 27 Mar 2022 19:00:23 +0200 Message-Id: <462ff52742a1fcc95a69778685737f723ee4dfb3.1648400273.git.andreyknvl@google.com> 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,SPF_HELO_NONE,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 KASAN changes that added new GFP flags mistakenly updated __GFP_BITS_SHIFT as the total number of GFP bits instead of as a shift used to define __GFP_BITS_MASK. This broke LOCKDEP, as __GFP_BITS_MASK now gets the 25th bit enabled instead of the 28th for __GFP_NOLOCKDEP. Update __GFP_BITS_SHIFT to always count KASAN GFP bits. In the future, we could handle all combinations of KASAN and LOCKDEP to occupy as few bits as possible. For now, we have enough GFP bits to be inefficient in this quick fix. Fixes: 9353ffa6e9e9 ("kasan, page_alloc: allow skipping memory init for HW_TAGS") Fixes: 53ae233c30a6 ("kasan, page_alloc: allow skipping unpoisoning for HW_TAGS") Fixes: f49d9c5bb15c ("kasan, mm: only define ___GFP_SKIP_KASAN_POISON with HW_TAGS") Reported-by: Sebastian Andrzej Siewior Signed-off-by: Andrey Konovalov --- include/linux/gfp.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 0fa17fb85de5..761f8f1885c7 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -264,9 +264,7 @@ struct vm_area_struct; #define __GFP_NOLOCKDEP ((__force gfp_t)___GFP_NOLOCKDEP) /* Room for N __GFP_FOO bits */ -#define __GFP_BITS_SHIFT (24 + \ - 3 * IS_ENABLED(CONFIG_KASAN_HW_TAGS) + \ - IS_ENABLED(CONFIG_LOCKDEP)) +#define __GFP_BITS_SHIFT (27 + IS_ENABLED(CONFIG_LOCKDEP)) #define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) /** -- 2.25.1