Re: [PATCH] uprobes: Skip breakpoint installation on non executable vmas

Sumanth Korikkar <[email protected]> Thu, 6 Aug 2026 00:05:03 +0200
Newsgroups org.kernel.vger.linux-trace-kernel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
> > Even though it's the same file offset, it is mapped to two different
> > virtual addresses, so I think it should be two different memory pages
> > that will have two separate int3 instructions. I don't think there is
> > any contradiction or surprise, is there?
> 
> True. cross checked the behaviour with bpftrace stacktrace. Pasted the
> output in previous thread.

I meant to say the following in response to your reply:
"Even though it's the same file offset, it is mapped to two different
virtual addresses, so I think it should be two different memory pages
that will have two separate int3 instructions."

Right, and traced this behaviour using bpftrace stacktrace. stacktrace
is pasted in the previous thread.

> > > > Installing a breakpoint for mapping without VM_EXEC and
> > > > updating usdt reference counter in that case is not useful.
> > > >
> > > > Skip non VM_EXEC mappings in install_breakpoint(). This fixes semaphore
> > > > double increment as shown in the above usecase.
> > 
> > You said that mapping is VM_MAYEXEC, which means that kernel allows to
> > re-mmap it as executable, if that happens, we will miss uprobe in that
> > location, so that's probably why breakpoint is installed for
> > VM_MAYEXEC.

ref commit 78a320542e6c ("uprobes: Change valid_vma() to demand
VM_MAYEXEC rather than VM_EXEC")

Thank you