From patchwork Mon Sep 21 13:26:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Elver X-Patchwork-Id: 11789901 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 2EFF36CA for ; Mon, 21 Sep 2020 13:44:15 +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 BF25320888 for ; Mon, 21 Sep 2020 13:44:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="aNK5PurD"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="ppenswL8"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="AwQ3SH4R" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF25320888 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=WjygTDe5vZPUSMhK3I+JHB5dxKw80QItjrB6v+iRL1Y=; b=aNK5PurDBauGSz8rqrL6Nva9I Fw4L/DjHqpTEzTJjBDskIb+V2iZ6025H7ctYDEuMW1UQmtlG7/yE+5u3RHcP0BYGLzyCJdxemeBM+ fkxK47wSA2RSHNCYJwIcir7dNB7HW2D+j1MUey0hnIlY8lHdocju2AlP1y5tiBqzxykw9ULERrxz5 yuugR/nUXOAFUbmPjrehJrUjPcMmWi0/gI3O4VamMu5Z8BMQQlajNPW2x/dP/Mv8j0Hm2RWeqK7+1 Jk7MDRmmE2VLJeV3xEa/WuqYxlN8OyoiV1IkWfnOc6jEPoK8S9JHqtf8Jwnr0mkb/b4aC0fNqUzzF JkS/XPyDA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKM6p-0002lZ-2L; Mon, 21 Sep 2020 13:43:59 +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 1kKM6f-0002gy-9Y for linux-arm-kernel@merlin.infradead.org; Mon, 21 Sep 2020 13:43:49 +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=+R3FkgLg/uUxAfttfYVSjxdiI+HJZltSBRxJWgKHPWI=; b=ppenswL894vtVWEBUOh5/G3wob PS2ypYkbp23Ty3v1IeaXkSw89TFoCYJO4EVMyh+p5ii3895zbI25lYI44WriKZG6rBTkhTRCrkL1u 8gux+UDWVdiXonRM3k580XD08/2U+5LhFRwr2YYGZNvX5akBktcfo+v0Stk9zWFD8ObwM7Mgae5gV kzGgvkiqUJ/omUdhCEqdn011Y/BIBI19LwNelaEhHwGyWClAHwzR2JjOsQoP3mMKmlO//VlQHK25T eHuwUMNDxBOpT8lV1+YCaEP21RXqgVTyGPcmGybAa2LViTxMZWQL6h03GLi/3E/nBByy0AHPxRP6h b5OI9q1w==; Received: from mail-qv1-xf49.google.com ([2607:f8b0:4864:20::f49]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKLqN-0003fC-5i for linux-arm-kernel@lists.infradead.org; Mon, 21 Sep 2020 13:27:01 +0000 Received: by mail-qv1-xf49.google.com with SMTP id h9so8949938qvr.3 for ; Mon, 21 Sep 2020 06:26:58 -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=+R3FkgLg/uUxAfttfYVSjxdiI+HJZltSBRxJWgKHPWI=; b=AwQ3SH4RPdmBRFAyoSOJHU//nXO51R9eb6z2HWBBP/5KLsyCveVvAjoS/15dev1nHk C1V6mTtovAY3Pzkn8XqqyXRcPtoZVTxMDg8Lp1weN8lPN8YN3uLOinjVacYCllLMgok5 f8ha/FnRT9SaJb+NLdV7pTTsSpCC3hub0bb12gt3j8skHWk/JUktSY1U4lt6/xjuVoYP Y8nZ69cULu3nVdjxXK3zwVHwE7HMrbUr9dFp35w3c6SkDDqYTt2E/6153FiTwMQdZRnX Q2lU7puug9u1gp2aen8hAYYse1dBtG4FTtkn9TLUxm7/9W/TmRC5Poh9NfcYqpi2wrIH RplQ== 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=+R3FkgLg/uUxAfttfYVSjxdiI+HJZltSBRxJWgKHPWI=; b=q90klUhCu9t0JeKMkmzxBrzME60Cs3j9XXknZcsCPU/DGtBOKGz6tXGDAy51BrhUrH 1s/U9J0Tsq6rAbKTBJ27OC8eXWW+xXr7N1P2K8MysParwMhgKnIWNPRgQYiqQZ4Bo0dV /pwHXXAPmeUQkT6ScK/Q/7vQ7fz44GD5ohbzcqhQ8/xA9kl7F3odIRCfOgjUikxa9HJD CYrHCNJbLXD9dQT7YiD+xZUdEuCAmx6IpgzArZoVg+apfwHiWunj85i7eWhVWjyiOB0i S/BMD6K2T7ZWn6i8ENqP85gD+lbFrLwebVwV303vjlmF6mYMvcAdSI8R3GuJ7ROg4lA0 Es6A== X-Gm-Message-State: AOAM531tfrdQ17XSHYOUzpbwBzskjPq39937oDlV/dcIWOo1p2bWa2Mr KaAV71RRf9+QcYN4tEciBeaA7sGW+Q== X-Google-Smtp-Source: ABdhPJzdcj1vXa9IRzgIJT+0KIMH13pc+xxOpm4AAO5fmze8y5104JWt6jdjS+3w6lHF/NGj6w+Ksxvu5Q== X-Received: from elver.muc.corp.google.com ([2a00:79e0:15:13:f693:9fff:fef4:2449]) (user=elver job=sendgmr) by 2002:a0c:c709:: with SMTP id w9mr46105935qvi.26.1600694816482; Mon, 21 Sep 2020 06:26:56 -0700 (PDT) Date: Mon, 21 Sep 2020 15:26:09 +0200 In-Reply-To: <20200921132611.1700350-1-elver@google.com> Message-Id: <20200921132611.1700350-9-elver@google.com> Mime-Version: 1.0 References: <20200921132611.1700350-1-elver@google.com> X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog Subject: [PATCH v3 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-20200921_142659_320771_EA9B9424 X-CRM114-Status: GOOD ( 14.43 ) 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 ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:f49 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM white-list 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -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, hdanton@sina.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, sjpark@amazon.com, 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, 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(). Reviewed-by: Dmitry Vyukov 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? */