From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D78E4EB64D9 for ; Sun, 2 Jul 2023 19:44:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231937AbjGBToh (ORCPT ); Sun, 2 Jul 2023 15:44:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232183AbjGBTnp (ORCPT ); Sun, 2 Jul 2023 15:43:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FB362697; Sun, 2 Jul 2023 12:42:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D11A360CFB; Sun, 2 Jul 2023 19:41:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACB04C433C9; Sun, 2 Jul 2023 19:41:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688326903; bh=v3UNLIGYW4I12pnACott4dXG1CeRk8h1obmjUF7Cg1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LCK6k1zty9XZ8epl4SkxkRgPqvbKlZsiSKpPxbMO/5EQPK2/IgMBwVHOTBDrSqDEe NChCraO817Qu+N/ZYnCxnRoqEFRIg0w2Lw3RvWghyEHrzujk/G5RKV0RDyVKpfXcdy pSpfweEJWB9nfMjlOx6XVdfJbNaGavSebVNGw9V0/lcu6MlBeRAW2QtbSU0Na+krTc wPB3L0O0NrYAq9YcNLKXCM/7fWIIuwSyiI/l0Y3uZpqpI8qQ+kvlT9hXSY/qOdbgls oib1qqUiMeCiXcQ400R1PShELG4xZ47L4s5vAmS5lEJ0EtiI4b1eW2jStmOFKqxyLI RrxvcDvUx+/+w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tetsuo Handa , syzbot , Thomas Gleixner , Sasha Levin Subject: [PATCH AUTOSEL 5.15 02/10] debugobjects: Recheck debug_objects_enabled before reporting Date: Sun, 2 Jul 2023 15:41:31 -0400 Message-Id: <20230702194139.1778398-2-sashal@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230702194139.1778398-1-sashal@kernel.org> References: <20230702194139.1778398-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.15.119 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tetsuo Handa [ Upstream commit 8b64d420fe2450f82848178506d3e3a0bd195539 ] syzbot is reporting false a positive ODEBUG message immediately after ODEBUG was disabled due to OOM. [ 1062.309646][T22911] ODEBUG: Out of memory. ODEBUG disabled [ 1062.886755][ T5171] ------------[ cut here ]------------ [ 1062.892770][ T5171] ODEBUG: assert_init not available (active state 0) object: ffffc900056afb20 object type: timer_list hint: process_timeout+0x0/0x40 CPU 0 [ T5171] CPU 1 [T22911] -------------- -------------- debug_object_assert_init() { if (!debug_objects_enabled) return; db = get_bucket(addr); lookup_object_or_alloc() { debug_objects_enabled = 0; return NULL; } debug_objects_oom() { pr_warn("Out of memory. ODEBUG disabled\n"); // all buckets get emptied here, and } lookup_object_or_alloc(addr, db, descr, false, true) { // this bucket is already empty. return ERR_PTR(-ENOENT); } // Emits false positive warning. debug_print_object(&o, "assert_init"); } Recheck debug_object_enabled in debug_print_object() to avoid that. Reported-by: syzbot Suggested-by: Thomas Gleixner Signed-off-by: Tetsuo Handa Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/492fe2ae-5141-d548-ebd5-62f5fe2e57f7@I-love.SAKURA.ne.jp Closes: https://syzkaller.appspot.com/bug?extid=7937ba6a50bdd00fffdf Signed-off-by: Sasha Levin --- lib/debugobjects.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/debugobjects.c b/lib/debugobjects.c index 579406c1e9ed9..048e824a79316 100644 --- a/lib/debugobjects.c +++ b/lib/debugobjects.c @@ -501,6 +501,15 @@ static void debug_print_object(struct debug_obj *obj, char *msg) const struct debug_obj_descr *descr = obj->descr; static int limit; + /* + * Don't report if lookup_object_or_alloc() by the current thread + * failed because lookup_object_or_alloc()/debug_objects_oom() by a + * concurrent thread turned off debug_objects_enabled and cleared + * the hash buckets. + */ + if (!debug_objects_enabled) + return; + if (limit < 5 && descr != descr_test) { void *hint = descr->debug_hint ? descr->debug_hint(obj->object) : NULL; -- 2.39.2