From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Thomas Gleixner <tglx@kernel.org>
Cc: Andrii Nakryiko <andrii@kernel.org>,
akpm@linux-foundation.org, linux-mm@kvack.org,
linux-fsdevel@vger.kernel.org, bpf@vger.kernel.org,
surenb@google.com, shakeel.butt@linux.dev,
syzbot+4e70c8e0a2017b432f7a@syzkaller.appspotmail.com,
syzbot+237b5b985b78c1da9600@syzkaller.appspotmail.com,
Peter Zijlstra <peterz@infradead.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: Re: [BUG] [PATCH v2 mm-stable] procfs: avoid fetching build ID while holding VMA lock
Date: Tue, 10 Feb 2026 11:04:42 -0800 [thread overview]
Message-ID: <CAEf4BzZHktcrxO0_PnMer-oEsAm++R4VZKj-gCmft-mVi58P8g@mail.gmail.com> (raw)
In-Reply-To: <87qzqsa1br.ffs@tglx>
On Tue, Feb 10, 2026 at 10:41 AM Thomas Gleixner <tglx@kernel.org> wrote:
>
> On Thu, Jan 29 2026 at 13:53, Andrii Nakryiko wrote:
> > /* unlock vma or mmap_lock, and put mm_struct before copying data to user */
> > query_vma_teardown(&lock_ctx);
> > mmput(mm);
> >
> > + if (karg.build_id_size) {
> > + __u32 build_id_sz;
> > +
> > + if (vm_file)
> > + err = build_id_parse_file(vm_file, build_id_buf, &build_id_sz);
> > + else
> > + err = -ENOENT;
> > + if (err) {
> > + karg.build_id_size = 0;
> > + } else {
> > + if (karg.build_id_size < build_id_sz) {
> > + err = -ENAMETOOLONG;
> > + goto out;
>
> Introduces a double mmput() here.
>
> > + }
> > + karg.build_id_size = build_id_sz;
> > + }
> > + }
> > +
> > + if (vm_file)
> > + fput(vm_file);
> > +
> > if (karg.vma_name_size && copy_to_user(u64_to_user_ptr(karg.vma_name_addr),
> > name, karg.vma_name_size)) {
> > kfree(name_buf);
> > @@ -798,6 +808,8 @@ static int do_procmap_query(struct mm_struct *mm, void __user *uarg)
> > out:
> > query_vma_teardown(&lock_ctx);
> > mmput(mm);
> > + if (vm_file)
> > + fput(vm_file);
> > kfree(name_buf);
> > return err;
>
> See:
>
> https://lore.kernel.org/all/698aaf3c.050a0220.3b3015.0088.GAE@google.com/T/#u
>
Ah, silly mistake on my part, thanks for the heads up, I'll send a fix shortly
> Thanks
>
> tglx
next prev parent reply other threads:[~2026-02-10 19:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-29 21:53 Andrii Nakryiko
2026-01-30 3:54 ` kernel test robot
2026-01-30 20:11 ` Andrii Nakryiko
2026-01-30 20:42 ` Andrew Morton
2026-01-30 20:47 ` Andrii Nakryiko
2026-01-30 4:40 ` Shakeel Butt
2026-01-30 6:43 ` kernel test robot
2026-02-10 18:41 ` [BUG] " Thomas Gleixner
2026-02-10 19:04 ` Andrii Nakryiko [this message]
2026-02-10 21:05 ` [PATCH] procfs: Prevent double mmput() in do_procmap_query() Thomas Gleixner
2026-02-11 11:58 ` Sebastian Andrzej Siewior
2026-02-11 17:24 ` Andrii Nakryiko
2026-02-11 17:29 ` Sebastian Andrzej Siewior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAEf4BzZHktcrxO0_PnMer-oEsAm++R4VZKj-gCmft-mVi58P8g@mail.gmail.com \
--to=andrii.nakryiko@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andrii@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=bpf@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterz@infradead.org \
--cc=shakeel.butt@linux.dev \
--cc=surenb@google.com \
--cc=syzbot+237b5b985b78c1da9600@syzkaller.appspotmail.com \
--cc=syzbot+4e70c8e0a2017b432f7a@syzkaller.appspotmail.com \
--cc=tglx@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox