From patchwork Thu Nov 16 22:43:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 165957 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp162108vqn; Thu, 16 Nov 2023 14:44:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IEHHzWwv9qhGuqbPaXG66MkYGqnihYu+q1q+adPApT5yHTfg8HUfvLZFYGbaB+4RPkTmYNO X-Received: by 2002:a05:6808:1891:b0:3a7:55f2:552d with SMTP id bi17-20020a056808189100b003a755f2552dmr21601422oib.58.1700174659204; Thu, 16 Nov 2023 14:44:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700174659; cv=none; d=google.com; s=arc-20160816; b=0CmxvFUCbJ7Z2BHHf+qeO5okPVWc5wa+m7Xg3smYaFgnnP333E2VixAx08mEj4u8hf 3lNByuYUMhqtVN+A/9IcKLk3oxbPgVPanV0a31gU+o+U9UDURSRH6e508jsYTmTB+/UU 19njDnvTdxdRAKz/Vby500H05mvbJulWNiSRbP45jTMBuJFZsr/zjFCrv8f0KgrwgKRo V+pjYpGo3wdg9RHRbCJK56dq2ev3hzNe/Fb4alMKv4Yw9b02AtA9bgwGCZq+IbyfzZWN QKZ9TeJ76lYRz6y72toTYdBAa/WynCmruexAaN3XggI26j1TGx5qJmNu7mYpnQxRl2K+ HW1Q== 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=+7CJRAJ5zmc/CyN0iNuUX7460eksgbeoQL+z27nuIOo=; fh=EgVkNH+Cb9K8YOTSQBPxNV2o+rDWdzEBRqk7dHoL+c0=; b=kt/RfCl/cZI7Mm2wHisWY1RN3cOAs1cNuT0UQL8X9tz9Lw6N0szKxZwHt6qxlKm0jh mW6fMyHuYTF8ALF54MV5KXNOCgQklBx+GWZCn+ZovZJxY2qU4JlnY1l/k3k33kEu1XE8 G3f5nf6mZLJ20QEcAVBBIQplfWiOuheTr6KsAnusZ7rgEcPzcLYMtWzuX7IIIyFivMpC WzW8rryfBeEJO855PbUYiyDl9KzrIbXWBWImI8HbXbrPyIGds1dLmDHY1kIkd11AmmLw QrdXDrbhtK/RVcm3oDPyJH9VPuhWrQn9Jmiuhxsm69vaPom+ZnmZSDlYUygEjyOYvn5v Z9hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=fxdtQAdB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id a15-20020a63cd4f000000b005b21d089aa7si452143pgj.788.2023.11.16.14.44.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 14:44:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=fxdtQAdB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 938E2803FCC4; Thu, 16 Nov 2023 14:44:15 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345577AbjKPWnp (ORCPT + 30 others); Thu, 16 Nov 2023 17:43:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345562AbjKPWnn (ORCPT ); Thu, 16 Nov 2023 17:43:43 -0500 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EE76131 for ; Thu, 16 Nov 2023 14:43:40 -0800 (PST) Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-3594560fa09so5192775ab.0 for ; Thu, 16 Nov 2023 14:43:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700174619; x=1700779419; darn=vger.kernel.org; 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=+7CJRAJ5zmc/CyN0iNuUX7460eksgbeoQL+z27nuIOo=; b=fxdtQAdBxC0gIesxs4iCPiOmubUa3eVLCiyQDJjjdvhoBpI/kvw+43UTTqAXuu/g3D MywefD3GS71k3ovxLHsK8NmB5QuZ04YuJWOGLOCbSMGwfr/F7FesMyMfjAREfLSqVDKL ipxra8lphS5dkjRLo5hWbzXwBN01jJM2MoLX0GB6rsEobOaF//W0XjT/2744QVy0ODbB 4ReCuGHirAyp5/uTozkolORgV7bT7L9W2newIWgv36vRynimfKk0LPaXXWf9whRIOdKa auM1KT/fUh1LFUHVfrgPdDafEhKEN8x4B/HVt/xpfsWHFDC435RJqwUnDeIgPGlMXDHC cOaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700174619; x=1700779419; 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=+7CJRAJ5zmc/CyN0iNuUX7460eksgbeoQL+z27nuIOo=; b=hOicE6XxhrY+zRHTDKoqxPBRhxOCDzdIqGj3R07m51++Sq+a5EViQRRNG3XJiMCd/N 2PpHVithS3tNRVuhjk4hB3rahDiJ9Rx3ngHn0G291h3rKAXcX5mFPTmMGAFlrcFESlN5 Fahms3/Cd8PAN8RiuQS9btB+AY5AiXcWf2g2gXLCQTBDgzdFLgTndgU8zk3OMhWUA8g4 KJkP9AjPbQYysgwDpr8OkN66uQYN4L2RrmoNnhwUcbG7qIjBQid+waNRDuIM8pGR6urD aAyr7Kv4cPyvsMLOHlfKE7xX9TNGXg7Nv/cbQXHJTEABOaSyp5gAO8u1u264oKkYFfyc ViNg== X-Gm-Message-State: AOJu0YwvyM3YjF7nSLyPsGKY02sDh2sWHvQjhUTT6jY1Q1K9thqnMa30 oavpp2OBXUckHkQJ3AuonTBru+bOaxA= X-Received: by 2002:a05:6e02:19c8:b0:358:1b:f8fa with SMTP id r8-20020a056e0219c800b00358001bf8famr23868182ill.32.1700174619453; Thu, 16 Nov 2023 14:43:39 -0800 (PST) Received: from frodo.. (c-73-78-62-130.hsd1.co.comcast.net. [73.78.62.130]) by smtp.googlemail.com with ESMTPSA id g12-20020a92520c000000b0035913c8423esm84399ilb.73.2023.11.16.14.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 14:43:38 -0800 (PST) From: Jim Cromie To: linux-kernel@vger.kernel.org Cc: catalin.marinas@arm.com, akpm@linux-foundation.org, Jim Cromie Subject: [PATCH 1/2] kmemleak: drop (age ) from leak record Date: Thu, 16 Nov 2023 15:43:17 -0700 Message-ID: <20231116224318.124209-2-jim.cromie@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231116224318.124209-1-jim.cromie@gmail.com> References: <20231116224318.124209-1-jim.cromie@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 16 Nov 2023 14:44:15 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782762343464768335 X-GMAIL-MSGID: 1782762343464768335 Displaying age is pretty, but counter-productive; it changes with current-time, so 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 Since jiffies is already printed in the "comm" line, age adds nothing. Notably, syzkaller reads kmemleak only for "unreferenced object", and won't care about this reform of age-ism. A few moribund github repos mention it, but don't compile. Signed-off-by: Jim Cromie Reviewed-by: Catalin Marinas --- mm/kmemleak.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mm/kmemleak.c b/mm/kmemleak.c index 1eacca03bedd..10c9b611c395 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");