The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>,
	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: Wed, 5 Aug 2026 20:26:11 +0200	[thread overview]
Message-ID: <anOAQ1-WsKUzR2xy@redhat.com> (raw)
In-Reply-To: <CAEf4BzZum6AjU1G_hazOwW1ECNzHm=2vLVUGOjD-tSYqr-HRuA@mail.gmail.com>

On 08/05, Andrii Nakryiko wrote:
>
> On Wed, Aug 5, 2026 at 8:14 AM Oleg Nesterov <oleg@redhat.com> wrote:
> >
> > On 08/05, Sumanth Korikkar wrote:
> > >
> > > bpftrace  -e 'usdt:./testprogs/usdt_semaphore_test:tracetest:testprobe {
> > > printf("%s\n", str(arg1) ); exit(); }'
> >
>
> does bpftrace care if USDT semaphore is set to 1 or 2, it shouldn't.
> As long as detaching decrements it from 2 back to zero we should be
> fine. Is that what's happening? If so, is there really a problem
> needing to be fixed?

Yes, I thought about that too...

> > So, 2 vmas map the same binary, install_breakpoint() is called twice.
> > But, the 2nd install_breakpoint() -> ... -> uprobe_write() should see
> > that the original insn was already replaced by int3, in this case
> > verify_opcode() returns 0 and uprobe_write() should do nothing.
> >
> > And, if this uprobe was optimized before the 2nd install_breakpoint(),
> > uprobe_write() won't be called.
> >
> > Hmm.
>
> 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?

Ah, indeed I am stupid ;)

Yes, uprobe_write() creates the COW'ed anonymous page, so the 1st
install_breakpoint() won't affect the 2nd mapping to the same binary.

Thanks Andrii!

Oleg.


  reply	other threads:[~2026-08-05 18:26 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 [this message]
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
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=anOAQ1-WsKUzR2xy@redhat.com \
    --to=oleg@redhat.com \
    --cc=agordeev@linux.ibm.com \
    --cc=andrii.nakryiko@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox