[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHsH6GtYpH++etxpa4YDkW5PQTLRA5QiZ8fqBViwZV4+yXG5+A@mail.gmail.com>
Date: Wed, 12 Feb 2025 18:58:52 -0800
From: Eyal Birger <eyal.birger@...il.com>
To: Andy Lutomirski <luto@...nel.org>
Cc: Jiri Olsa <jolsa@...nel.org>, Steven Rostedt <rostedt@...dmis.org>,
Masami Hiramatsu <mhiramat@...nel.org>, Oleg Nesterov <oleg@...hat.com>,
Peter Zijlstra <peterz@...radead.org>, Andrii Nakryiko <andrii@...nel.org>, Kees Cook <kees@...nel.org>,
stable@...r.kernel.org, Jann Horn <jannh@...gle.com>, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org, linux-api@...r.kernel.org, x86@...nel.org,
bpf@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Deepak Gupta <debug@...osinc.com>, Stephen Rothwell <sfr@...b.auug.org.au>
Subject: Re: [PATCHv3 perf/core] uprobes: Harden uretprobe syscall trampoline check
(sorry for the HTML spam)
On Wed, Feb 12, 2025 at 5:37 PM Andy Lutomirski <luto@...nel.org> wrote:
>
> On Wed, Feb 12, 2025 at 2:04 PM Jiri Olsa <jolsa@...nel.org> wrote:
> >
> > Jann reported [1] possible issue when trampoline_check_ip returns
> > address near the bottom of the address space that is allowed to
> > call into the syscall if uretprobes are not set up.
> >
> > Though the mmap minimum address restrictions will typically prevent
> > creating mappings there, let's make sure uretprobe syscall checks
> > for that.
>
> It would be a layering violation, but we could perhaps do better here:
>
> > - if (regs->ip != trampoline_check_ip())
> > + /* Make sure the ip matches the only allowed sys_uretprobe caller. */
> > + if (unlikely(regs->ip != trampoline_check_ip(tramp)))
> > goto sigill;
>
> Instead of SIGILL, perhaps this should do the seccomp action? So the
> logic in seccomp would be (sketchily, with some real mode1 mess):
>
> if (is_a_real_uretprobe())
> skip seccomp;
>
> where is_a_real_uretprobe() is only true if the nr and arch match
> uretprobe *and* the address is right.
Why would it make sense to rely on CONFIG_SECCOMP for this check? seems
this check should be done regardless of seccomp.
Or maybe I missed something in the suggestion.
Eyal.
>
>
> --Andy
Powered by blists - more mailing lists