All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Sumanth Korikkar <sumanthk@linux.ibm.com>
Cc: Jiri Olsa <jolsa@kernel.org>, Andrii Nakryiko <andrii@kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	Ilya Leoshkevich <iii@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>
Subject: Re: [PATCH] uprobes: Skip breakpoint installation on non executable vmas
Date: Thu, 6 Aug 2026 13:01:11 +0200	[thread overview]
Message-ID: <anRpdyApCza3MYVi@redhat.com> (raw)
In-Reply-To: <anOlxodwEMPvb1EJ@li-0f4bfd12-9554-4bfb-8b14-7ccf0f0767af.ibm.com>

Sumanth, thanks for details!

On 08/05, Sumanth Korikkar wrote:
>
> So semphore incremented to 2 when a tracer was attached and decremented
> back to 0 when tracer was detached. install_breakpoint() was called for
> both vaddr and succeeded, also remove_breakpoint() succeeded for both
> vaddr.

Then I agree with Andrii, we don't really care. IIUC, only the value of
.active != 0 matters correctness-wise.

> > > --- a/kernel/events/uprobes.c
> > > +++ b/kernel/events/uprobes.c
> > > @@ -1155,6 +1155,9 @@ static int install_breakpoint(struct uprobe *uprobe, struct vm_area_struct *vma,
> > >  	bool first_uprobe;
> > >  	int ret;
> > >
> > > +	if (!(vma->vm_flags & VM_EXEC))
> > > +		return 0;
> > > +
> >
> > Well, but then it makes more sense to change valid_vma() to nack the
> > non VM_EXEC mappings ?
>
> After looking at your 2012 commit 78a320542e6c ("uprobes: Change valid_vma()
> to demand VM_MAYEXEC rather than VM_EXEC"), I thought changing it in
> valid_vma() was not the right approach.
>
> "If a program maps memory as non executable initially, but it has
> VM_MAYEXEC permission, the program can later call mprotect(PROT_EXEC)
> to make it executable." So adding VM_EXEC in valid_vma() can be too
> strict.

Yes,

> Hence, I think install_breakpoint() can be one point where non VM_EXEC
> mapping can be restricted.

But your change in install_breakpoint() essentually reverts that commit?
If uprobe_register() -> register_for_each_vma() finds a VM_MAYEXEC vma
without VM_EXEC valid_vma() will return true, but then install_breakpoint()
will fail anyway.

Oleg.


  reply	other threads:[~2026-08-06 11:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-05 13:19 [PATCH] uprobes: Skip breakpoint installation on non executable vmas Sumanth Korikkar
2026-08-05 15:14 ` Oleg Nesterov
2026-08-05 17:29   ` Andrii Nakryiko
2026-08-05 18:26     ` Oleg Nesterov
2026-08-05 21:29     ` Sumanth Korikkar
2026-08-05 22:05       ` Sumanth Korikkar
2026-08-05 21:06   ` Sumanth Korikkar
2026-08-06 11:01     ` Oleg Nesterov [this message]
2026-08-06 13:34       ` Sumanth Korikkar
2026-08-06 15:35         ` Oleg Nesterov
2026-08-06 20:42           ` Andrii Nakryiko

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=anRpdyApCza3MYVi@redhat.com \
    --to=oleg@redhat.com \
    --cc=agordeev@linux.ibm.com \
    --cc=andrii@kernel.org \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=iii@linux.ibm.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=sumanthk@linux.ibm.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.