On Mon, Sep 28, 2020 at 10:30 PM Xu, Yanfei <[email protected]> wrote:
>
>
>
> On 9/9/20 12:02 PM, Bruce Ashfield wrote:
> > On Tue, Sep 8, 2020 at 8:23 AM Bruce Ashfield via
> > lists.yoctoproject.org
> > <[email protected]> wrote:
> >>
> >> On Tue, Sep 8, 2020 at 5:15 AM Xu, Yanfei <[email protected]> wrote:
> >>>
> >>>
> >>>
> >>> 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 <[email protected]>
> >>>>> wrote:
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> On 9/7/20 7:53 PM, Bruce Ashfield wrote:
> >>>>>>> On Mon, Sep 7, 2020 at 5:56 AM Xu, Yanfei <[email protected]>
> >>>>>>> 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
> >>
> >> Also, with the 5.4 kernel, I was able to trigger one on-target
> >> configuration run. I'll look into that first, and then get back to the
> >> gcc plugins config question.
> >
> > I have a fix for this now, and it will work for both 5.8 and 5.4 kernels.
> >
> > I need to test it a bit more, but I'll send the patch on my Wednesday
> > (since it is already Wednesday for you :)
> >
> > Bruce
> >
> Hi Bruce,
>
> With your fix, the problem is still here when I test it these day. And
> It only occur on 5.4 kernel.
>
> message as blow:
>
> root@qemuarm64:/module_path/module_example#
> root@qemuarm64:/module_path/module_example# cat /proc/version
> Linux version 5.4.65-yocto-standard (oe-user@oe-host) (gcc version
> 10.2.0 (GCC)) #1 SMP PREEMPT Mon Sep 28 04:05:32 UTC 2020
> root@qemuarm64:/module_path/module_example#
> root@qemuarm64:/module_path/module_example#
> aret@qemuarm64:/module_path/module_example# make -C /usr/src/kernel
> scripts prepa
> make: Entering directory '/lib/modules/5.4.65-yocto-standard/build'
> scripts/kconfig/conf  --syncconfig Kconfig
> *

You are building something non-standard.

If this is with master, I just confirmed that both qemuarm64 and
qemux86-64 work with no issues.

Here's the log of the arm test:

root@qemuarm64:/lib/modules/5.4.65-yocto-standard/build# make scripts prepare
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/dtc/dtc.o
  HOSTCC  scripts/dtc/flattree.o
  HOSTCC  scripts/dtc/fstree.o
  HOSTCC  scripts/dtc/data.o
  HOSTCC  scripts/dtc/livetree.o
  HOSTCC  scripts/dtc/treesource.o
  HOSTCC  scripts/dtc/srcpos.o
  HOSTCC  scripts/dtc/checks.o
  HOSTCC  scripts/dtc/util.o
  LEX     scripts/dtc/dtc-lexer.lex.c
  YACC    scripts/dtc/dtc-parser.tab.[ch]
  HOSTCC  scripts/dtc/dtc-lexer.lex.o
  HOSTCC  scripts/dtc/dtc-parser.tab.o
  HOSTLD  scripts/dtc/dtc
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/conmakehash
  HOSTCC  scripts/recordmcount
  HOSTCC  scripts/sortextable
  WRAP    arch/arm64/include/generated/uapi/asm/kvm_para.h
  WRAP    arch/arm64/include/generated/uapi/asm/errno.h
  WRAP    arch/arm64/include/generated/uapi/asm/ioctl.h
  WRAP    arch/arm64/include/generated/uapi/asm/ioctls.h
  WRAP    arch/arm64/include/generated/uapi/asm/ipcbuf.h
  WRAP    arch/arm64/include/generated/uapi/asm/mman.h
  WRAP    arch/arm64/include/generated/uapi/asm/msgbuf.h
  WRAP    arch/arm64/include/generated/uapi/asm/poll.h
  WRAP    arch/arm64/include/generated/uapi/asm/resource.h
  WRAP    arch/arm64/include/generated/uapi/asm/sembuf.h
  WRAP    arch/arm64/include/generated/uapi/asm/shmbuf.h
  WRAP    arch/arm64/include/generated/uapi/asm/siginfo.h
  WRAP    arch/arm64/include/generated/uapi/asm/socket.h
  WRAP    arch/arm64/include/generated/uapi/asm/sockios.h
  WRAP    arch/arm64/include/generated/uapi/asm/stat.h
  WRAP    arch/arm64/include/generated/uapi/asm/swab.h
  WRAP    arch/arm64/include/generated/uapi/asm/termbits.h
  WRAP    arch/arm64/include/generated/uapi/asm/termios.h
  WRAP    arch/arm64/include/generated/uapi/asm/types.h
  WRAP    arch/arm64/include/generated/asm/bugs.h
  WRAP    arch/arm64/include/generated/asm/delay.h
  WRAP    arch/arm64/include/generated/asm/div64.h
  WRAP    arch/arm64/include/generated/asm/dma.h
  WRAP    arch/arm64/include/generated/asm/dma-contiguous.h
  WRAP    arch/arm64/include/generated/asm/dma-mapping.h
  WRAP    arch/arm64/include/generated/asm/early_ioremap.h
  WRAP    arch/arm64/include/generated/asm/emergency-restart.h
  WRAP    arch/arm64/include/generated/asm/hw_irq.h
  WRAP    arch/arm64/include/generated/asm/irq_regs.h
  WRAP    arch/arm64/include/generated/asm/kdebug.h
  WRAP    arch/arm64/include/generated/asm/kmap_types.h
  WRAP    arch/arm64/include/generated/asm/local.h
  WRAP    arch/arm64/include/generated/asm/local64.h
  WRAP    arch/arm64/include/generated/asm/mcs_spinlock.h
  WRAP    arch/arm64/include/generated/asm/mm-arch-hooks.h
  WRAP    arch/arm64/include/generated/asm/mmiowb.h
  WRAP    arch/arm64/include/generated/asm/msi.h
  WRAP    arch/arm64/include/generated/asm/qrwlock.h
  WRAP    arch/arm64/include/generated/asm/qspinlock.h
  WRAP    arch/arm64/include/generated/asm/serial.h
  WRAP    arch/arm64/include/generated/asm/set_memory.h
  WRAP    arch/arm64/include/generated/asm/switch_to.h
  WRAP    arch/arm64/include/generated/asm/trace_clock.h
  WRAP    arch/arm64/include/generated/asm/unaligned.h
  WRAP    arch/arm64/include/generated/asm/user.h
  WRAP    arch/arm64/include/generated/asm/vga.h
  CC      scripts/mod/empty.o
  HOSTCC  scripts/mod/mk_elfconfig
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/modpost.o
  CC      scripts/mod/devicetable-offsets.s
  UPD     scripts/mod/devicetable-offsets.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  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
root@qemuarm64:/lib/modules/5.4.65-yocto-standard/build# uname -a
Linux qemuarm64 5.4.65-yocto-standard #1 SMP PREEMPT Mon Sep 14
15:40:15 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
root@qemuarm64:/lib/modules/5.4.65-yocto-standard/build#

Bruce


> * Restart config...
> *
> *
> * 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?]:
>
> Thanks,
> Yanfei
>
> >>
> >> Cheers,
> >>
> >> Bruce
> >>
> >>>
> >>>
> >>> 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
> >>>>>
> >>>>
> >>>>
> >>>>
> >>
> >>
> >>
> >> --
> >> - Thou shalt not follow the NULL pointer, for chaos and madness await
> >> thee at its end
> >> - "Use the force Harry" - Gandalf, Star Trek II
> >> 
> >
> >
> >



-- 
- 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 (#9098): 
https://lists.yoctoproject.org/g/linux-yocto/message/9098
Mute This Topic: https://lists.yoctoproject.org/mt/76682606/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to