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]
Date:   Mon, 21 Oct 2019 10:33:33 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Borislav Petkov <bp@...en8.de>
Cc:     tip-bot2 for Jiri Slaby <tip-bot2@...utronix.de>,
        linux-kernel@...r.kernel.org, linux-tip-commits@...r.kernel.org,
        Jiri Slaby <jslaby@...e.cz>, "H. Peter Anvin" <hpa@...or.com>,
        Ingo Molnar <mingo@...hat.com>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        linux-arch@...r.kernel.org, Masami Hiramatsu <mhiramat@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Thomas Gleixner <tglx@...utronix.de>, x86-ml <x86@...nel.org>,
        Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH] x86/ftrace: Get rid of function_hook

On Mon, 21 Oct 2019 16:10:38 +0200
Borislav Petkov <bp@...en8.de> wrote:

> From: Borislav Petkov <bp@...e.de>
> 
> function_hook is used as a better name than the default __fentry__
> which is the profiling counter which gcc adds before every function's
> prologue. Thus, it is not called from C and cannot have the same
> semantics as a pure C function - it saves/restores regs so that a C
> function can be called.
> 
> Drop the function_hook symbol and use __fentry__ directly for better
> alignment with gcc's documentation.
> 
> Switch the marking to SYM_CODE_START/_END which is reserved for
> non-standard, special functions.

I would break this into two patches. One that removes the function_hook
name, and the other to convert to the SYM_CODE_START/END.

For the removal of the function_hook patch, be sure to state some of
the history for why the function_hook was created in the first place.
Which would be something like this:

"When ftrace first was introduced to the kernel, it used gcc's
mcount profiling mechanism. The mcount mechanism would add a call to
"mcount" at the start of every function but after the stack frame was
set up. Later, in gcc 4.6, gcc introduced -mfentry, that would create a
call to "__fentry__" instead of "mcount", before the stack frame was
set up. In order to handle both cases, ftrace defined a macro
"function_hook" that would be either "mcount" or "__fentry__" depending
on which one was being used.

The Linux kernel no longer supports the "mcount" method, thus there's
no reason to keep the "function_hook" define around. Simply use
"__fentry__", as there is no ambiguity to the name anymore."

-- Steve


> 
> Signed-off-by: Borislav Petkov <bp@...e.de>
> Cc: "H. Peter Anvin" <hpa@...or.com>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Jiri Slaby <jslaby@...e.cz>
> Cc: Jonathan Corbet <corbet@....net>
> Cc: Josh Poimboeuf <jpoimboe@...hat.com>
> Cc: linux-doc@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: "Steven Rostedt (VMware)" <rostedt@...dmis.org>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: x86@...nel.org
> ---
>  Documentation/asm-annotations.rst |  4 ++--
>  arch/x86/kernel/ftrace_32.S       |  8 +++-----
>  arch/x86/kernel/ftrace_64.S       | 13 ++++++-------
>  3 files changed, 11 insertions(+), 14 deletions(-)
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ