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: <202004070945.D6E095F7@keescook>
Date:   Tue, 7 Apr 2020 09:45:42 -0700
From:   Kees Cook <keescook@...omium.org>
To:     Frédéric Pierret (fepitre) 
        <frederic.pierret@...es-os.org>
Cc:     re.emese@...il.com, kernel-hardening@...ts.openwall.com,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] gcc-common.h: 'params.h' has been dropped in GCC10

On Tue, Apr 07, 2020 at 01:32:59PM +0200, Frédéric Pierret (fepitre) wrote:
> Moreover, GCC10 complains about gimple definition. For example,
> doing a 'scripts/gcc-plugin.sh g++ g++ gcc' returns:
> 
> In file included from <stdin>:1:
> ./gcc-plugins/gcc-common.h:852:13: error: redefinition of ‘static bool is_a_helper<T>::test(U*) [with U = const gimple; T = const ggoto*]’
>   852 | inline bool is_a_helper<const ggoto *>::test(const_gimple gs)
>       |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from ./gcc-plugins/gcc-common.h:125,
>                  from <stdin>:1:
> /usr/lib/gcc/x86_64-redhat-linux/10/plugin/include/gimple.h:1037:1: note: ‘static bool is_a_helper<T>::test(U*) [with U = const gimple; T = const ggoto*]’ previously declared here
>  1037 | is_a_helper <const ggoto *>::test (const gimple *gs)
>       | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from <stdin>:1:
> ./gcc-plugins/gcc-common.h:859:13: error: redefinition of ‘static bool is_a_helper<T>::test(U*) [with U = const gimple; T = const greturn*]’
>   859 | inline bool is_a_helper<const greturn *>::test(const_gimple gs)
>       |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from ./gcc-plugins/gcc-common.h:125,
>                  from <stdin>:1:
> /usr/lib/gcc/x86_64-redhat-linux/10/plugin/include/gimple.h:1489:1: note: ‘static bool is_a_helper<T>::test(U*) [with U = const gimple; T = const greturn*]’ previously declared here
>  1489 | is_a_helper <const greturn *>::test (const gimple *gs)
>       | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> A hacky way for solving this is to ignore them for GCC10.

Hi! Thanks for the patch. I don't think this is a hack: it's the right
thing to do here, yes? GCC 10 includes this helper in gimple.h, so we
can ifdef it out in gcc-common.h.

-Kees

> 
> Signed-off-by: Frédéric Pierret (fepitre) <frederic.pierret@...es-os.org>
> ---
>  scripts/gcc-plugins/gcc-common.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h
> index 17f06079a712..9ad76b7f3f10 100644
> --- a/scripts/gcc-plugins/gcc-common.h
> +++ b/scripts/gcc-plugins/gcc-common.h
> @@ -35,7 +35,9 @@
>  #include "ggc.h"
>  #include "timevar.h"
>  
> +#if BUILDING_GCC_VERSION < 10000
>  #include "params.h"
> +#endif
>  
>  #if BUILDING_GCC_VERSION <= 4009
>  #include "pointer-set.h"
> @@ -847,6 +849,7 @@ static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree l
>  	return gimple_build_assign(lhs, subcode, op1, op2 PASS_MEM_STAT);
>  }
>  
> +#if BUILDING_GCC_VERSION < 10000
>  template <>
>  template <>
>  inline bool is_a_helper<const ggoto *>::test(const_gimple gs)
> @@ -860,6 +863,7 @@ inline bool is_a_helper<const greturn *>::test(const_gimple gs)
>  {
>  	return gs->code == GIMPLE_RETURN;
>  }
> +#endif
>  
>  static inline gasm *as_a_gasm(gimple stmt)
>  {
> -- 
> 2.25.2
> 
> 

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ