From: Thomas Gleixner <tglx@kernel.org>
To: Andrii Nakryiko <andrii@kernel.org>,
akpm@linux-foundation.org, linux-mm@kvack.org
Cc: linux-fsdevel@vger.kernel.org, bpf@vger.kernel.org,
surenb@google.com, shakeel.butt@linux.dev,
Andrii Nakryiko <andrii@kernel.org>,
syzbot+4e70c8e0a2017b432f7a@syzkaller.appspotmail.com,
syzbot+237b5b985b78c1da9600@syzkaller.appspotmail.com,
Peter Zijlstra <peterz@infradead.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [BUG] [PATCH v2 mm-stable] procfs: avoid fetching build ID while holding VMA lock
Date: Tue, 10 Feb 2026 19:41:12 +0100 [thread overview]
Message-ID: <87qzqsa1br.ffs@tglx> (raw)
In-Reply-To: <20260129215340.3742283-1-andrii@kernel.org>
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
Thanks
tglx
next prev parent reply other threads:[~2026-02-10 18:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-29 21:53 [PATCH v2 mm-stable] procfs: avoid fetching build ID while holding VMA lock 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 ` Thomas Gleixner [this message]
2026-02-10 19:04 ` [BUG] " Andrii Nakryiko
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=87qzqsa1br.ffs@tglx \
--to=tglx@kernel.org \
--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 \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.