Message ID | 20230525174356.69711-1-jim.cromie@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp557110vqr; Thu, 25 May 2023 11:03:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ68onZWQ6sxvk6CWiV5qSNyY4eP6A1pbcf26z1h8z4b1HZ0a1uFFUhKfVN2czY94Af/b0p2 X-Received: by 2002:a05:6a20:6a28:b0:10b:2ed8:1859 with SMTP id p40-20020a056a206a2800b0010b2ed81859mr19438968pzk.6.1685037835851; Thu, 25 May 2023 11:03:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685037835; cv=none; d=google.com; s=arc-20160816; b=D6fMvGTR+4ep/eqmAzwFoc1k9DX1DG/PVJ8kKElbtCSwAWCr1+GTVZBBZnWS6CpeOi ZtgrPekITIU4McyZWQ1i79oGQEvq4+et73MsGaCzl3XvBOd+5UGT76XSvFA5XaOvYNOV /sJIJVfbsopHDDvP7LMPZtlizIcvbLZGZuEO8aIIav/aJZYElGtY6bg3N24JWAC2Bp2U XqZxKudS4COGCflMy9u+b+m9/XYrO+uZ7p07zC9Gr64sUB3+Z5g2PQD8/SVAgKCy2pqv F9uz7NOxjwybAwvNLbfehBX3uxOjIJj68xLtmYWf4Q3OmUtFKnliecXtVtXsummgBVUb qImA== 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=IF5KlPvZ3QkxhsNhcL5v5OvfHHuGbTugqg2l5EV6fIo=; b=cfisgSUGGgZZsSB6Dy4kGRtmvdbi+NZPxAk275D5FPPjaMtij4HzBf3mxv9YhfHqrg GCj9BRl5UGdZ0w1Eb3etK1rTdMvtFQ4TnhDDW5d4vUBPGhNtDqaNHLWVkclHR67nDU/G XPrwOEj6OdYWtGdV0vbjb3QhlRSfEDAtzjju1Uk8yZ+6uQnNUZ9bJKmeOHsyoc0zh83X 54ut22xUvZeXDLRhPr2zVRb7T1gdY9JJJR9qkEZaL2AEFBjLAuoIj0VLiYZBGZSjiKpU h9QTzk11P1FVpnbzltE5ZDCWed2R246TD0d4eWsKK1MHBOvn1/JZ/d1NN4eqdH0ffzxK UEUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=JCRbn+P8; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a24-20020aa795b8000000b0063b5e9c3c28si1992010pfk.35.2023.05.25.11.03.43; Thu, 25 May 2023 11:03:55 -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=@gmail.com header.s=20221208 header.b=JCRbn+P8; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240444AbjEYRop (ORCPT <rfc822;ahmedalshaiji.dev@gmail.com> + 99 others); Thu, 25 May 2023 13:44:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235065AbjEYRok (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 25 May 2023 13:44:40 -0400 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D449FE47 for <linux-kernel@vger.kernel.org>; Thu, 25 May 2023 10:44:05 -0700 (PDT) Received: by mail-io1-xd33.google.com with SMTP id ca18e2360f4ac-77493b3d18cso168155739f.0 for <linux-kernel@vger.kernel.org>; Thu, 25 May 2023 10:44:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685036644; x=1687628644; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=IF5KlPvZ3QkxhsNhcL5v5OvfHHuGbTugqg2l5EV6fIo=; b=JCRbn+P864KdKm8u2FM6ZbKkD5iM5qMtSvm4oIaSuhE6g6g3Lh/wAZ6M58YTvidbd8 YtW3spNmcei+kA5NJWkRiTe30YvNTVfwlnfgmk1KQi9xVhPTj3iApXgvuUN9lTsBS5eM Z6cT5hYmtnLR73Hk1SKpZvcUToGSYFh7JuPKIR5igGUiMEWDsSiupAOcHT6BXfyOj6hH oB6L0xBImdFML8nGkUzItRVzdkZcW/iGX5CsXBTXeQ21RvrK1rHnV0KHRuz/qbln3c3m FFrguON5V+pOi8cwYFEdCd5Ew20xEErNsQEr34vE9ovNG98vkBbA4HyRw+OtTPoG4Nuc TYyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685036644; x=1687628644; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IF5KlPvZ3QkxhsNhcL5v5OvfHHuGbTugqg2l5EV6fIo=; b=i0Y6Gg0bEue8qtGhozhNwnwfGvwgYgwwf2UOL2A8xK1dObhPYIE2DdhcwlUKlwKFvA ZFC/FyjJLJJCkxGMdRpFd3j6BbePuzGkJbmAT/d8hyAX7Sh7d8usj7UO5gtOJba3/BCu vG6+mth7nKl38pTmGCKG2SJHq3G3OTT4jf/d3blFhYBGcYGl1j4dqI5mafnzxtGgtPev jr+rXArYEnPkrGph7uJni6dPr4Z5sWqpQVL82EO9VA6wlsxSpP6oAVZ9B8M8AKuuOBvE ZrDCOnzBzNY6yyrWbJyCk3ztVXD415UrundTowuHx0NHq7b0hZLs3UZ7sSj5xVMJTSos Wt4A== X-Gm-Message-State: AC+VfDxNkttai/BpzX9W3cjALzynLpmkFEu4fJQ2W/PNAAyO/Hd41cC3 hn7fzQL8DPeN85S+btS1yj36Og4/1Mw= X-Received: by 2002:a6b:7214:0:b0:774:7cee:3803 with SMTP id n20-20020a6b7214000000b007747cee3803mr283107ioc.13.1685036644390; Thu, 25 May 2023 10:44:04 -0700 (PDT) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id e38-20020a028629000000b004141e72be1asm547841jai.175.2023.05.25.10.44.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 10:44:04 -0700 (PDT) From: Jim Cromie <jim.cromie@gmail.com> To: catalin.marinas@arm.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org Cc: Jim Cromie <jim.cromie@gmail.com> Subject: [PATCH] kmemleak-test: drop __init to get better backtrace Date: Thu, 25 May 2023 11:43:56 -0600 Message-Id: <20230525174356.69711-1-jim.cromie@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766890233872930221?= X-GMAIL-MSGID: =?utf-8?q?1766890233872930221?= |
Series |
kmemleak-test: drop __init to get better backtrace
|
|
Commit Message
Jim Cromie
May 25, 2023, 5:43 p.m. UTC
Drop the __init on kmemleak_test_init(). With it, the storage is reclaimed, but then the symbol isn't available for "%pS" rendering, and the backtrace gets a bare pointer where the actual leak happened. unreferenced object 0xffff88800a2b0800 (size 1024): comm "modprobe", pid 413, jiffies 4294953430 hex dump (first 32 bytes): 73 02 00 00 75 01 00 68 02 00 00 01 00 00 00 04 s...u..h........ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<00000000fabad728>] kmalloc_trace+0x26/0x90 [<00000000ef738764>] 0xffffffffc02350a2 [<00000000004e5795>] do_one_initcall+0x43/0x210 [<00000000d768905e>] do_init_module+0x4a/0x210 [<0000000087135ab5>] __do_sys_finit_module+0x93/0xf0 [<000000004fcb1fa2>] do_syscall_64+0x34/0x80 [<00000000c73c8d9d>] entry_SYSCALL_64_after_hwframe+0x46/0xb0 with __init gone, that trace entry renders like: [<00000000ef738764>] kmemleak_test_init+<offset>/<size> Signed-off-by: Jim Cromie <jim.cromie@gmail.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> --- samples/kmemleak/kmemleak-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/samples/kmemleak/kmemleak-test.c b/samples/kmemleak/kmemleak-test.c index 7b476eb8285f..6ced5ddd99d4 100644 --- a/samples/kmemleak/kmemleak-test.c +++ b/samples/kmemleak/kmemleak-test.c @@ -32,7 +32,7 @@ static DEFINE_PER_CPU(void *, kmemleak_test_pointer); * Some very simple testing. This function needs to be extended for * proper testing. */ -static int __init kmemleak_test_init(void) +static int kmemleak_test_init(void) { struct test_node *elem; int i;