lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yj2s2zVjvfy0c/QA@krava>
Date:   Fri, 25 Mar 2022 12:51:55 +0100
From:   Jiri Olsa <olsajiri@...il.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Masami Hiramatsu <mhiramat@...nel.org>,
        Alexei Starovoitov <ast@...nel.org>,
        Andrii Nakryiko <andrii.nakryiko@...il.com>, x86@...nel.org,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Dan Carpenter <dan.carpenter@...cle.com>,
        kernel-janitors@...r.kernel.org,
        Steven Rostedt <rostedt@...dmis.org>,
        Jiri Olsa <jolsa@...nel.org>, bpf@...r.kernel.org,
        linux-kernel@...r.kernel.org, Josh Poimboeuf <jpoimboe@...hat.com>
Subject: Re: [PATCH bpf-next 2/2] rethook: kprobes: x86: Replace kretprobe
 with rethook on x86

On Fri, Mar 25, 2022 at 11:09:40AM +0100, Peter Zijlstra wrote:
> On Fri, Mar 25, 2022 at 01:29:01PM +0900, Masami Hiramatsu wrote:
> > Replaces the kretprobe code with rethook on x86. With this patch,
> > kretprobe on x86 uses the rethook instead of kretprobe specific
> > trampoline code.
> > 
> > Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
> > ---
> >  arch/x86/Kconfig                 |    1 
> >  arch/x86/include/asm/unwind.h    |   23 +++----
> >  arch/x86/kernel/Makefile         |    1 
> >  arch/x86/kernel/kprobes/common.h |    1 
> >  arch/x86/kernel/kprobes/core.c   |  107 ----------------------------------
> >  arch/x86/kernel/rethook.c        |  121 ++++++++++++++++++++++++++++++++++++++
> >  6 files changed, 135 insertions(+), 119 deletions(-)
> >  create mode 100644 arch/x86/kernel/rethook.c
> 
> I'm thinking you'll find it builds much better with this on...

I built it with Peter's fix and ran bpf selftests, looks good

Tested-by: Jiri Olsa <jolsa@...nel.org>

thanks,
jirka

> 
> diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
> index 2de3c8c5eba9..794fdef2501a 100644
> --- a/arch/x86/kernel/unwind_orc.c
> +++ b/arch/x86/kernel/unwind_orc.c
> @@ -550,15 +550,15 @@ bool unwind_next_frame(struct unwind_state *state)
>  		}
>  		/*
>  		 * There is a small chance to interrupt at the entry of
> -		 * __kretprobe_trampoline() where the ORC info doesn't exist.
> -		 * That point is right after the RET to __kretprobe_trampoline()
> +		 * arch_rethook_trampoline() where the ORC info doesn't exist.
> +		 * That point is right after the RET to arch_rethook_trampoline()
>  		 * which was modified return address.
> -		 * At that point, the @addr_p of the unwind_recover_kretprobe()
> +		 * At that point, the @addr_p of the unwind_recover_rethook()
>  		 * (this has to point the address of the stack entry storing
>  		 * the modified return address) must be "SP - (a stack entry)"
>  		 * because SP is incremented by the RET.
>  		 */
> -		state->ip = unwind_recover_kretprobe(state, state->ip,
> +		state->ip = unwind_recover_rethook(state, state->ip,
>  				(unsigned long *)(state->sp - sizeof(long)));
>  		state->regs = (struct pt_regs *)sp;
>  		state->prev_regs = NULL;
> @@ -573,7 +573,7 @@ bool unwind_next_frame(struct unwind_state *state)
>  			goto err;
>  		}
>  		/* See UNWIND_HINT_TYPE_REGS case comment. */
> -		state->ip = unwind_recover_kretprobe(state, state->ip,
> +		state->ip = unwind_recover_rethook(state, state->ip,
>  				(unsigned long *)(state->sp - sizeof(long)));
>  
>  		if (state->full_regs)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ