From patchwork Tue Apr 25 22:24:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 87549 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3706296vqo; Tue, 25 Apr 2023 15:41:18 -0700 (PDT) X-Google-Smtp-Source: AKy350b5euW4+/qp+GWYJE3D3s3KcCcyDZCEW3WiBvrocedU99UoPxwwS/38MQFKJ3Ikr6EjxuYO X-Received: by 2002:a05:6a20:1443:b0:f3:532a:7150 with SMTP id a3-20020a056a20144300b000f3532a7150mr14404712pzi.0.1682462478576; Tue, 25 Apr 2023 15:41:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682462478; cv=none; d=google.com; s=arc-20160816; b=txu9eTpyeV8My0/jJW53bK7Rr1RPd1KJhrKBxeufUiOHUEwCNV+kBuzNdUL7+Tdk7R rAb2oqa2hiQve1nvbNuEiPScNXMY1dFmomk3PJanuedXPWvUw/pgUdfysi2EL7CJUrIq l0A63dMGxXL9HIIdwlcJNXG1cBypEYevSczN3Hv0UABR0t1++9xJnSEYDR90VZktOndw SuGQ9DI6ThOHakzPfdJAg+AOnXGx4APSrgHMhGmz0NPJ8uXVOx7xwbQkiLsZnhop/q// +/zJ4AvHWY8r4gcRzuLHB/U06gGbbLzzXemfo6xOlKENKD4BrEKvV02xJXkp3jiTVB9t Xv7A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=72+eO6KwavTo94Q3dwD5X6q19DNV6pOCYjiHiYVA/Vw=; b=Rmz4Ubf372wOnP+QR0AMw5cXkRHrp3as0k9YnfJ89HVmlyom47tmYIPLOGWPdTG5qV j+9xCanqb+822ohe9NoX3U+340hKPoM5rBBJIkorKAw8DPgDyO4rc/ufwtqBdAOXGc9f cMCbl8yxEQNguhQaUfJzTaXLZ0IVxC/veWAGmswxuVfs91PxqqvtWGEkNZeuta/JXGAR Gt0c0PH4WfRm0FAhqbHORILiRbynetsdZ/5NmZVarq1zKANbJBu292luSRDLCPMfMXMz odL+VoxaKE15utiC1066QAOGOTKWneb7KoTh/mmMN9dl7bPniSm0McThRXD0jSvEq0GW 10SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Grk8Bdno; 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 e6-20020a635446000000b00519b9bfd44bsi13580962pgm.569.2023.04.25.15.41.04; Tue, 25 Apr 2023 15:41:18 -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=Grk8Bdno; 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 S236369AbjDYWZB (ORCPT + 99 others); Tue, 25 Apr 2023 18:25:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236190AbjDYWY6 (ORCPT ); Tue, 25 Apr 2023 18:24:58 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 636DB5FF1 for ; Tue, 25 Apr 2023 15:24:57 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id ca18e2360f4ac-76355514e03so549679739f.0 for ; Tue, 25 Apr 2023 15:24:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682461496; x=1685053496; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=72+eO6KwavTo94Q3dwD5X6q19DNV6pOCYjiHiYVA/Vw=; b=Grk8BdnodSaCw+q2KEGxiYiB/BWivAhKBG3jYwZhxGLowfMkRBXpthNBz0x+pd+T3P 6CAtDSNrOHaEJsadCy0ZB8775sPskCbqboCd8pgull+tCAZAhHrSBr2yYvnChZ429l1W aNLhgWELCQPxiDcM9nKlOy4UJVJqEDTGoYpug3z4DVq5egXl9vztA77qAbCwgUwqoInQ 7ZYsWmtZ80pXz/WM7d2RuwccAsEaNdfmcMISDUD4XhhkFwyBq8TeJFRqYqN9kxZlR3KB 5bD+ekaggIS6DwCjFeDGRUXZP6rxMkCM3/nmhEJGxgEO4NP6+N5SRHHBKImsVGhgq95e SMMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682461496; x=1685053496; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=72+eO6KwavTo94Q3dwD5X6q19DNV6pOCYjiHiYVA/Vw=; b=CSMmm/OxKtL+S1gAsG/rjyfCZkx9GIot2TBNsp9o/sQ9idi8CIfF1RxEsWh/9ZzvMx aINQMGuhqWobjWUWZRuCi29zjrUmJEGr0kWeLwnPRYxqgfVfcVqR+h469qaWV98sLkOV B3LsP3NxPVl0qBHZoJRYZm4eicriNDfA911B6nAuGi6lWxAt2XCqPRggKwmixTPdGyhN Y1KNcj+MSeOIt7HTOY8XhWfL4CQIUuP5kA9cx6261lOK8w6U90vkFkQJbheSyqeubSsV I4oDiID8AHWaaR+2SvPXmf3wr3QqatoaB/Ld6w7CGTQue6l1SLa1AyVJD08oEunpRBhc xsLw== X-Gm-Message-State: AAQBX9codZ9ky4Cj7tIhET23yAxelcQKcbiX2SBMm4iudc6pLHc+AZED mySTVIGGYDsofW6FSyTf20MGCtvkRRE= X-Received: by 2002:a92:c809:0:b0:328:bfbd:1e87 with SMTP id v9-20020a92c809000000b00328bfbd1e87mr8356225iln.27.1682461496560; Tue, 25 Apr 2023 15:24:56 -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 13-20020a92180d000000b003244d7f2292sm3833008ily.32.2023.04.25.15.24.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 15:24:56 -0700 (PDT) From: Jim Cromie To: catalin.marinas@arm.com, linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Jim Cromie Subject: [PATCH 1/3] kmemleak: drop (age ) from leak record Date: Tue, 25 Apr 2023 16:24:44 -0600 Message-Id: <20230425222446.170486-2-jim.cromie@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230425222446.170486-1-jim.cromie@gmail.com> References: <20230425222446.170486-1-jim.cromie@gmail.com> MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764189775888243510?= X-GMAIL-MSGID: =?utf-8?q?1764189775888243510?= Displaying age is pretty, but counter-productive; it surrenders idempotency of the output, which breaks simple hash-based cataloging of the records by the user. The trouble: sequential reads, wo new leaks, get new results: :#> sum /sys/kernel/debug/kmemleak 53439 74 /sys/kernel/debug/kmemleak :#> sum /sys/kernel/debug/kmemleak 59066 74 /sys/kernel/debug/kmemleak and age is why (nothing else changes): :#> grep -v age /sys/kernel/debug/kmemleak | sum 58894 67 :#> grep -v age /sys/kernel/debug/kmemleak | sum 58894 67 Further, age is not an intrinsic property of the leak, its an artifact of when it was scanned, and relative age is embedded in leak order. While userspace could work around the always-changing output, ISTM none could be relying upon age in any important way, and having idempotent output is just better. Signed-off-by: Jim Cromie --- mm/kmemleak.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mm/kmemleak.c b/mm/kmemleak.c index a2d34226e3c8..f025c7bc845b 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c @@ -355,14 +355,12 @@ static void print_unreferenced(struct seq_file *seq, int i; unsigned long *entries; unsigned int nr_entries; - unsigned int msecs_age = jiffies_to_msecs(jiffies - object->jiffies); nr_entries = stack_depot_fetch(object->trace_handle, &entries); warn_or_seq_printf(seq, "unreferenced object 0x%08lx (size %zu):\n", object->pointer, object->size); - warn_or_seq_printf(seq, " comm \"%s\", pid %d, jiffies %lu (age %d.%03ds)\n", - object->comm, object->pid, object->jiffies, - msecs_age / 1000, msecs_age % 1000); + warn_or_seq_printf(seq, " comm \"%s\", pid %d, jiffies %lu\n", + object->comm, object->pid, object->jiffies); hex_dump_object(seq, object); warn_or_seq_printf(seq, " backtrace:\n"); From patchwork Tue Apr 25 22:24:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 87550 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3706391vqo; Tue, 25 Apr 2023 15:41:34 -0700 (PDT) X-Google-Smtp-Source: AKy350Yx1rk0v16Z1jR2SxyQjOFEDVyjMmqJy5LuFX+B5iSt9ekWt9H8Z8LnWfXLqKNnMjY6jTw8 X-Received: by 2002:a05:6a20:3d1b:b0:f0:3724:a9b0 with SMTP id y27-20020a056a203d1b00b000f03724a9b0mr24710881pzi.3.1682462494339; Tue, 25 Apr 2023 15:41:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682462494; cv=none; d=google.com; s=arc-20160816; b=SkHPjIAeZbhSXT8WpldGwoirHCjh5J+3r1rk/IW+yAiP3yhYM6UWDPI/LNtIDzLpX/ M1zyUANBx8hY3TX/gOruUXh9NijJ+sfwO7yCCWqXWVQPSRPy/8Cyk0J0JOrNFNruOy8i LWAV9oc6zLasd66ERiUmRdlSsduChwJjFnWLAk9sREYgj47shMhTgr6ewxA44d6Owdtk 16MUxXT9efETFs0EznHvaWeJPICk3pZInafm0T5KYOfsBcfUpFO9gYBHjUkubd8Jh+Vi XPbYGWaneY7452VhhzDUwsJVTPVI6Yl1afb5SQCQXLSU1KpGopTYA4QqRmLGhP48C2sO 97zg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jG/BDMHjgp3Q/HYzobpU+Hf19DrO0mL4F7UMWoWu2Oo=; b=lJz9ReZp5nAlCYnsVtBOeWnAqT4IFMOscJkL0+mspwKFYxO0SwONN2Cc1Mpimi0q8e dOBzGjC0TnuWAebm1WsUAqz4FmYXZ+3gSyHhXlEoZZowhvX9EDnKp3KS+PuUp7HFQeXV Xyu0HZrQWRV/wYrblcDVjrdFoUwvBpuUNtR4+cWLBrU2id1KUI4see7eKdIMT/B6CCsX aEAJ7S55V/gj0ilVtVi2Txhll7W9WIMOr8Phxw6EC5Mjq1qyHdroiJGJt/W/OVDb1Mz5 xveWx8nFNBWxqXEV2CVgj7YD8dOwC+tu0Pc46w2elpMAlHNhbWqiG1msyIIN+nD+qQ+Z cb8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=XHPOtqYE; 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 e127-20020a636985000000b00524ecf898a2si10920108pgc.359.2023.04.25.15.41.21; Tue, 25 Apr 2023 15:41:34 -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=XHPOtqYE; 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 S236400AbjDYWZE (ORCPT + 99 others); Tue, 25 Apr 2023 18:25:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236370AbjDYWY7 (ORCPT ); Tue, 25 Apr 2023 18:24:59 -0400 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 135555FF1 for ; Tue, 25 Apr 2023 15:24:59 -0700 (PDT) Received: by mail-il1-x134.google.com with SMTP id e9e14a558f8ab-32933a4af12so53202195ab.3 for ; Tue, 25 Apr 2023 15:24:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682461497; x=1685053497; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jG/BDMHjgp3Q/HYzobpU+Hf19DrO0mL4F7UMWoWu2Oo=; b=XHPOtqYEtkGUjozmoPSo3Xc/K1hM/UIrcAJOhoUdMcmRih9e+CrQwSBdyz5+uk4giS PhZMhIyQxVcFDe44aZHvMwhdltHKrHat0LnNOiy/J3OuH8SiXpd43EW0v3znmK4uGpgY CnXKLLTkJMbqErUqw6G2/LuUYABi3l/yz0Vs252PE6PKlUdxWq038717JEpZfZxbM+/R yMvneeIJ6mTETaffHRt6/ysgwNkFM0BNxagFZWFLxBye/2Dy5/TUmBBX0bb+rQ8Mnz0g O37rQ1jE+ei/S9K1Jtt40XTa0vUtQAbCcRxWyxxGy7urxLt51SH4X0+3FHiKqW0JDTtj /ZHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682461497; x=1685053497; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jG/BDMHjgp3Q/HYzobpU+Hf19DrO0mL4F7UMWoWu2Oo=; b=loclrCmkfLWTvb48f918meFSElZpE4dNTtZ2pIqxngcqI5OG/hQ/mKyrNj67Utk+nr ifg+4HlxiyBLaBm0hdGv2hEUwEt5JUwCiyYP2Y6dvY7f4Rw477IG52RLB89St68BvOM/ vzUDO7gnQxqNaai9YKsAQNDKc/gsBJiaZ7lbS1MpbZSpLY1YUlMozCEkfJj/O3z1g5hW J+NkgETHVlR4adhtkPxQ2wDWDJu/6EgetVtQmQwLtiJUlvPzorjlUXm1sjWkMHZH03wm dnpYFX8Zp23UfbEdTKJTmHZaleCnZAeGHKBKzhWop4oEa3mQdI77iZkesWQqn3vStjdM tlYw== X-Gm-Message-State: AAQBX9dUXXYMFZ36xfy3DNgkMKOWCO/Pbv8mizmd49pgzapJ6B4npoZX TRWkSyoCDrNeMSW5mm7bgfI= X-Received: by 2002:a92:d986:0:b0:32b:399a:afa0 with SMTP id r6-20020a92d986000000b0032b399aafa0mr9245504iln.31.1682461497534; Tue, 25 Apr 2023 15:24:57 -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 13-20020a92180d000000b003244d7f2292sm3833008ily.32.2023.04.25.15.24.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 15:24:56 -0700 (PDT) From: Jim Cromie To: catalin.marinas@arm.com, linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Jim Cromie Subject: [PATCH 2/3] kmemleak: add checksum to backtrace report Date: Tue, 25 Apr 2023 16:24:45 -0600 Message-Id: <20230425222446.170486-3-jim.cromie@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230425222446.170486-1-jim.cromie@gmail.com> References: <20230425222446.170486-1-jim.cromie@gmail.com> MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764189792760660741?= X-GMAIL-MSGID: =?utf-8?q?1764189792760660741?= change kmemleak report format: from: " backtrace:" to: " backtrace (ck ):" The allows a user to see recurring backtraces without detailed/careful reading of multiline backtraces. So after cycling kmemleak-test a few times, I know some leaks are repeating. bash-5.2# grep backtrace /sys/kernel/debug/kmemleak | wc 62 186 1792 bash-5.2# grep backtrace /sys/kernel/debug/kmemleak | sort -u | wc 37 111 1067 Signed-off-by: Jim Cromie --- mm/kmemleak.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/kmemleak.c b/mm/kmemleak.c index f025c7bc845b..2d1dfed4293d 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c @@ -362,7 +362,7 @@ static void print_unreferenced(struct seq_file *seq, warn_or_seq_printf(seq, " comm \"%s\", pid %d, jiffies %lu\n", object->comm, object->pid, object->jiffies); hex_dump_object(seq, object); - warn_or_seq_printf(seq, " backtrace:\n"); + warn_or_seq_printf(seq, " backtrace (ck %u):\n", object->checksum); for (i = 0; i < nr_entries; i++) { void *ptr = (void *)entries[i]; From patchwork Tue Apr 25 22:24:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 87551 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3706910vqo; Tue, 25 Apr 2023 15:43:00 -0700 (PDT) X-Google-Smtp-Source: AKy350bCJEGKJYCxW85CNk2JDCM6P09RsBGgEKUEccp0ViP0nN8tvZfZBsBamSTtSHQcgm2Y4LRh X-Received: by 2002:a05:6a20:3d24:b0:f0:ae73:c58a with SMTP id y36-20020a056a203d2400b000f0ae73c58amr25686242pzi.45.1682462580731; Tue, 25 Apr 2023 15:43:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682462580; cv=none; d=google.com; s=arc-20160816; b=uuyQIOiaGwENHIeXuQ+KqjccULOJZ/dWkkLVOKiWYiCv7IkQ2rZVWy0qpC+ryATuD7 8slH25KEy9WOwK1kCYF8FsMITLr04H5o9vYFwUYcVsTBDVBd9o/Wgk4qr5SSjGQUhgsO ZVgL223S5GbbP+QjK0gCfPH58rC8kggTsAkZOfeGmLeQxRhi4FmZ/PXTHqpUVHkesLlH WD6yUZ9EO15yQ4bojrlgR98+JjGtlP4FDDMH02tPgGRJhR8/bvYkOlDXhsVOmkR0PVcU qV3xiq7XV0MJJajVtWXtCDGmbKBeQxzRakWrjH0x4xl+ljOjw2rqechNMHPmjNvWG3uL +gwQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TXOb1MmhlAoVWm22dO7Ned0kntNJ0+QdEkvlYiRO8xA=; b=bl0oNkhOf2ccqIcorZuGzuT/U0pQPSkLmO23IMOPHvOctLw+uDsgujdS2Rm9mJLb/b JczV5FbyXcv+njXQ2N5+Y/omYfQ0gmNZk+mj1hkhR78KLgThRVwpvMidlrHEACrw+0cN H8fFCpYaVwEMk+acg0LCPUJwIJO4G8ul0a/zgLsQvFqM8EXd+ap3ckL2g7IUhUhLpeN4 ARh7IJe3CJmmWzuaewLwVcMJdUIpzRWGhYhsYVtWnnsD/LMkpkzcN/MhZ+/qlsD+oMrX mdn/7LD+lmIh4lZq9cPL53xhYVUsnf90G/IMQXn+j1jJiwuqyFZtQ+xlNSX+hQcwr/K3 F9Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=RSolNWsD; 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 187-20020a6306c4000000b0050be7b93e73si15986004pgg.694.2023.04.25.15.42.23; Tue, 25 Apr 2023 15:43:00 -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=RSolNWsD; 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 S236409AbjDYWZI (ORCPT + 99 others); Tue, 25 Apr 2023 18:25:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236383AbjDYWZA (ORCPT ); Tue, 25 Apr 2023 18:25:00 -0400 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F2931444E for ; Tue, 25 Apr 2023 15:24:59 -0700 (PDT) Received: by mail-il1-x131.google.com with SMTP id e9e14a558f8ab-32b482bbc26so50603775ab.1 for ; Tue, 25 Apr 2023 15:24:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682461498; x=1685053498; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TXOb1MmhlAoVWm22dO7Ned0kntNJ0+QdEkvlYiRO8xA=; b=RSolNWsDX05r6oRrt5+eJqmWdrVwAmNRi9zxyf653BaUcu+Zh+gZUpq+hE1wmXauy9 0BufCSc7LVvut6niFuxMZH4XcR92id++1QaUSppYAndIdoDfhyXGCK1zJtSEgi/DjBDN I5LoRZEna6SzLRyfTrYjDvGuljaTEeGaYSZL/6yCnvBsZ9h9426h+rXIXm5UC+Ob4cdk vYXkM7jwJm5Q+1iZRfjqhNm1rPv/OvHwOiEXtscTLyzP3YRNJ9V1XrlxsEoXoI4tgp+7 R/lUPIPBXMIUL7As62iCcoFHA4fakx+A917kIXClKosrPGCNlQzgbtKMFAirVmc3TMOo tRDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682461498; x=1685053498; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TXOb1MmhlAoVWm22dO7Ned0kntNJ0+QdEkvlYiRO8xA=; b=f0ks97wrrb32fWW6PFWlRN20MOJ0pGCWxowNI4ma4jHHF4jCbdEFHZitS9/sX94FlG 3MgVaH5wwoj5FsPD3q0EutHlmKRvg2CVtATISCnu3pTPHGfS8Q8nVdKjplbcqcvaJcKh HtAdZ/Rnd5ZIr2PGc1K+aE5havLmkzcMYN/RGKzEfukmlPib7zUGnSCdzgP5lb/I1kTJ pcz72oVc4/z+jx9BXNBa6X5aVR0AaOrGR7AgUDYRDxI3Tz7vAOKjhsnH1EMEwzHglZN5 eCj+LY76u18XpV9Hk/E8GNvM+1OtF1bTAyneFLT6Nf+K3AWA2JT75ITpAhG2SEuhuiaD aNFg== X-Gm-Message-State: AAQBX9dRuRgm14LQ4FDE5KwEr6tNjuvxgkaX9n3UzFdeY54D/MPxMf50 zWKA3AzaqrOrjkZyPVmasGQ= X-Received: by 2002:a92:cf43:0:b0:325:b15b:88a3 with SMTP id c3-20020a92cf43000000b00325b15b88a3mr9277786ilr.13.1682461498466; Tue, 25 Apr 2023 15:24:58 -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 13-20020a92180d000000b003244d7f2292sm3833008ily.32.2023.04.25.15.24.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 15:24:57 -0700 (PDT) From: Jim Cromie To: catalin.marinas@arm.com, linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Jim Cromie Subject: [PATCH 3/3] kmemleak-test: drop __init to get better backtrace Date: Tue, 25 Apr 2023 16:24:46 -0600 Message-Id: <20230425222446.170486-4-jim.cromie@gmail.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230425222446.170486-1-jim.cromie@gmail.com> References: <20230425222446.170486-1-jim.cromie@gmail.com> MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764189882878043066?= X-GMAIL-MSGID: =?utf-8?q?1764189882878043066?= 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 (ck 603070071): [<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+/ Acked-by: Catalin Marinas --- 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;