[Letux-kernel] [BUG v5.2-rc1] ARM build broken

H. Nikolaus Schaller hns at goldelico.com
Mon May 20 19:08:39 CEST 2019


Hi,

> Am 20.05.2019 um 17:59 schrieb Kees Cook <keescook at chromium.org>:
> 
> On Mon, May 20, 2019 at 05:15:02PM +0200, H. Nikolaus Schaller wrote:
>> Hi,
>> it seems as if ARM build is broken since ARM now hard enables CONFIG_HAVE_GCC_PLUGINS
>> which indirectly enables CONFIG_GCC_PLUGIN_ARM_SSP_PER_TASK. Compiling this breaks
>> on my system (Darwin build host) due to conflicts in system headers and Linux headers.
>> 
>> So how can I turn off all these GCC_PLUGINS?
>> 
>> The offending patch seems to be
>> 
>> 	security: Create "kernel hardening" config area
>> 
>> especially the new "default y" for GCC_PLUGINS. After removing that line from
>> scripts/gcc-plugins/Kconfig makes my compile succeed.
> 
> The intention is to enable it _if_ the plugins are available as part of
> the build environment. The "default y" on GCC_PLUGINS is mediated by:
>        depends on HAVE_GCC_PLUGINS

HAVE_GCC_PLUGINS has the following description:

	An arch should select this symbol if it supports building with
          GCC plugins.

So an ARCH (ARM) selects it unconditionally of the build environment.

>        depends on PLUGIN_HOSTCC != ""

Well, we have it set to "g++" for ages and it was not a problem.
So both conditions are true.

But they do not seem to give a mechanism to keep plugins turned off
even if the ARCH allows and the PLUGIN_HOSTCC is set.

> So it seems that something isn't working in the plugin detection maybe?

The real problem seems that it is not possible to turn off PLUGIN_HOSTCC.
In some more experiments I have done it is always changed to "g++" on
my system because there is a g++ compiler variant available.

This was not a problem before because the "default y" was missing.

Probably the problem is that this is too automatically assuming that
plugins are to be built if g++ is available.

> Can you send your build error, compiler version, .config, etc? I've not
> been able to reproduce this problem. (And I'm not aware of any of the
> automated build systems failing in this area yet either...) Perhaps it's
> something specific to building under Darwin?

Build error:

 HOSTCXX -fPIC scripts/gcc-plugins/arm_ssp_per_task_plugin.o - due to: scripts/gcc-plugins/gcc-common.h
In file included from scripts/gcc-plugins/arm_ssp_per_task_plugin.c:3:0:
scripts/gcc-plugins/gcc-common.h:153:0: warning: "__unused" redefined
#define __unused __attribute__((__unused__))
^
In file included from /usr/include/stdio.h:64:0,
                from /Users/hns/Documents/Projects/QuantumSTEP/System/Library/Frameworks/System.framework/Versions-jessie/x86_64-apple-darwin15.0.0/gcc/arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabi/4.9.2/plugin/include/system.h:40,
                from /Users/hns/Documents/Projects/QuantumSTEP/System/Library/Frameworks/System.framework/Versions-jessie/x86_64-apple-darwin15.0.0/gcc/arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabi/4.9.2/plugin/include/gcc-plugin.h:28,
                from /Users/hns/Documents/Projects/QuantumSTEP/System/Library/Frameworks/System.framework/Versions-jessie/x86_64-apple-darwin15.0.0/gcc/arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabi/4.9.2/plugin/include/plugin.h:23,
                from scripts/gcc-plugins/gcc-common.h:9,
                from scripts/gcc-plugins/arm_ssp_per_task_plugin.c:3:
/usr/include/sys/cdefs.h:161:0: note: this is the location of the previous definition
#define __unused __attribute__((unused))
^
 HOSTLLD -shared scripts/gcc-plugins/arm_ssp_per_task_plugin.so - due to target missing
Undefined symbols for architecture x86_64:
 "gen_reg_rtx(machine_mode)", referenced from:
     (anonymous namespace)::arm_pertask_ssp_rtl_pass::execute() in arm_ssp_per_task_plugin.o
 "rtx_alloc_stat(rtx_code)", referenced from:
     (anonymous namespace)::arm_pertask_ssp_rtl_pass::execute() in arm_ssp_per_task_plugin.o
 "emit_insn_before(rtx_def*, rtx_def*)", referenced from:
     (anonymous namespace)::arm_pertask_ssp_rtl_pass::execute() in arm_ssp_per_task_plugin.o
 "gen_rtx_CONST_INT(machine_mode, long)", referenced from:
     (anonymous namespace)::arm_pertask_ssp_rtl_pass::execute() in arm_ssp_per_task_plugin.o
 "error(char const*, ...)", referenced from:
     _plugin_init in arm_ssp_per_task_plugin.o
 "opt_pass::gate()", referenced from:
     vtable for (anonymous namespace)::arm_pertask_ssp_rtl_pass in arm_ssp_per_task_plugin.o
     vtable for rtl_opt_pass in arm_ssp_per_task_plugin.o
 "opt_pass::clone()", referenced from:
     vtable for rtl_opt_pass in arm_ssp_per_task_plugin.o
 "opt_pass::execute()", referenced from:
     vtable for rtl_opt_pass in arm_ssp_per_task_plugin.o
 "opt_pass::opt_pass(pass_data const&, gcc::context*)", referenced from:
     (anonymous namespace)::arm_pertask_ssp_rtl_pass::clone() in arm_ssp_per_task_plugin.o
     make_arm_pertask_ssp_rtl_pass()     in arm_ssp_per_task_plugin.o
 "_default_target_rtl", referenced from:
     (anonymous namespace)::arm_pertask_ssp_rtl_pass::execute() in arm_ssp_per_task_plugin.o
 "_g", referenced from:
     (anonymous namespace)::arm_pertask_ssp_rtl_pass::clone() in arm_ssp_per_task_plugin.o
     make_arm_pertask_ssp_rtl_pass()     in arm_ssp_per_task_plugin.o
 "_mode_precision", referenced from:
     (anonymous namespace)::arm_pertask_ssp_rtl_pass::execute() in arm_ssp_per_task_plugin.o
 "_plugin_default_version_check", referenced from:
     _plugin_init in arm_ssp_per_task_plugin.o
 "_register_callback", referenced from:
     _plugin_init in arm_ssp_per_task_plugin.o
 "_x_rtl", referenced from:
     (anonymous namespace)::arm_pertask_ssp_rtl_pass::execute() in arm_ssp_per_task_plugin.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

This is because CONFIG_GCC_PLUGIN_ARM_SSP_PER_TASK became automatically enabled and was never
before. So the compiler may lack some library search path for building this plugin (which we
did never miss).


Compiler:	gcc 4.9.2 (self-built some years ago)

.config:	inherited from v5.1: http://download.goldelico.com/letux-kernel/letux-5.1/src/CONFIG

The critical section seems to be

CONFIG_GCC_VERSION=40902

CONFIG_PLUGIN_HOSTCC="g++"
CONFIG_HAVE_GCC_PLUGINS=y
# CONFIG_GCC_PLUGINS is not set

It is automatically turned by the new v5.2-rc1 patch into

CONFIG_PLUGIN_HOSTCC="g++"
CONFIG_HAVE_GCC_PLUGINS=y
CONFIG_GCC_PLUGINS=y
# CONFIG_GCC_PLUGIN_LATENT_ENTROPY is not set
# CONFIG_GCC_PLUGIN_RANDSTRUCT is not set
CONFIG_GCC_PLUGIN_ARM_SSP_PER_TASK=y
CONFIG_SND_PCM_OSS_PLUGINS=y
# CONFIG_GCC_PLUGIN_STRUCTLEAK_USER is not set
# CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF is not set
# CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL is not set

BR and thanks,
Nikolaus Schaller



More information about the Letux-kernel mailing list