Re: [akpm-mm:mm-nonmm-unstable 18/58] ERROR: modpost: vmlinux: local symbol 'kthread_stop_put' was exported

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(+CC: RISCV, toolchian folks)

Original Thread:
https://lore.kernel.org/oe-kbuild-all/202310282049.HXCHtgEz-lkp@xxxxxxxxx/


On Sun, Oct 29, 2023 at 1:36 AM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Sat, 28 Oct 2023 20:29:18 +0800 kernel test robot <lkp@xxxxxxxxx> wrote:
>
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable
> > head:   d431880137b55533f664056070226a88dba99637
> > commit: 6309727ef27162deabd5c095c11af24970fba5a2 [18/58] kthread: add kthread_stop_put
> > config: riscv-randconfig-c033-20221102 (https://download.01.org/0day-ci/archive/20231028/202310282049.HXCHtgEz-lkp@xxxxxxxxx/config)
> > compiler: riscv32-linux-gcc (GCC) 13.2.0
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231028/202310282049.HXCHtgEz-lkp@xxxxxxxxx/reproduce)
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/202310282049.HXCHtgEz-lkp@xxxxxxxxx/
> >
> > All errors (new ones prefixed by >>, old ones prefixed by <<):
> >
> > ERROR: modpost: vmlinux: local symbol 'system_power_efficient_wq' was exported
>
> [ it now proceeds to list 16000 more such "errors" ]
>
> I see no error here - these symbols are exported because modules use
> them.  Unless I misinterpret the intent of this modpost check.
>
> Masahiro, could you please take a look?


I was able to reproduce the issue even in the mainline kernel.

But, the warnings are not only the export symbols,
but also a ton of false-positive section mismatch warnings.

To me, the RELA sections look broken when the vmlinux size
grows to a certain extent.

I suspected a toolchain bug, but I am not 100% sure.

In my investigation, this happens under some conditions.

 - It happens on RISCV 32-bit
 - It happens with GCC. LLVM is no problem.
 - It happens when the vmlinux size grows


I attached a simple reproducer script at the end of this reply.


Please checkout the v6.6 tag.
Run the reproducer, with the yes2modconfig line commented out.


When vmlinux.o is small, the relocation info looks sane.
For example,

$ riscv64-linux-gnu-size vmlinux.o
   text    data     bss     dec     hex filename
10762048 905937 342657 12010642 b74492 vmlinux.o
$ riscv64-linux-gnu-readelf -r vmlinux.o  | grep -m1 -A10 rela.export_symbol
Relocation section '.rela.export_symbol' at offset 0x1d9491d4 contains
9789 entries:
 Offset     Info    Type            Sym.Value  Sym. Name + Addend
00000004  c3130301 R_RISCV_32        00000024   system_state + 0
00000010  c33b6901 R_RISCV_32        00000018   static_key_initialized + 0
00000018  c3024d01 R_RISCV_32        00000014   reset_devices + 0
00000020  c33b9e01 R_RISCV_32        00000008   loops_per_jiffy + 0
0000002c  c2f57201 R_RISCV_32        00000110   init_uts_ns + 0
00000038  c3233601 R_RISCV_32        00000354   wait_for_initramfs + 0
00000040  c2ffff01 R_RISCV_32        00000340   init_task + 0
00000048  c313fc01 R_RISCV_32        00000b58   riscv_cached_mvendorid + 0
00000050  c2f78a01 R_RISCV_32        00000b7e   riscv_cached_marchid + 0







Run the reproducer, with the yes2modconfig line in.

vmlinux.o gets bigger, and the relocation info is messed up.
ELF_R_SYM() starts to point local symbols ".LASF*"


$ riscv64-linux-gnu-size vmlinux.o
   text    data     bss     dec     hex filename
16831652 1141862 390321 18363835 11835bb vmlinux.o

$ riscv64-linux-gnu-readelf -r vmlinux.o  | grep -A10 rela.export_symbol
Relocation section '.rela.export_symbol' at offset 0x3201524c contains
11648 entries:
 Offset     Info    Type            Sym.Value  Sym. Name + Addend
00000004  3f41b601 R_RISCV_32        01302449   .LASF1851 + 0
00000010  3f3f4301 R_RISCV_32        012ffca4   .LASF1225 + 0
00000018  3f40d201 R_RISCV_32        01300bc1   .LASF1623 + 0
00000020  3f646a01 R_RISCV_32        01319a43   .LASF5361 + 0
0000002c  3f2f6201 R_RISCV_32        012f5c1f   .LASF3521 + 0
00000038  3f168701 R_RISCV_32        012dd796   .LASF4363 + 0
00000040  3f5d8c01 R_RISCV_32        01319a26   .LASF3685 + 0
00000048  3f092501 R_RISCV_32        012e5792   .LASF939 + 0
00000050  3f22b501 R_RISCV_32        012f89a4   .LASF277 + 0





This is the reproducer shell script.

------------------->8-----------------------------
#!/bin/sh

set -e

# I used riscv64-linux-gnu-gcc available on Ubuntu.
# Instead, you can also use riscv32-linux-gcc, riscv64-linux-gcc, etc.
# provided by the 0day.

export CROSS_COMPILE=riscv64-linux-gnu-

make ARCH=riscv defconfig

#
# Configure for 32-bit
#
make ARCH=riscv 32-bit.config

#
# Turn =m into =y in order to grow vmlinux
#
make ARCH=riscv mod2yesconfig

#
# Enable DEBUG_INFO
#
./scripts/config -d CONFIG_DEBUG_INFO_NONE
./scripts/config -e CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT

# sync the .config
make ARCH=riscv olddefconfig

make ARCH=riscv -j$(nproc) vmlinux_o
------------------------>8------------------------------------



-- 
Best Regards
Masahiro Yamada





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux