* cross compile fails with GCC_PLUGIN_LATENT_ENTROPY
@ 2025-04-01 21:34 Tadhg McDonald-Jensen
2025-04-04 17:32 ` Kees Cook
0 siblings, 1 reply; 3+ messages in thread
From: Tadhg McDonald-Jensen @ 2025-04-01 21:34 UTC (permalink / raw)
To: kees, linux-hardening, linux-kernel
[-- Attachment #1.1.1: Type: text/plain, Size: 796 bytes --]
Hello,
When cross compiling the linux kernel with
`CONFIG_GCC_PLUGIN_LATENT_ENTROPY=y` it tries to compile the plugin for
the target platform instead of for the host machine causing the
compilation to fail.
I've opened a bug on bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=219973
Specifically I am using GNU guix and trying to compile with `ARCH=arm`
and `CROSS_COMPILE=arm-linux-gnueabihf`, in guix the include paths are
setup in a non typical way so if that is relevant to this error I am
happy to provide more detail, but hopefully just the output of make
showing `CC scripts/gcc-plugins/latent_entropy_plugin.o` instead of
`HOSTCC` like many other files in the scripts folder is sufficient to
reproduce and solve this issue.
Kind Regards,
Tadhg McDonald-Jensen
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 677 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: cross compile fails with GCC_PLUGIN_LATENT_ENTROPY
2025-04-01 21:34 cross compile fails with GCC_PLUGIN_LATENT_ENTROPY Tadhg McDonald-Jensen
@ 2025-04-04 17:32 ` Kees Cook
2025-04-09 21:20 ` Tadhg McDonald-Jensen
0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2025-04-04 17:32 UTC (permalink / raw)
To: Tadhg McDonald-Jensen; +Cc: linux-hardening, linux-kernel
On Tue, Apr 01, 2025 at 05:34:05PM -0400, Tadhg McDonald-Jensen wrote:
> Hello,
>
> When cross compiling the linux kernel with
> `CONFIG_GCC_PLUGIN_LATENT_ENTROPY=y` it tries to compile the plugin for
> the target platform instead of for the host machine causing the
> compilation to fail.
>
> I've opened a bug on bugzilla:
> https://bugzilla.kernel.org/show_bug.cgi?id=219973
>
> Specifically I am using GNU guix and trying to compile with `ARCH=arm`
> and `CROSS_COMPILE=arm-linux-gnueabihf`, in guix the include paths are
> setup in a non typical way so if that is relevant to this error I am
> happy to provide more detail, but hopefully just the output of make
> showing `CC scripts/gcc-plugins/latent_entropy_plugin.o` instead of
> `HOSTCC` like many other files in the scripts folder is sufficient to
> reproduce and solve this issue.
If the kernel's build system can't find the right includes, that would
explain it. I'd check final depends line from scripts/gcc-plugins/Kconfig:
bool "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)
Which validates the Makefile's use of that:
GCC_PLUGINS_DIR = $(shell $(CC) -print-file-name=plugin)
--
Kees Cook
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: cross compile fails with GCC_PLUGIN_LATENT_ENTROPY
2025-04-04 17:32 ` Kees Cook
@ 2025-04-09 21:20 ` Tadhg McDonald-Jensen
0 siblings, 0 replies; 3+ messages in thread
From: Tadhg McDonald-Jensen @ 2025-04-09 21:20 UTC (permalink / raw)
To: Kees Cook; +Cc: linux-hardening, linux-kernel
[-- Attachment #1.1.1: Type: text/plain, Size: 2715 bytes --]
Ok when I tried to get a minimal reproducible case I set it up
incorrectly, when the flag is enabled and you run `make scripts` it
prints `HOSTCXX scripts/gcc-plugins/latent_entropy_plugin.so` and gives
this error:
$ make scripts
HOSTCXX scripts/gcc-plugins/latent_entropy_plugin.so
In file included from
/.../gcc-cross-arm-linux-gnueabihf-14.2.0/include/c++/bits/stl_pair.h:60,
from
/.../gcc-cross-arm-linux-gnueabihf-14.2.0/include/c++/utility:69,
from
/.../gcc-cross-arm-linux-gnueabihf-14.2.0-lib/lib/gcc/arm-linux-gnueabihf/14.2.0/plugin/include/system.h:228,
from
/.../gcc-cross-arm-linux-gnueabihf-14.2.0-lib/lib/gcc/arm-linux-gnueabihf/14.2.0/plugin/include/gcc-plugin.h:28,
from scripts/gcc-plugins/gcc-common.h:7,
from scripts/gcc-plugins/latent_entropy_plugin.c:78:
/.../gcc-cross-arm-linux-gnueabihf-14.2.0/include/c++/type_traits:526:31:
error: missing binary operator before token "("
526 | #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_array)
| ^
It is honestly giving me a massive wall of errors from that file and
then some other errors from other c++ include files, should the plugin
even be using `HOSTCXX` or should it just be using `HOSTCC`?
Tadhg
On 2025-04-04 1:32 p.m., Kees Cook wrote:
> On Tue, Apr 01, 2025 at 05:34:05PM -0400, Tadhg McDonald-Jensen wrote:
>> Hello,
>>
>> When cross compiling the linux kernel with
>> `CONFIG_GCC_PLUGIN_LATENT_ENTROPY=y` it tries to compile the plugin for
>> the target platform instead of for the host machine causing the
>> compilation to fail.
>>
>> I've opened a bug on bugzilla:
>> https://bugzilla.kernel.org/show_bug.cgi?id=219973
>>
>> Specifically I am using GNU guix and trying to compile with `ARCH=arm`
>> and `CROSS_COMPILE=arm-linux-gnueabihf`, in guix the include paths are
>> setup in a non typical way so if that is relevant to this error I am
>> happy to provide more detail, but hopefully just the output of make
>> showing `CC scripts/gcc-plugins/latent_entropy_plugin.o` instead of
>> `HOSTCC` like many other files in the scripts folder is sufficient to
>> reproduce and solve this issue.
>
> If the kernel's build system can't find the right includes, that would
> explain it. I'd check final depends line from scripts/gcc-plugins/Kconfig:
>
> bool "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)
>
> Which validates the Makefile's use of that:
>
> GCC_PLUGINS_DIR = $(shell $(CC) -print-file-name=plugin)
>
>
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 677 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-09 21:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-01 21:34 cross compile fails with GCC_PLUGIN_LATENT_ENTROPY Tadhg McDonald-Jensen
2025-04-04 17:32 ` Kees Cook
2025-04-09 21:20 ` Tadhg McDonald-Jensen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox