Re: [PATCH mm-unstable 1/1] fs/proc/task_mmu: advance seq_file position on interrupted VMA lookup
From: Huang Adrian
Date: Tue Nov 17 2026 - 06:52:34 EST
On Mon, Nov 16, 2026 at 10:37 PM Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx> wrote:
>
> On Thu, Nov 12, 2026 at 10:01:01PM +0800, Adrian Huang (Lenovo) wrote:
> > Commit 5631da56c9a8 ("fs/proc/task_mmu: read proc/pid/maps under
> > per-vma lock") introduced the possibility of returning -EINTR
> > from proc_get_vma() when the VMA lookup is interrupted.
> >
> > When this happens in m_next(), proc_get_vma() returns an error
> > pointer without updating the position index. Consequently,
> > seq_read_iter() reports:
> >
> > seq_file: buggy .next function m_next did not update position index
>
> What does seq_read_iter() 'reporting' something mean? It feels like you're
> trying to make this into something bigger than it is.
>
> What you mean to say is a rate-limited pr_info() output occurs, and when a
> process that _has received a fatal signal_ (!!) somehow continues long
> enough to try to output more data, you get an pr_info().
>
> The relevant code from seq_read_iter():
>
> if (pos == m->index) {
> pr_info_ratelimited("buggy .next function %ps did not update position index\n",
> m->op->next);
> m->index++;
> }
>
> Anyway you should mention the fatal signal requirement clearly.
>
> >
> > The above buggy message is reproduced by the following command:
> >
> > # stress-ng --vma 0 -t 60
>
> OK I could reproduce the output locally. It seems that this run results in
> fatal signals being sent to the processes triggering this output.
>
> > Update the position index when VMA lookup fails, as required by
> > the seq_file interface. Also save the original position in
> > priv->last_pos so that subsequent iteration can restart from
> > the correct address without skipping or repeating a VMA.
>
> We don't really care about skipping or repeating a VMA for a process that's
> about to die :)
>
> We may as well do this but better to just hoist that to share code.
>
> >
> > Fixes: 5631da56c9a8 ("fs/proc/task_mmu: read proc/pid/maps under per-vma lock")
>
> This isn't really a bug, it's really cosmetic to be honest. So not sure if
> we need a cc: stable hmm.
>
> > Signed-off-by: Adrian Huang (Lenovo) <adrianhuang0701@xxxxxxxxx>
>
> See attached suggested patch that makes the comment sane + hoists the shared
> bit (dropping a silly existing comment).
Your suggested patch is better. I verified it on my side and it works
as expected. Thanks.
-- Adrian