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: <20200601145328.GH31795@kernel.org>
Date:   Mon, 1 Jun 2020 11:53:28 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Ian Rogers <irogers@...gle.com>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Quentin Monnet <quentin@...valent.com>,
        Alexei Starovoitov <ast@...nel.org>,
        Jakub Kicinski <kuba@...nel.org>, linux-kernel@...r.kernel.org,
        clang-built-linux@...glegroups.com,
        Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 1/3] tools compiler.h: Add attribute to disable tail calls

Em Sat, May 30, 2020 at 01:20:13AM -0700, Ian Rogers escreveu:
> Tail call optimizations can remove stack frames that are used in
> unwinding tests. Add an attribute that can be used to disable the tail
> call optimization. Tested  on clang and GCC.
> 
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> ---
>  tools/include/linux/compiler-gcc.h | 8 ++++++++
>  tools/include/linux/compiler.h     | 3 +++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/tools/include/linux/compiler-gcc.h b/tools/include/linux/compiler-gcc.h
> index 95c072b70d0e..cda555b47d3d 100644
> --- a/tools/include/linux/compiler-gcc.h
> +++ b/tools/include/linux/compiler-gcc.h
> @@ -27,6 +27,14 @@
>  #define  __pure		__attribute__((pure))
>  #endif
>  #define  noinline	__attribute__((noinline))
> +#ifdef __has_attribute
> +#if __has_attribute(disable_tail_calls)
> +#define __no_tail_call	__attribute__((disable_tail_calls))
> +#endif
> +#endif
> +#ifndef __no_tail_call
> +#define __no_tail_call	__attribute__((optimize("no-optimize-sibling-calls")))
> +#endif

Added this for some retro-computing old distros when building with old
clang versions :-)

- Arnaldo

diff --git a/tools/include/linux/compiler-gcc.h b/tools/include/linux/compiler-gcc.h
index cda555b47d3d..dea7378ad646 100644
--- a/tools/include/linux/compiler-gcc.h
+++ b/tools/include/linux/compiler-gcc.h
@@ -33,7 +33,10 @@
 #endif
 #endif
 #ifndef __no_tail_call
+#if GCC_VERSION > 40201
 #define __no_tail_call	__attribute__((optimize("no-optimize-sibling-calls")))
+#else
+#define __no_tail_call
 #endif
 #ifndef __packed
 #define __packed	__attribute__((packed))

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ