Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp5760754rwb; Tue, 17 Jan 2023 18:43:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXvhQKBT/A9LSTVqvSGtQZ2Li5qeGpnaIh/P91qAkoezPyV45XZnIhszKfHeT3V5eBN25wiN X-Received: by 2002:a17:906:6a05:b0:7c0:e98d:b27 with SMTP id qw5-20020a1709066a0500b007c0e98d0b27mr1650355ejc.58.1674009793471; Tue, 17 Jan 2023 18:43:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674009793; cv=none; d=google.com; s=arc-20160816; b=Ib6s8fX6YtGgLhcv+yncEqEfJ48R/n/rptSzCR9LGkoSjrfDJCFxHxSnwcXeIOH0Wh HErIMT8Ky4c1Jm2tNYBhiMD1CWT+ngjI96CXJTHFtIPXwdYVjQaPRqGhdMAWQflHv2dl uWD9bIbb4NAUDHAdEi8zzLU6T0/7uTOlXbzszot3j1PjL8BqrEeggz0SFhxuBPWPsXcq V0RpQckUmvUvqD1+vPE012cQfykFDwpsh9dkLgM+F4dBCiYGlXVjFHnDmI8549aaSV3l ISpOiWmzSj15waDnRbv8qJDXrabJqsTkqf7qwQNG1887W6Q366ZAx6Y9PgCUlxP0ohG7 Y7MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:to:from; bh=GSwX5JeEc09oW4yCuP33XIvxdtMqZRNTD0qPlYBVpOs=; b=CwYR/VWI8qvImQtBtPFvyYMFz0ZGU0zuAvrr4vzjFcn2jew0z8B1fSQFqJw/ng5qTg E6AsUNDtzXEP/NfxjDo+LegcwQcjVUq1muP0DN6TsqRVEeqMb04bW1/yDE4vdnhL00av +rqDdMoSND24TkxfXPvxKVZnprUOjSoutFKocFdbt48fP5uvPLdgbzX6J5a6Y7JEI5Nr vMPbetST4f0IKFYvQ7YlEu/7bvijY64k799JMqsuy0IbmpWJGMtTipMWofMujI4RuWRa bqBRbIzwER6mSOBG+paixCfPBfqvgShLNAYSqLx2ptniYHOq/15k5d8+uIPKdzH1acU0 su3A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s6-20020a056402520600b0049e0aa70a88si4212778edd.270.2023.01.17.18.43.02; Tue, 17 Jan 2023 18:43:13 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229834AbjARCJH (ORCPT + 46 others); Tue, 17 Jan 2023 21:09:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229561AbjARCIf (ORCPT ); Tue, 17 Jan 2023 21:08:35 -0500 Received: from SHSQR01.spreadtrum.com (unknown [222.66.158.135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73C3A42DDD for ; Tue, 17 Jan 2023 18:08:07 -0800 (PST) Received: from SHSend.spreadtrum.com (bjmbx01.spreadtrum.com [10.0.64.7]) by SHSQR01.spreadtrum.com with ESMTP id 30I27vdA018004; Wed, 18 Jan 2023 10:07:57 +0800 (+08) (envelope-from zhaoyang.huang@unisoc.com) Received: from bj03382pcu.spreadtrum.com (10.0.74.65) by BJMBX01.spreadtrum.com (10.0.64.7) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Wed, 18 Jan 2023 10:07:52 +0800 From: "zhaoyang.huang" To: Andrew Morton , Catalin Marinas , Vlastimil Babka , "Nathan Chancellor" , Peter Zijlstra , Zhaoyang Huang , , , , Mirsad Todorovac Subject: [PATCHv3] mm: use stack_depot_early_init for kmemleak Date: Wed, 18 Jan 2023 10:07:35 +0800 Message-ID: <1674007655-23016-1-git-send-email-zhaoyang.huang@unisoc.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.0.74.65] X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL: SHSQR01.spreadtrum.com 30I27vdA018004 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS 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: Zhaoyang Huang Mirsad report bellow error which caused by stack_depot_init failed in kvcalloc. Solve this by having stackdepot use stack_depot_early_init. On 1/4/23 17:08, Mirsad Goran Todorovac wrote: I hate to bring bad news again, but there seems to be a problem with the output of /sys/kernel/debug/kmemleak: [root@pc-mtodorov ~]# cat /sys/kernel/debug/kmemleak unreferenced object 0xffff951c118568b0 (size 16): comm "kworker/u12:2", pid 56, jiffies 4294893952 (age 4356.548s) hex dump (first 16 bytes): 6d 65 6d 73 74 69 63 6b 30 00 00 00 00 00 00 00 memstick0....... backtrace: [root@pc-mtodorov ~]# Apparently, backtrace of called functions on the stack is no longer printed with the list of memory leaks. This appeared on Lenovo desktop 10TX000VCR, with AlmaLinux 8.7 and BIOS version M22KT49A (11/10/2022) and 6.2-rc1 and 6.2-rc2 builds. This worked on 6.1 with the same CONFIG_KMEMLEAK=y and MGLRU enabled on a vanilla mainstream kernel from Mr. Torvalds' tree. I don't know if this is deliberate feature for some reason or a bug. Please find attached the config, lshw and kmemleak output. reported-by: Mirsad Todorovac suggested-by: Vlastimil Babka Signed-off-by: Zhaoyang Huang --- v2: use stack_depot_want_early_init instead of CONFIG_STACKDEPOT_ALWAYS_INIT v3: have the Kconfig changes commited in another patch --- Signed-off-by: Zhaoyang Huang --- mm/kmemleak.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/kmemleak.c b/mm/kmemleak.c index 762b91f..ddc1ddf 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c @@ -2070,8 +2070,10 @@ static int __init kmemleak_boot_config(char *str) return -EINVAL; if (strcmp(str, "off") == 0) kmemleak_disable(); - else if (strcmp(str, "on") == 0) + else if (strcmp(str, "on") == 0) { kmemleak_skip_disable = 1; + stack_depot_want_early_init(); + } else return -EINVAL; return 0; -- 1.9.1