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] [day] [month] [year] [list]
Message-ID: <YtcUWvm04I0ME2Rm@worktop.programming.kicks-ass.net>
Date:   Tue, 19 Jul 2022 22:30:18 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Steven Rostedt <rostedt@...dmis.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH v3] ftrace/x86: Remove jumps to ftrace_epilogue and
 simplify trampolines

On Tue, Jul 19, 2022 at 03:24:05PM -0400, Steven Rostedt wrote:
> @@ -356,12 +353,6 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size)
>  	if (WARN_ON(ret < 0))
>  		goto fail;
>  
> -	ip = trampoline + size;
> -	if (cpu_feature_enabled(X86_FEATURE_RETHUNK))
> -		__text_gen_insn(ip, JMP32_INSN_OPCODE, ip, &__x86_return_thunk, JMP32_INSN_SIZE);
> -	else
> -		memcpy(ip, retq, sizeof(retq));
> -
>  	/* No need to test direct calls on created trampolines */
>  	if (ops->flags & FTRACE_OPS_FL_SAVE_REGS) {
>  		/* NOP the jnz 1f; but make sure it's a 2 byte jnz */

> diff --git a/arch/x86/kernel/ftrace_64.S b/arch/x86/kernel/ftrace_64.S
> index dfeb227de561..6294c14c51c9 100644
> --- a/arch/x86/kernel/ftrace_64.S
> +++ b/arch/x86/kernel/ftrace_64.S
> @@ -164,7 +164,7 @@ SYM_INNER_LABEL(ftrace_call, SYM_L_GLOBAL)
>  	movq %rax, MCOUNT_REG_SIZE(%rsp)
>  
>  	restore_mcount_regs
> -
> +	RET
>  	/*
>  	 * The code up to this label is copied into trampolines so
>  	 * think twice before adding any new code or changing the

I like the idea, but I think this is broken. When those RETs become 'JMP
__x86_return_thunk' you can't simply copy the instruction. You also have
to fix up the relative addressing.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ