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.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 7E638C48BDF for ; Sun, 20 Jun 2021 16:01:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5DADE61156 for ; Sun, 20 Jun 2021 16:01:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229915AbhFTQEE (ORCPT ); Sun, 20 Jun 2021 12:04:04 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:33309 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229680AbhFTQD7 (ORCPT ); Sun, 20 Jun 2021 12:03:59 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1624204907; 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=tzVf1lTlF6S6BVh8rAbp6ZhGP6qnUiblQsRyUXntUVtD9xJoA1sJ9c/AUS/GDSva690bdYFI oujEOvxeeva18kzZtAcK2GnznxVOsHKSS4WwhHfZw4n/qqCvKW9fWQFtIV4gTisxWk2nnZK3 ixd7m+p05jH45j9pCXidKhscl38= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd 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-east-1.postgun.com with SMTP id 60cf6662e27c0cc77f49bb73 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Sun, 20 Jun 2021 16:01:38 GMT Sender: faiyazm=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 73BABC43217; Sun, 20 Jun 2021 16:01:37 +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 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=faiyazm@codeaurora.org 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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