From patchwork Tue Sep 15 13:20:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Elver X-Patchwork-Id: 11776653 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5B32D6CA for ; Tue, 15 Sep 2020 13:41:43 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EAF3220936 for ; Tue, 15 Sep 2020 13:41:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jESWR2mI"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="FPGcr6/1"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="iMvsBbNh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAF3220936 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version:Message-Id: In-Reply-To:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Y4jtUg6A+MsiVKDADRLyeeHUnBelvhy6MUn6nECgat8=; b=jESWR2mIvTQ05o6R9B7Rsih1D N0ErwyqIij9kQxKp+3DY0nKNLiB0zn84WKXnbJ73QR5kPr1ONApzllwhZNSaqrmvF/wmCYMW+5WBT Q0LwqogqXmqcimvj2m2tGpSRcznv51r4ERdQ0FVcw/EF7n8ikj2m/iJBP4GKAYzgwDoMd1pu1d8NW Rxm1jTkxMsVE7Gy5rlzLYY4/xMHBYkGblKGteSqdtZNeTKh3d8/t0I7vGFM+n5Tu7FFkf0kRdvWAj LEYtWu6ixGeieyVayiI6GzKtTSjNZc7c5pndTCOziOYb3DLgl4kKbHUWX/1eLjY7qTyLRflgDaecE Wg8gflVsA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIBD7-0005pF-BZ; Tue, 15 Sep 2020 13:41:29 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIBD5-0005ok-Mn for linux-arm-kernel@merlin.infradead.org; Tue, 15 Sep 2020 13:41:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:Cc:To:From:Subject: References:Mime-Version:Message-Id:In-Reply-To:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=a8meNz/QEeXxbn8b6t9gmGleu286u2hc+BNFU326RBY=; b=FPGcr6/1dchi545cWAv7Tr/F4p HcTDgMR3glY84gh5zaOV/HmvvSPQ+G7sWW9dzHTfAkghtAvmfjc7Fa82c5VG9TAyt5wkLecsT0JGA K9G1eVla2hRCds/VV9sV/w9cQy8oo4t1rJ+KIK5Y7Z2lA5hIC61Pie29mUZg/e45ja1rfFrjC044x Z6IoWF8jdtYAy/ZEMMGY2XUsAkZ9JumzcKfHGPX/V6YPhed5iYRSMrp2Xi4VCO5A1xHkaqfrqlCdh 7EShvIljxqyhCCUfBzBLl8ghSP3sua9TgPrX2IhM3mx+C57KjINs7N5KzZ2gbyBNb+wZ3dG+ABce9 T2yA5N8w==; Received: from mail-wr1-x44a.google.com ([2a00:1450:4864:20::44a]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIAtb-0001jY-PD for linux-arm-kernel@lists.infradead.org; Tue, 15 Sep 2020 13:21:31 +0000 Received: by mail-wr1-x44a.google.com with SMTP id b7so1224295wrn.6 for ; Tue, 15 Sep 2020 06:21:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=a8meNz/QEeXxbn8b6t9gmGleu286u2hc+BNFU326RBY=; b=iMvsBbNhgXGxnHuHOkBUVAAM2qOoY48Cj/hlej2s6y2vnL8IvcLin4Y20xBeyU/km1 5wsT+5syuztJ23L+OnZf6qPvh9KPK+uSriT1U9BNQyQVzqYYdX2+ph3t1DP2YDYfN4sf Dmro65jUXU2/e4ZFwym3N1STOvAQhGuQCVkjmJQ2g8aebKIZT9ffsKffbOtCn1attREE RsxBD7Uir7r4B7jU3FXDIJ+jVSByU3ErwYkkcn/iqxIhKM5YFs/dkTnflfODfPePIiq9 TDbx9M/7RJ6YOPJgIKKAisxFttdU10HweoylvSuu5uNY5vU97BDTQYyFyoITjaDvUh3H 5+dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=a8meNz/QEeXxbn8b6t9gmGleu286u2hc+BNFU326RBY=; b=VmYOkJi4NzdVBH0tKSlQfVBxDCSBB3Z4/sRmvx+eV/2Iu34m4PSmt7CGFUmMXO0i8N ScMxftdTl7IF0JOHC+JozuDXVRSY3NIOKsVK0ILzmZkzj+tZsxhyseohRiOV/cL3xj4I /XtUc6FCGIeBYbs3PLuaPAquMpJ/dBQLm+JZA5noVsfD7qVWDSHEPPwubw/++iq7pTet iibfYjp204gz4MTHqKnxD2fvzN+9ew2vpCRnvbYLCj4RrUA86lN1M/sKWzxoUezO94+c 2+fuHX6uFFaj7on3EWIMZxkWY9tJJAa7LBhtGUV2NYVoOyGnq9aMgLiZML5MMN9bFWT4 9xVg== X-Gm-Message-State: AOAM533ageD/PHMpr0xOUfQ2jup/4fNo+v+iwCLG87vSPUK2qnUpKkav pY8SHrlh24xok34q2LVI7jbxycbg0w== X-Google-Smtp-Source: ABdhPJxc+SFUorzyuHDnGAmMdmAFnOXbAdljVi+RbRH5QtpV+KA/ekb7T2afDQiufl+mm1oPBfvLzn0Tjw== X-Received: from elver.muc.corp.google.com ([2a00:79e0:15:13:f693:9fff:fef4:2449]) (user=elver job=sendgmr) by 2002:a7b:c749:: with SMTP id w9mr4491690wmk.29.1600176077770; Tue, 15 Sep 2020 06:21:17 -0700 (PDT) Date: Tue, 15 Sep 2020 15:20:44 +0200 In-Reply-To: <20200915132046.3332537-1-elver@google.com> Message-Id: <20200915132046.3332537-9-elver@google.com> Mime-Version: 1.0 References: <20200915132046.3332537-1-elver@google.com> X-Mailer: git-send-email 2.28.0.618.gf4bc123cb7-goog Subject: [PATCH v2 08/10] kfence, lockdep: make KFENCE compatible with lockdep From: Marco Elver To: elver@google.com, akpm@linux-foundation.org, glider@google.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200915_142120_028560_0E120BC4 X-CRM114-Status: GOOD ( 15.10 ) X-Spam-Score: -9.6 (---------) X-Spam-Report: SpamAssassin version 3.4.4 on casper.infradead.org summary: Content analysis details: (-9.6 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:44a listed in] [list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM white-list -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_MED DKIMwl.org - Medium sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, linux-doc@vger.kernel.org, peterz@infradead.org, catalin.marinas@arm.com, dave.hansen@linux.intel.com, linux-mm@kvack.org, edumazet@google.com, hpa@zytor.com, cl@linux.com, will@kernel.org, corbet@lwn.net, x86@kernel.org, kasan-dev@googlegroups.com, mingo@redhat.com, vbabka@suse.cz, rientjes@google.com, aryabinin@virtuozzo.com, keescook@chromium.org, paulmck@kernel.org, jannh@google.com, andreyknvl@google.com, bp@alien8.de, luto@kernel.org, Jonathan.Cameron@huawei.com, tglx@linutronix.de, dvyukov@google.com, linux-arm-kernel@lists.infradead.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, penberg@kernel.org, cai@lca.pw, iamjoonsoo.kim@lge.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Lockdep checks that dynamic key registration is only performed on keys that are not static objects. With KFENCE, it is possible that such a dynamically allocated key is a KFENCE object which may, however, be allocated from a static memory pool (if HAVE_ARCH_KFENCE_STATIC_POOL). Therefore, ignore KFENCE-allocated objects in static_obj(). Co-developed-by: Alexander Potapenko Signed-off-by: Alexander Potapenko Signed-off-by: Marco Elver --- kernel/locking/lockdep.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 54b74fabf40c..0cf5d5ecbd31 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -755,6 +756,13 @@ static int static_obj(const void *obj) if (arch_is_kernel_initmem_freed(addr)) return 0; + /* + * KFENCE objects may be allocated from a static memory pool, but are + * not actually static objects. + */ + if (is_kfence_address(obj)) + return 0; + /* * static variable? */