kernel-hardening.lists.openwall.com archive mirror
 help / color / mirror / Atom feed
* [PATCH] gcc-common.h: 'params.h' has been dropped in GCC10
@ 2020-04-07 11:32 Frédéric Pierret (fepitre)
  2020-04-07 16:45 ` Kees Cook
  0 siblings, 1 reply; 4+ messages in thread
From: Frédéric Pierret (fepitre) @ 2020-04-07 11:32 UTC (permalink / raw)
  To: keescook, re.emese, kernel-hardening, linux-kernel
  Cc: Frédéric Pierret (fepitre)

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.

Signed-off-by: Frédéric Pierret (fepitre) <frederic.pierret@qubes-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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gcc-common.h: 'params.h' has been dropped in GCC10
  2020-04-07 11:32 [PATCH] gcc-common.h: 'params.h' has been dropped in GCC10 Frédéric Pierret (fepitre)
@ 2020-04-07 16:45 ` Kees Cook
  2020-04-07 17:22   ` Frédéric Pierret
  0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2020-04-07 16:45 UTC (permalink / raw)
  To: Frédéric Pierret (fepitre)
  Cc: re.emese, kernel-hardening, linux-kernel

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@qubes-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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gcc-common.h: 'params.h' has been dropped in GCC10
  2020-04-07 16:45 ` Kees Cook
@ 2020-04-07 17:22   ` Frédéric Pierret
  2020-04-07 17:48     ` Kees Cook
  0 siblings, 1 reply; 4+ messages in thread
From: Frédéric Pierret @ 2020-04-07 17:22 UTC (permalink / raw)
  To: Kees Cook; +Cc: re.emese, kernel-hardening, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 461 bytes --]



On 2020-04-07 18:45, Kees Cook wrote:
> 
> 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
Hi Kees,
Thank you very much for your comment. Would you like me to rephrase the commit including your comment too? "Hacky" mostly meaning humble modification from my point of view :)

Best regards,
Frédéric


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gcc-common.h: 'params.h' has been dropped in GCC10
  2020-04-07 17:22   ` Frédéric Pierret
@ 2020-04-07 17:48     ` Kees Cook
  0 siblings, 0 replies; 4+ messages in thread
From: Kees Cook @ 2020-04-07 17:48 UTC (permalink / raw)
  To: Frédéric Pierret; +Cc: re.emese, kernel-hardening, linux-kernel

On Tue, Apr 07, 2020 at 07:22:55PM +0200, Frédéric Pierret wrote:
> 
> 
> On 2020-04-07 18:45, Kees Cook wrote:
> > 
> > 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
> Hi Kees,
> Thank you very much for your comment. Would you like me to rephrase the commit including your comment too? "Hacky" mostly meaning humble modification from my point of view :)

Heh, no worries. I've just reproduced the failure you found with gcc 10,
and I've updated your commit log (and added -Wno-format-diag to the plug
builds). Here's what I've got in my tree now:
https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?h=for-next/gcc-plugins&id=dda632f1bc6da784baab8069e26547e3f4144dbe

Thanks for the patch!

-Kees

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-07 17:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-07 11:32 [PATCH] gcc-common.h: 'params.h' has been dropped in GCC10 Frédéric Pierret (fepitre)
2020-04-07 16:45 ` Kees Cook
2020-04-07 17:22   ` Frédéric Pierret
2020-04-07 17:48     ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).