Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1358871ybk; Sun, 10 May 2020 14:31:20 -0700 (PDT) X-Google-Smtp-Source: APiQypJgqum+GVQ8NTVL+S/LAuooBHF7gj8fBBJijFb4dfEbjhja3bLmnNqKpTk5cp79bBym+8Gr X-Received: by 2002:a17:907:396:: with SMTP id ss22mr10086159ejb.226.1589146280372; Sun, 10 May 2020 14:31:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589146280; cv=none; d=google.com; s=arc-20160816; b=ppCdChdvK1LR91SM6eDojH5QI4Umtl8K9L+4g7mgzvz5XwYvwesUnLEuaAaXWVnLhd gi7ALvGxePTu0OKoSHP6gHbLyMmtPjRc3ckJuBUmLMJ5rJOcndtpwd1Zl/lALqIuIad2 eHX4hDzcB5+g6JsUpVocNwIjaxPW+2lAsUhppQqDXoFPouNpqxSjYDqQJ9RQt42vv3Ts jNYiNnhpRoWps7oEazSueQ7+/6xJQWNdZnDRsmyfEb9g4zWtvsVROY2mp8SiE36Epf1e emMOK7g+ggphRUDXP1qcsnnw1UiC1X8agal+OB6Dn6/C5dVrh9NyIpmQuiOs6ybV8CAP Ofmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=AjJla7ef1KOTTwImARPcnvepPnsINer0cTmrGksfAhk=; b=ELKqk1cpbCYdxeVeVirdMnczhQ3r5NhYfsjx7KjeBUzQ7gaC4REmCbnvWSuGQ7u8xp U39bzrqo2+jtlYvldgEl+CkdhHG/3zbNmnFowtIE1WAWk8xTBBJKSW1msLUWMFKL8ExZ uUUmhPWSoke8LxEHd6Ygbni0pQRdC41FV+Cf9bmTFymdUIruUJGt1mwTuWSV50LkJSlX NxGBQUdzMVymA3yIz2tnEaDq6FDYJkb2FSaTJUGczYhtpl1eXnIf4DC0TtVXh15LaeYz CgKVAJECzyLrgG50OllphIZdwDQYLexe++WjKlxt72Psj29aTDzofA0nKWzepy8a+/ON Jdhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b=K7kiQedz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h11si4696848ejc.416.2020.05.10.14.30.57; Sun, 10 May 2020 14:31:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b=K7kiQedz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729276AbgEJV1p (ORCPT + 99 others); Sun, 10 May 2020 17:27:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728823AbgEJV1p (ORCPT ); Sun, 10 May 2020 17:27:45 -0400 Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EB4EC061A0C for ; Sun, 10 May 2020 14:27:44 -0700 (PDT) Received: by mail-qt1-x82e.google.com with SMTP id z90so6364769qtd.10 for ; Sun, 10 May 2020 14:27:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=AjJla7ef1KOTTwImARPcnvepPnsINer0cTmrGksfAhk=; b=K7kiQedzlUVkQxQmJUldUTnHzJ3a45gjghGi8fKcjYi94VuXrGQBjQqXQntOJWaZHa u32EfUywzsbHRpTKA1rIw3uPHF5OfyKzNcb/dVFblyMH4wkxTsgDk5HjOqB1PJiaVai9 mTyxj3/sgh1VGBQsIR57Fs3A4jPvuD8rqVnLwRt2C9WFefv5Buw4sJEQGoK8Zd14F1c1 6wmjUlUYHpq/ADAh5FANLrU8coI97xUgqnuhvFO2JhbOAAuGfrZ6l5qxh76EztcohwSr PIbUO1S2HsLKORAlkdbbe8gVe9JcYLqeKSsb44JaDznoPpzw4m6JhHhkcAd7Ap0f6N1Z bWqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=AjJla7ef1KOTTwImARPcnvepPnsINer0cTmrGksfAhk=; b=hibgtFKiaQzljOIEWz/gT+xn8sskVcMv70yigi5OZcZxP1Wp2J26Nizv78+EBpl9bD MWrKTtZrtc0uq/J89Yxi72F77cEwFWQ8yENK3PUqe1b783isGYHJTJge75PWKcrwK3M0 B3H2UGJ9StBl3CMwjiNjWCNgi3KB7Ljjr8oEupLJc+SLWMX8KM7jRD1J929KTieYisnM aFYRh3cV85MdvidSzhAu86pPX4bbCkz9XY/nEb02IlNydKiyg/K+2h8CUK4KXEEjAzqT wtAUF/ieK+0OrLEMxdcqiPmFgyvWE1pxLzmN2EREyV7jj7A1VOpTyyfl+/hb8sU1gqGF 8kBw== X-Gm-Message-State: AGi0Pub5gro3U1JSEz6zeKvppGOmDCiMYGAIcbYK++2wjybA/LRWRlCF 3O5FDQBwxbft664/+RaXmgJipiy/d1Sd7A== X-Received: by 2002:ac8:f10:: with SMTP id e16mr13001033qtk.89.1589146062865; Sun, 10 May 2020 14:27:42 -0700 (PDT) Received: from [192.168.1.153] (pool-71-184-117-43.bstnma.fios.verizon.net. [71.184.117.43]) by smtp.gmail.com with ESMTPSA id c26sm6605618qkm.98.2020.05.10.14.27.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 May 2020 14:27:42 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: Kmemleak infrastructure improvement for task_struct leaks and call_rcu() From: Qian Cai In-Reply-To: <20200509094455.GA4351@gaia> Date: Sun, 10 May 2020 17:27:41 -0400 Cc: Linux-MM , LKML , "Paul E. McKenney" Content-Transfer-Encoding: quoted-printable Message-Id: <3F734E14-8E37-4967-B080-A25D0C58199C@lca.pw> References: <20200507171607.GD3180@gaia> <40B2408F-05DD-4A82-BF97-372EA09FA873@lca.pw> <20200509094455.GA4351@gaia> To: Catalin Marinas X-Mailer: Apple Mail (2.3608.80.23.2.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On May 9, 2020, at 5:44 AM, Catalin Marinas = wrote: >=20 > On Thu, May 07, 2020 at 01:29:04PM -0400, Qian Cai wrote: >> On May 7, 2020, at 1:16 PM, Catalin Marinas = wrote: >>> I don't mind adding additional tracking info if it helps with = debugging. >>> But if it's for improving false positives, I'd prefer to look deeper >>> into figure out why the pointer reference graph tracking failed. >>=20 >> No, the task struct leaks are real leaks. It is just painful to = figure >> out the missing or misplaced put_task_struct() from the kmemleak >> reports at the moment. >=20 > We could log the callers to get_task_struct() and put_task_struct(), > something like __builtin_return_address(0) (how does this work if the > function is inlined?). If it's not the full backtrace, it shouldn't = slow > down kmemleak considerably. I don't think it's worth logging only the > first/last calls to get/put. You'd hope that put is called in reverse > order to get. >=20 > I think it may be better if this is added as a new allocation pointed = to > from kmemleak_object rather than increasing this structure since it = will > be added on a case by case basis. When dumping the leak information, = it > would also dump the get/put calls, in the order they were called. We > could add some simple refcount tracking (++ for get, -- for put) to > easily notice any imbalance. >=20 > I'm pretty busy next week but happy to review if you have a patch ;). I am still thinking about a more generic way for all those = refcount-based leaks without needing of manual annotation of all those = places. Today, I had another one, unreferenced object 0xe6ff008924f28500 (size 128): comm "qemu-kvm", pid 4835, jiffies 4295141828 (age 6944.120s) hex dump (first 32 bytes): 01 00 00 00 6b 6b 6b 6b 00 00 00 00 ad 4e ad de ....kkkk.....N.. ff ff ff ff 6b 6b 6b 6b ff ff ff ff ff ff ff ff ....kkkk........ backtrace: [<000000005ed1a868>] slab_post_alloc_hook+0x74/0x9c [<00000000c65ee7dc>] kmem_cache_alloc_trace+0x2b4/0x3d4 [<000000009efa9e6e>] do_eventfd+0x54/0x1ac [<000000001146e724>] __arm64_sys_eventfd2+0x34/0x44 [<0000000096fc3a61>] do_el0_svc+0x128/0x1dc [<000000005ae8f980>] el0_sync_handler+0xd0/0x268 [<0000000043f2c790>] el0_sync+0x164/0x180 That is eventfd_ctx_fileget() / eventfd_ctx_put() pairs.=