On 9/8/20 10:26 AM, Xu, Yanfei wrote:


On 9/8/20 10:01 AM, Bruce Ashfield wrote:
On Mon, Sep 7, 2020 at 11:43 AM Xu, Yanfei <yanfei...@windriver.com> wrote:



On 9/7/20 7:53 PM, Bruce Ashfield wrote:
On Mon, Sep 7, 2020 at 5:56 AM Xu, Yanfei <yanfei...@windriver.com> wrote:

Hi Bruce,


When I excuted "make -C /usr/src/kernel scripts prepare" on target
mechine, I will be asked for choicing if to enable "GCC_PLUGINS" and
other configurations depend on "GCC_PLUGINS" (The .config file didn,t
contain 'GCC_PLUGINS is not set')
But there were never be asked for these before yocto add the
configuration which is "EXTRA_OEMAKE += " HOSTCXX="${BUILD_CXX}
${BUILD_CXXFLAGS} ${BUILD_LDFLAGS}""


Which machine and configuration are you seeing that in ? I've modified
devsrc several times to remove the triggers that cause that behaviour,
and would like to see how it crept back in.

Firstly, the commit:'kernel.bbclass: Configuration for environment with
HOSTCXX' expose this problem. After revert it, everything will be
normal.

Secondly, the mechine is qemuarm64. Which configuration you mean? The

yes, which machine and image type.

project's configuration is normal and only with ""IMAGE_INSTALL +=
"packagegroup-core-buildessential".  The configurations of Kconfig for
choosing is as the blow log messages.

I assume you are also installing kernel-devsrc on the target ?
Yes.


With these, I met a failure during compiling an external module on
target mechine after I enabled the GCC_PLUGINS and
CONFIG_GCC_PLUGIN_RANDSTRUCT by above methond. Failure messages as
below. There might be some other unexpected situations with GCC_PLUGIN
enabled.

In my oppinion, GCC_PLUGINS is rarely used, and It can be enable by who
want to use it. So how about disable it by defualt in
ktypes/base/base.cfg file? Do you think it is appropriate?

I don't disagree, but also, the configuration phase shouldn't be
triggered on target, so I'll fix that behaviour first.

That's great!

I was just able to build master, with kernel 5.8 and run the scripts
prepare target without triggering this:

scripts/Makefile.build:415: warning: overriding recipe for target
'modules.order'
Makefile:1371: warning: ignoring old recipe for target 'modules.order'
   CC      arch/arm64/kernel/vdso/vgettimeofday.o
   AS      arch/arm64/kernel/vdso/note.o
   AS      arch/arm64/kernel/vdso/sigreturn.o
   LD      arch/arm64/kernel/vdso/vdso.so.dbg
   VDSOSYM include/generated/vdso-offsets.h
make: Leaving directory '/lib/modules/5.8.5-yocto-standard/build'
root@qemuarm64:/usr/src/kernel#

Which is what I expected, since this is an effort I made when
introducing the 5.8 kernel. I'll retest with
5.4 now.
I'm sorry for omitting an imformation about that my project added many
nativesdks. I will ensure if the issue was triggered by these soon.

These nativesdks are irrelevant to the result.

I separately build projects with kernel5.4 and kernel5.8. There are some
differences about CONFIG_GCC_PLUGINS of /usr/src/kernel/.config on
target machine.

-----------5.4-----------------
CONFIG_PLUGIN_HOSTCC=""
CONFIG_HAVE_GCC_PLUGINS=y
# end of General architecture-dependent options

-----------5.8-----------------
CONFIG_HAVE_GCC_PLUGINS=y
CONFIG_GCC_PLUGINS=y
# CONFIG_GCC_PLUGIN_LATENT_ENTROPY is not set
# CONFIG_GCC_PLUGIN_RANDSTRUCT is not set
# end of General architecture-dependent options


Yanfei


Thanks,
Yanfei


Bruce


Thanks,
Yanfei



Bruce




Regards,
Yanfei


=============================================================

$ make -C /usr/src/kernel scripts prepare
......
\ * GCC plugins
*
GCC plugins (GCC_PLUGINS) [Y/n/?] (NEW) y
Generate some entropy during boot and runtime
(GCC_PLUGIN_LATENT_ENTROPY) [N/y/?] (NEW) y
Randomize layout of sensitive kernel structures (GCC_PLUGIN_RANDSTRUCT)
[N/y/?] (NEW) y
Use cacheline-aware structure randomization
(GCC_PLUGIN_RANDSTRUCT_PERFORMANCE) [N/y/?] (NEW) y
*
\ * Memory initialization
*
Initialize kernel stack variables at function entry
   > 1. no automatic initialization (weakest) (INIT_STACK_NONE)
2. zero-init structs marked for userspace (weak)
(GCC_PLUGIN_STRUCTLEAK_USER) (NEW)
3. zero-init structs passed by reference (strong)
(GCC_PLUGIN_STRUCTLEAK_BYREF) (NEW)
4. zero-init anything passed by reference (very strong)
(GCC_PLUGIN_STRUCTLEAK_BYREF_ALL) (NEW)
choice[1-4?]: 1
Poison kernel stack before returning from syscalls
(GCC_PLUGIN_STACKLEAK) [N/y/?] (NEW) y
Minimum stack frame size of functions tracked by STACKLEAK
(STACKLEAK_TRACK_MIN_SIZE) [100] (NEW)
Show STACKLEAK metrics in the /proc file system (STACKLEAK_METRICS)
[N/y/?] (NEW) y
Allow runtime disabling of kernel stack erasing
(STACKLEAK_RUNTIME_DISABLE) [N/y/?] (NEW) y
Enable heap memory zeroing on allocation by default
(INIT_ON_ALLOC_DEFAULT_ON) [N/y/?] n
Enable heap memory zeroing on free by default (INIT_ON_FREE_DEFAULT_ON)
[N/y/?] n

HOSTCC scripts/dtc/dtc.o
......
==
then build the module,
==
$ make -C /usr/src/kernel M=/module_path/module_example modules
Build external kernel module ...
make: Entering directory '/lib/modules/5.4.57-yocto-standard/build'
CC [M] /module_path/module_example/hello.o
Building modules, stage 2.
MODPOST 1 modules
ERROR: "module_layout" [/module_path/module_example/hello.ko] undefined!
make[1]: *** [scripts/Makefile.modpost:94: __modpost] Error 1
make: *** [Makefile:1630: modules] Error 2
make: Leaving directory '/lib/modules/5.4.57-yocto-standard/build'
==






--
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II




-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#9039): 
https://lists.yoctoproject.org/g/linux-yocto/message/9039
Mute This Topic: https://lists.yoctoproject.org/mt/76682606/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub  
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to