Re: [PATCH mm-unstable 1/1] fs/proc/task_mmu: advance seq_file position on interrupted VMA lookup

From: Huang Adrian

Date: Mon Nov 16 2026 - 01:27:01 EST


Hi Andrew and Suren,

On Fri, Nov 13, 2026 at 11:17 AM Suren Baghdasaryan <surenb@xxxxxxxxxx> wrote:
>
> On Thu, Nov 12, 2026 at 7:13 PM Suren Baghdasaryan <surenb@xxxxxxxxxx> wrote:
> >
> > On Thu, Nov 12, 2026 at 6:37 PM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> > >
> > > On Thu, 12 Nov 2026 22:01:01 +0800 "Adrian Huang (Lenovo)" <adrianhuang0701@xxxxxxxxx> 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.
> > >
> > > OK, but what's causing the interruption?
> > >
> > > > 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
> > > >
> > > > The above buggy message is reproduced by the following command:
> > > >
> > > > # stress-ng --vma 0 -t 60
> > >
> > > afaict "stress-ng -t" can send SIGALRM, but mmap_read_lock_killable()
> > > only responds to fatal signals.
> > >
> > > So please clarify: exactly what is causing this to happen?
> >
> > Also I don't think stress-ng --vma 0 -t 60 command reads maps, smaps
> > or smaps_rollup files by itself but I might be mistaken. It would be
> > nice to get more details on how this gets reproduced.
>
> Just after sending this I found
> https://github.com/ColinIanKing/stress-ng/blob/master/stress-vma.c#L536,
> so I stand corrected. Still, it would be nice to know how exactly this
> issue is reproduced.

The --vma stressor performs the following jobs:
* It creates a thread that repeatedly reads /proc/self/maps while other
threads modify the process's VMAs[1][2].
* It sends SIGKILL (fatal signal) to its own threads approximately
every 10 seconds[3]. This happens independently of the 60-second
timeout for the command 'stress-ng --vma 0 -t 60'.

As a result, down_read_killable() in Linux kernel returns -EINTR.

This finding is based on code inspection and analysis. To validate the
behavior, I collected ftrace logs and added debug patches to trace the
relevant task PID/TID information. The full explanation is fairly
detailed, so I have not included it here, but I can provide it if
there's interest.

[1] https://github.com/ColinIanKing/stress-ng/blob/master/stress-vma.c#L748
[2] https://github.com/ColinIanKing/stress-ng/blob/master/stress-vma.c#L658
[3] https://github.com/ColinIanKing/stress-ng/blob/master/stress-vma.c#L768

-- Adrian