* [PATCH 0/2] gcc-plugins: disable plugins when gmp.h is unavailable @ 2024-03-12 15:03 Thomas Weißschuh 2024-03-12 15:03 ` [PATCH 1/2] kbuild: add host-cc-option helper Thomas Weißschuh 2024-03-12 15:03 ` [PATCH 2/2] gcc-plugins: disable plugins when gmp.h is unavailable Thomas Weißschuh 0 siblings, 2 replies; 6+ messages in thread From: Thomas Weißschuh @ 2024-03-12 15:03 UTC (permalink / raw) To: Kees Cook, Masahiro Yamada Cc: linux-hardening, linux-kernel, linux-kbuild, Thomas Weißschuh Without gmp.h the plugin build fails. Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> --- Thomas Weißschuh (2): kbuild: add host-cc-option helper gcc-plugins: disable plugins when gmp.h is unavailable scripts/Kconfig.include | 4 ++++ scripts/gcc-plugins/Kconfig | 1 + 2 files changed, 5 insertions(+) --- base-commit: 855684c7d938c2442f07eabc154e7532b4c1fbf9 change-id: 20240312-gcc-plugins-gmp-efab1a8d05c0 Best regards, -- Thomas Weißschuh <thomas.weissschuh@linutronix.de> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] kbuild: add host-cc-option helper 2024-03-12 15:03 [PATCH 0/2] gcc-plugins: disable plugins when gmp.h is unavailable Thomas Weißschuh @ 2024-03-12 15:03 ` Thomas Weißschuh 2024-03-12 15:03 ` [PATCH 2/2] gcc-plugins: disable plugins when gmp.h is unavailable Thomas Weißschuh 1 sibling, 0 replies; 6+ messages in thread From: Thomas Weißschuh @ 2024-03-12 15:03 UTC (permalink / raw) To: Kees Cook, Masahiro Yamada Cc: linux-hardening, linux-kernel, linux-kbuild, Thomas Weißschuh This helper works the same as cc-option but for the host compiler. It will be used by the gcc-plugins configuration to check for the gmp.h header. Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> --- scripts/Kconfig.include | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include index 3ee8ecfb8c04..84368e23b072 100644 --- a/scripts/Kconfig.include +++ b/scripts/Kconfig.include @@ -27,6 +27,10 @@ failure = $(if-success,$(1),n,y) # Return y if the compiler supports <flag>, n otherwise cc-option = $(success,trap "rm -rf .tmp_$$" EXIT; mkdir .tmp_$$; $(CC) -Werror $(CLANG_FLAGS) $(1) -c -x c /dev/null -o .tmp_$$/tmp.o) +# $(host-cc-option,<flag>) +# Return y if the host compiler supports <flag>, n otherwise +host-cc-option = $(success,trap "rm -rf .tmp_$$" EXIT; mkdir .tmp_$$; $(HOSTCC) -Werror $(HOSTCFLAGS) $(1) -c -x c /dev/null -o .tmp_$$/tmp.o) + # $(ld-option,<flag>) # Return y if the linker supports <flag>, n otherwise ld-option = $(success,$(LD) -v $(1)) -- 2.44.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] gcc-plugins: disable plugins when gmp.h is unavailable 2024-03-12 15:03 [PATCH 0/2] gcc-plugins: disable plugins when gmp.h is unavailable Thomas Weißschuh 2024-03-12 15:03 ` [PATCH 1/2] kbuild: add host-cc-option helper Thomas Weißschuh @ 2024-03-12 15:03 ` Thomas Weißschuh 2024-03-12 21:53 ` Kees Cook 1 sibling, 1 reply; 6+ messages in thread From: Thomas Weißschuh @ 2024-03-12 15:03 UTC (permalink / raw) To: Kees Cook, Masahiro Yamada Cc: linux-hardening, linux-kernel, linux-kbuild, Thomas Weißschuh The header gmp.h is meant to be picked up from the host system. When it is unavailable the plugin build fails: In file included from ../crosstools/gcc-13.2.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/13.2.0/plugin/include/gcc-plugin.h:28, from ../scripts/gcc-plugins/gcc-common.h:7, from ../scripts/gcc-plugins/stackleak_plugin.c:30: ../crosstools/gcc-13.2.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/13.2.0/plugin/include/system.h:703:10: fatal error: gmp.h: No such file or directory 703 | #include <gmp.h> | ^~~~~~~ Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> --- scripts/gcc-plugins/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/gcc-plugins/Kconfig b/scripts/gcc-plugins/Kconfig index e383cda05367..a664fb5cdde5 100644 --- a/scripts/gcc-plugins/Kconfig +++ b/scripts/gcc-plugins/Kconfig @@ -10,6 +10,7 @@ menuconfig GCC_PLUGINS depends on HAVE_GCC_PLUGINS depends on CC_IS_GCC depends on $(success,test -e $(shell,$(CC) -print-file-name=plugin)/include/plugin-version.h) + depends on $(host-cc-option,-include gmp.h) default y help GCC plugins are loadable modules that provide extra features to the -- 2.44.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] gcc-plugins: disable plugins when gmp.h is unavailable 2024-03-12 15:03 ` [PATCH 2/2] gcc-plugins: disable plugins when gmp.h is unavailable Thomas Weißschuh @ 2024-03-12 21:53 ` Kees Cook 2024-03-13 3:47 ` Masahiro Yamada 0 siblings, 1 reply; 6+ messages in thread From: Kees Cook @ 2024-03-12 21:53 UTC (permalink / raw) To: Thomas Weißschuh Cc: Masahiro Yamada, linux-hardening, linux-kernel, linux-kbuild On Tue, Mar 12, 2024 at 04:03:30PM +0100, Thomas Weißschuh wrote: > The header gmp.h is meant to be picked up from the host system. > > When it is unavailable the plugin build fails: > > In file included from ../crosstools/gcc-13.2.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/13.2.0/plugin/include/gcc-plugin.h:28, > from ../scripts/gcc-plugins/gcc-common.h:7, > from ../scripts/gcc-plugins/stackleak_plugin.c:30: > ../crosstools/gcc-13.2.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/13.2.0/plugin/include/system.h:703:10: fatal error: gmp.h: No such file or directory > 703 | #include <gmp.h> > | ^~~~~~~ > > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> > --- > scripts/gcc-plugins/Kconfig | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/scripts/gcc-plugins/Kconfig b/scripts/gcc-plugins/Kconfig > index e383cda05367..a664fb5cdde5 100644 > --- a/scripts/gcc-plugins/Kconfig > +++ b/scripts/gcc-plugins/Kconfig > @@ -10,6 +10,7 @@ menuconfig GCC_PLUGINS > depends on HAVE_GCC_PLUGINS > depends on CC_IS_GCC > depends on $(success,test -e $(shell,$(CC) -print-file-name=plugin)/include/plugin-version.h) > + depends on $(host-cc-option,-include gmp.h) Why does the prior depends not fail? That's where plugin detection is happening. -- Kees Cook ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] gcc-plugins: disable plugins when gmp.h is unavailable 2024-03-12 21:53 ` Kees Cook @ 2024-03-13 3:47 ` Masahiro Yamada 2024-03-13 14:42 ` Thomas Weißschuh 0 siblings, 1 reply; 6+ messages in thread From: Masahiro Yamada @ 2024-03-13 3:47 UTC (permalink / raw) To: Kees Cook Cc: Thomas Weißschuh, linux-hardening, linux-kernel, linux-kbuild On Wed, Mar 13, 2024 at 6:53 AM Kees Cook <keescook@chromium.org> wrote: > > On Tue, Mar 12, 2024 at 04:03:30PM +0100, Thomas Weißschuh wrote: > > The header gmp.h is meant to be picked up from the host system. > > > > When it is unavailable the plugin build fails: > > > > In file included from ../crosstools/gcc-13.2.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/13.2.0/plugin/include/gcc-plugin.h:28, > > from ../scripts/gcc-plugins/gcc-common.h:7, > > from ../scripts/gcc-plugins/stackleak_plugin.c:30: > > ../crosstools/gcc-13.2.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/13.2.0/plugin/include/system.h:703:10: fatal error: gmp.h: No such file or directory > > 703 | #include <gmp.h> > > | ^~~~~~~ > > > > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> > > --- > > scripts/gcc-plugins/Kconfig | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/scripts/gcc-plugins/Kconfig b/scripts/gcc-plugins/Kconfig > > index e383cda05367..a664fb5cdde5 100644 > > --- a/scripts/gcc-plugins/Kconfig > > +++ b/scripts/gcc-plugins/Kconfig > > @@ -10,6 +10,7 @@ menuconfig GCC_PLUGINS > > depends on HAVE_GCC_PLUGINS > > depends on CC_IS_GCC > > depends on $(success,test -e $(shell,$(CC) -print-file-name=plugin)/include/plugin-version.h) > > + depends on $(host-cc-option,-include gmp.h) > > Why does the prior depends not fail? That's where plugin detection is > happening. > > -- > Kees Cook > This patch set should be rejected. It was already discussed in the past. Just install a proper package, then gcc-plugin will work. https://lore.kernel.org/all/CAHk-=wjjiYjCp61gdAMpDOsUBU-A2hFFKJoVx5VAC7yV4K6WYg@mail.gmail.com/ -- Best Regards Masahiro Yamada ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] gcc-plugins: disable plugins when gmp.h is unavailable 2024-03-13 3:47 ` Masahiro Yamada @ 2024-03-13 14:42 ` Thomas Weißschuh 0 siblings, 0 replies; 6+ messages in thread From: Thomas Weißschuh @ 2024-03-13 14:42 UTC (permalink / raw) To: Masahiro Yamada; +Cc: Kees Cook, linux-hardening, linux-kernel, linux-kbuild On Wed, Mar 13, 2024 at 12:47:59PM +0900, Masahiro Yamada wrote: > On Wed, Mar 13, 2024 at 6:53 AM Kees Cook <keescook@chromium.org> wrote: > > > > On Tue, Mar 12, 2024 at 04:03:30PM +0100, Thomas Weißschuh wrote: > > > The header gmp.h is meant to be picked up from the host system. > > > > > > When it is unavailable the plugin build fails: > > > > > > In file included from ../crosstools/gcc-13.2.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/13.2.0/plugin/include/gcc-plugin.h:28, > > > from ../scripts/gcc-plugins/gcc-common.h:7, > > > from ../scripts/gcc-plugins/stackleak_plugin.c:30: > > > ../crosstools/gcc-13.2.0-nolibc/i386-linux/bin/../lib/gcc/i386-linux/13.2.0/plugin/include/system.h:703:10: fatal error: gmp.h: No such file or directory > > > 703 | #include <gmp.h> > > > | ^~~~~~~ > > > > > > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> > > > --- > > > scripts/gcc-plugins/Kconfig | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/scripts/gcc-plugins/Kconfig b/scripts/gcc-plugins/Kconfig > > > index e383cda05367..a664fb5cdde5 100644 > > > --- a/scripts/gcc-plugins/Kconfig > > > +++ b/scripts/gcc-plugins/Kconfig > > > @@ -10,6 +10,7 @@ menuconfig GCC_PLUGINS > > > depends on HAVE_GCC_PLUGINS > > > depends on CC_IS_GCC > > > depends on $(success,test -e $(shell,$(CC) -print-file-name=plugin)/include/plugin-version.h) > > > + depends on $(host-cc-option,-include gmp.h) > > > > Why does the prior depends not fail? That's where plugin detection is > > happening. > > > > -- > > Kees Cook > > This patch set should be rejected. > > > It was already discussed in the past. > Just install a proper package, then gcc-plugin will work. > > https://lore.kernel.org/all/CAHk-=wjjiYjCp61gdAMpDOsUBU-A2hFFKJoVx5VAC7yV4K6WYg@mail.gmail.com/ Thanks for the pointer. As there is already consensus I agree that the patches should not be used. Thomas ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-03-13 14:42 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-03-12 15:03 [PATCH 0/2] gcc-plugins: disable plugins when gmp.h is unavailable Thomas Weißschuh 2024-03-12 15:03 ` [PATCH 1/2] kbuild: add host-cc-option helper Thomas Weißschuh 2024-03-12 15:03 ` [PATCH 2/2] gcc-plugins: disable plugins when gmp.h is unavailable Thomas Weißschuh 2024-03-12 21:53 ` Kees Cook 2024-03-13 3:47 ` Masahiro Yamada 2024-03-13 14:42 ` Thomas Weißschuh
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).