From: Oleg Nesterov <oleg@redhat.com>
To: Jiri Olsa <olsajiri@gmail.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
bpf@vger.kernel.org, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
"Borislav Petkov (AMD)" <bp@alien8.de>,
x86@kernel.org
Subject: Re: [PATCHv2 1/3] uprobe: Add uretprobe syscall to speed up return probe
Date: Wed, 3 Apr 2024 15:56:51 +0200 [thread overview]
Message-ID: <20240403135650.GA31764@redhat.com> (raw)
In-Reply-To: <Zg0lvUIB4WdRUGw_@krava>
I leave this to you and Masami, but...
On 04/03, Jiri Olsa wrote:
>
> On Wed, Apr 03, 2024 at 10:07:08AM +0900, Masami Hiramatsu wrote:
> >
> > This is interesting approach. But I doubt we need to add additional
> > syscall just for this purpose. Can't we use another syscall or ioctl?
>
> so the plan is to optimize entry uprobe in a similar way and given
> the syscall is not a scarce resource I wanted to add another syscall
> for that one as well
>
> tbh I'm not sure sure which syscall or ioctl to reuse for this, it's
> possible to do that, the trampoline will just have to save one or
> more additional registers, but adding new syscall seems cleaner to me
Agreed.
> > Also, we should run syzkaller on this syscall. And if uretprobe is
>
> right, I'll check on syzkaller
I don't understand this concern...
> > set in the user function, what happen if the user function directly
> > calls this syscall? (maybe it consumes shadow stack?)
>
> the process should receive SIGILL if there's no pending uretprobe for
> the current task,
Yes,
> or it will trigger uretprobe if there's one pending
... and corrupt the caller. So what?
> but we could limit the syscall to be executed just from the trampoline,
> that should prevent all the user space use cases, I'll do that in next
> version and add more tests for that
Yes, we can... well, ignoring the race with mremap() from another thread.
But why should we care?
Userspace should not call sys_uretprobe(). Likewise, it should not call
sys_restart_syscall(). Likewise, it should not jump to xol_area.
Of course, userspace (especially syzkaller) _can_ do this. So what?
I think the only thing we need to ensure is that the "malicious" task
which calls sys_uretprobe() can only harm itself, nothing more.
No?
Oleg.
next prev parent reply other threads:[~2024-04-03 13:58 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-02 9:32 [PATCHv2 0/3] uprobe: uretprobe speed up Jiri Olsa
2024-04-02 9:33 ` [PATCHv2 1/3] uprobe: Add uretprobe syscall to speed up return probe Jiri Olsa
2024-04-03 1:07 ` Masami Hiramatsu
2024-04-03 9:47 ` Jiri Olsa
2024-04-03 13:56 ` Oleg Nesterov [this message]
2024-04-03 14:09 ` Masami Hiramatsu
2024-04-03 14:49 ` Oleg Nesterov
2024-04-03 16:58 ` Andrii Nakryiko
2024-04-04 0:58 ` Masami Hiramatsu
2024-04-04 2:00 ` Andrii Nakryiko
2024-04-04 11:58 ` Jiri Olsa
2024-04-04 16:06 ` Masami Hiramatsu
2024-04-04 15:54 ` Masami Hiramatsu
2024-04-04 16:11 ` Oleg Nesterov
2024-04-05 1:22 ` Masami Hiramatsu
2024-04-05 8:56 ` Jiri Olsa
2024-04-05 11:02 ` Oleg Nesterov
2024-04-06 3:05 ` Masami Hiramatsu
2024-04-06 17:55 ` Oleg Nesterov
2024-04-08 3:54 ` Masami Hiramatsu
2024-04-08 16:02 ` Jiri Olsa
2024-04-08 16:22 ` Oleg Nesterov
2024-04-09 12:06 ` Jiri Olsa
2024-04-09 0:34 ` Masami Hiramatsu
2024-04-09 7:57 ` Jiri Olsa
2024-04-08 3:16 ` Masami Hiramatsu
2024-04-15 8:25 ` Jiri Olsa
2024-04-18 18:34 ` Andrii Nakryiko
2024-04-02 9:33 ` [PATCHv2 bpf-next 2/3] selftests/bpf: Add uretprobe test for regs integrity Jiri Olsa
2024-04-02 9:33 ` [PATCHv2 bpf-next 3/3] selftests/bpf: Add uretprobe test for regs changes Jiri Olsa
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=20240403135650.GA31764@redhat.com \
--to=oleg@redhat.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bp@alien8.de \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=olsajiri@gmail.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=songliubraving@fb.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=yhs@fb.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;
as well as URLs for NNTP newsgroup(s).