From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5151BC48BDF for ; Sun, 20 Jun 2021 16:02:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CE5086113E for ; Sun, 20 Jun 2021 16:02:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE5086113E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 13DFD6B006C; Sun, 20 Jun 2021 12:02:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1149C6B0070; Sun, 20 Jun 2021 12:02:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EF79D6B0072; Sun, 20 Jun 2021 12:01:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0167.hostedemail.com [216.40.44.167]) by kanga.kvack.org (Postfix) with ESMTP id BA8A36B006C for ; Sun, 20 Jun 2021 12:01:59 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 4338F181AEF15 for ; Sun, 20 Jun 2021 16:01:59 +0000 (UTC) X-FDA: 78274568358.10.A9D86B2 Received: from so254-9.mailgun.net (so254-9.mailgun.net [198.61.254.9]) by imf06.hostedemail.com (Postfix) with ESMTP id 40FF7C0201F2 for ; Sun, 20 Jun 2021 16:01:54 +0000 (UTC) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1624204918; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: References: Cc: To: Subject: From: Sender; bh=tBT+9R016OURPd1+oAsunExiWefitK40L6H5apyub1U=; b=FLv+wrdY6Ef1F+XqRis8LSETzSbPObLg1ksePAL3hqm3jFXdSSOINOHvuMDtZxajWSQKoxcs cuS5tVOD14xqx6dCp+9GsXs8Wdf5CX7yFiKTBbkdpWwU1WwT1Dmsr1cq2FH/CEzKKhKarVUW o4fDs2XRcULcdxK+WME0AvKtV+8= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyIwY2Q3OCIsICJsaW51eC1tbUBrdmFjay5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n04.prod.us-west-2.postgun.com with SMTP id 60cf6661e570c05619d479e6 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Sun, 20 Jun 2021 16:01:37 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 09F2CC43460; Sun, 20 Jun 2021 16:01:36 +0000 (UTC) Received: from [192.168.0.102] (unknown [49.204.183.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: faiyazm) by smtp.codeaurora.org (Postfix) with ESMTPSA id 75B03C433F1; Sun, 20 Jun 2021 16:01:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 75B03C433F1 From: Faiyaz Mohammed Subject: Re: [PATCH v1] mm: slub: fix the leak of alloc/free traces debugfs interface To: Andy Shevchenko Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , linux-mm , Linux Kernel Mailing List , Greg KH , glittao@gmail.com, vinmenon@codeaurora.org, Catalin Marinas , Alexander Viro , Linux FS Devel References: <1624019875-611-1-git-send-email-faiyazm@codeaurora.org> Message-ID: <4ecb4c12-6183-95c5-af59-02fe5da0c17c@codeaurora.org> Date: Sun, 20 Jun 2021 21:31:28 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=mg.codeaurora.org header.s=smtp header.b=FLv+wrdY; dmarc=none; spf=pass (imf06.hostedemail.com: domain of bounce@mg.codeaurora.org designates 198.61.254.9 as permitted sender) smtp.mailfrom=bounce@mg.codeaurora.org X-Rspamd-Server: rspam02 X-Stat-Signature: spujg7sxkj766schsk1pjokr66pz4uw3 X-Rspamd-Queue-Id: 40FF7C0201F2 X-HE-Tag: 1624204914-855570 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 6/18/2021 6:45 PM, Andy Shevchenko wrote: > On Fri, Jun 18, 2021 at 3:38 PM Faiyaz Mohammed wrote: >> >> fix the leak of alloc/free traces debugfs interface, reported > > Fix > Okay, I will update in next patch version. >> by kmemleak like below, >> >> unreferenced object 0xffff00091ae1b540 (size 64): >> comm "lsbug", pid 1607, jiffies 4294958291 (age 1476.340s) >> hex dump (first 32 bytes): >> 02 00 00 00 00 00 00 00 6b 6b 6b 6b 6b 6b 6b 6b ........kkkkkkkk >> 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk >> backtrace: >> [] slab_post_alloc_hook+0xa0/0x418 >> [] kmem_cache_alloc_trace+0x1e4/0x378 >> [] slab_debugfs_start+0x30/0x50 >> slab_debugfs_start at mm/slub.c:5831 >> [] seq_read_iter+0x214/0xd50 >> [] seq_read+0x28c/0x418 >> [] full_proxy_read+0xdc/0x148 >> [] vfs_read+0x104/0x340 >> [] ksys_read+0xf8/0x1e0 >> [] __arm64_sys_read+0x74/0xa8 >> [] invoke_syscall.constprop.0+0xdc/0x1d8 >> [] do_el0_svc+0xe4/0x298 >> [] el0_svc+0x20/0x30 >> [] el0t_64_sync_handler+0xb0/0xb8 >> [] el0t_64_sync+0x178/0x17c > > Can you shrink this a bit? > Okay >> Fixes: 84a2bdb1b458fc968d6d9e07dab388dc679bd747 ("mm: slub: move sysfs slab alloc/free interfaces to debugfs") > > We use 12, which is shorter. > >> Link: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/mm/slub.c?h=next-20210617&id=84a2bdb1b458fc968d6d9e07dab388dc679bd747 > >> > > Must be no blank lines in the tag block. > >> Signed-off-by: Faiyaz Mohammed > Okay > ... > >> static void *slab_debugfs_next(struct seq_file *seq, void *v, loff_t *ppos) >> { >> - loff_t *spos = v; >> struct loc_track *t = seq->private; >> >> + v = ppos; >> if (*ppos < t->count) { >> - *ppos = ++*spos; >> - return spos; >> + ++*ppos; >> + return v; >> } >> - *ppos = ++*spos; >> + ++*ppos; >> return NULL; > > Can it be > > v = ppos; > ++*ppos; > if (*ppos <= t->count> return v; > return NULL; > > ? (basically the question is, is the comparison equivalent in this case or not) > >> } >Yes, we can update it and slab_debugfs_show has the index check as well. I will update in next patch version. Thanks and regards, Mohammed Faiyaz