[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9a4367c0-8141-f03c-e5a1-13483794d3e8@suse.cz>
Date: Fri, 19 Nov 2021 11:41:38 +0100
From: Vlastimil Babka <vbabka@...e.cz>
To: Gerald Schaefer <gerald.schaefer@...ux.ibm.com>,
Faiyaz Mohammed <faiyazm@...eaurora.org>
Cc: linux-mm <linux-mm@...ck.org>, LKML <linux-kernel@...r.kernel.org>,
linux-s390 <linux-s390@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [RFC PATCH 1/1] mm/slub: fix endless "No data" printing for
alloc/free_traces attribute
On 11/17/21 20:39, Gerald Schaefer wrote:
> Reading from alloc/free_traces attribute in /sys/kernel/debug/slab/ results
> in an endless sequence of "No data". This is because slab_debugfs_start()
> does not check for a "past end of file" condition and return NULL.
I still have no idea how that endless sequence happens.
To get it, we would have to call slab_debugfs_show() repeatedly with such v
that *v == 0. Which should only happen with slab_debugfs_start() with *ppos
== 0. Which your patch won't change because you add a '*ppos > t->count'
condition, so *ppos has to be at least 1 to trigger this.
But yeah, AFAIK we should detect this in slab_debugfs_start() anyway.
But I think the condition should be something like below, because we are
past end of file already with *ppos == t->count. But if both are 0, we want
to proceed for the "No data" output.
// to show the No data
if (!*ppos && !t->count)
return ppos;
if (*ppos >= t->count)
return ppos;
return ppos;
> Fix it by adding such a check and return NULL.
>
> Fixes: 64dd68497be7 ("mm: slub: move sysfs slab alloc/free interfaces to debugfs")
> Cc: <stable@...r.kernel.org> # v5.14+
> Reported-by: Steffen Maier <maier@...ux.ibm.com>
> Signed-off-by: Gerald Schaefer <gerald.schaefer@...ux.ibm.com>
> ---
> mm/slub.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/mm/slub.c b/mm/slub.c
> index f7368bfffb7a..336609671bc2 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -6115,6 +6115,11 @@ static void *slab_debugfs_next(struct seq_file *seq, void *v, loff_t *ppos)
>
> static void *slab_debugfs_start(struct seq_file *seq, loff_t *ppos)
> {
> + struct loc_track *t = seq->private;
> +
> + if (*ppos > t->count)
> + return NULL;
> +
> return ppos;
> }
>
>
Powered by blists - more mailing lists