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: <20190225161124.cq6c45r3wlwktyuz@treble>
Date:   Mon, 25 Feb 2019 10:11:24 -0600
From:   Josh Poimboeuf <jpoimboe@...hat.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     torvalds@...ux-foundation.org, tglx@...utronix.de, hpa@...or.com,
        julien.thierry@....com, will.deacon@....com, luto@...capital.net,
        mingo@...nel.org, catalin.marinas@....com, james.morse@....com,
        valentin.schneider@....com, brgerst@...il.com, luto@...nel.org,
        bp@...en8.de, dvlasenk@...hat.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/6] objtool: Replace STACK_FRAME_NON_STANDARD annotation

On Mon, Feb 25, 2019 at 01:43:34PM +0100, Peter Zijlstra wrote:
> Replace the existing STACK_FRAME_NON_STANDARD annotation with a
> 'better' scheme.
> 
> The old annotation works by taking the address of a function; this
> is visible to the compiler and might affect code generation (the
> function pointer escapes). The new annotation simply stores the
> function name and has objtool do a symtab lookup.
> 
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> ---
>  include/linux/frame.h |   19 +++++++++++++---
>  tools/objtool/check.c |   58 +++++++++++++++++++++-----------------------------
>  tools/objtool/check.h |    1 
>  3 files changed, 41 insertions(+), 37 deletions(-)
> 
> --- a/include/linux/frame.h
> +++ b/include/linux/frame.h
> @@ -11,9 +11,22 @@
>   *
>   * For more information, see tools/objtool/Documentation/stack-validation.txt.
>   */
> -#define STACK_FRAME_NON_STANDARD(func) \
> -	static void __used __section(.discard.func_stack_frame_non_standard) \
> -		*__func_stack_frame_non_standard_##func = func
> +#define STACK_FRAME_NON_STANDARD(func)					\
> +	asm (".pushsection .discard.nonstd_frame_strtab, \"S\", @3\n\t"	\
> +	     "999: .ascii \"" #func "\"\n\t"				\
> +	     "     .byte 0\n\t"						\
> +	     ".popsection\n\t"						\
> +	     ".pushsection .discard.nonstd_frame\n\t"			\
> +	     ".long 999b - .\n\t"					\
> +	     ".popsection\n\t")
> +

I don't think this will work in the case where GCC does an IPA
optimization and renames the function (e.g., renames func to
func.isra.1234), right?  That might be a deal breaker...

> +/*
> + * SHT_STRTAB(@3) sections should start with a \0 byte such that the 0 offset
> + * encodes the NULL string.
> + */
> +asm (".pushsection .discard.nonstd_frame_strtab, \"S\", @3\n\t"
> +     ".byte 0\n\t"
> +     ".popsection\n\t");

Including the file creates the section, which is a bit nasty.  Instead
just change STACK_FRAME_NON_STANDARD to prefix every string with a \0?

-- 
Josh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ