Re: [tip:sched/core 14/47] /bin/bash: line 1: 21320 Segmentation fault sparse -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise -Wno-return-void -Wno-unknown-attribute -fdiagnostic-prefix -D__CHECK_ENDIAN__ -D__NDS32_EB__ --arch=nds32 -mbig-endian -m32 -Wp,-MMD,kernel...

From: Yafang Shao
Date: Sat Oct 09 2021 - 13:02:36 EST


On Sat, Oct 9, 2021 at 8:05 PM kernel test robot <lkp@xxxxxxxxx> wrote:
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core
> head: b2d5b9cec60fecc72a13191c2c6c05acf60975a5
> commit: 60f2415e19d3948641149ac6aca137a7be1d1952 [14/47] sched: Make schedstats helpers independent of fair sched class
> config: nds32-randconfig-s031-20211009 (attached as .config)
> compiler: nds32le-linux-gcc (GCC) 11.2.0
> reproduce:
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # apt-get install sparse
> # sparse version: v0.6.4-dirty
> # https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=60f2415e19d3948641149ac6aca137a7be1d1952
> git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
> git fetch --no-tags tip sched/core
> git checkout 60f2415e19d3948641149ac6aca137a7be1d1952
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=nds32
>

Hi kernel test robot,

When I'm trying to reproduce it, I find there're lots of "Segmentation
fault sparse" errors even without my commit,

for example,

/bin/sh: line 1: 85051 Segmentation fault (core dumped) sparse
-D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise
-Wno-return-void -Wno-unknown-attribute -fdiagnostic-prefix
-D__CHECK_ENDIAN__ -D__NDS32_EB__ --arch=nds32 -mbig-endian -m32
-Wp,-MMD,init/.main.o.d -nostdinc -isystem
/root/0day/gcc-11.2.0-nolibc/nds32le-linux/bin/../lib/gcc/nds32le-linux/11.2.0/include
-I./arch/nds32/include -I./arch/nds32/include/generated -I./include
-I./arch/nds32/include/uapi -I./arch/nds32/include/generated/uapi
-I./include/uapi -I./include/generated/uapi -include
./include/linux/compiler-version.h -include ./include/linux/kconfig.h
-include ./include/linux/compiler_types.h -D__KERNEL__
-fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes
-Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE
-Werror=implicit-function-declaration -Werror=implicit-int
-Werror=return-type -Wno-format-security -std=gnu89
-mno-sched-prolog-epilog -mcmodel=large -mno-ext-fpu-sp
-mno-ext-fpu-dp -mfloat-abi=soft -EB -fno-delete-null-pointer-checks
-Wno-frame-address -Wno-format-truncation -Wno-format-overflow
-Wno-address-of-packed-member -O2 -fno-allow-store-data-races
-fno-reorder-blocks -fno-ipa-cp-clone -fno-partial-inlining
-Wframe-larger-than=1024 -fno-stack-protector -Wimplicit-fallthrough=5
-Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable
-fomit-frame-pointer -fno-stack-clash-protection
-fzero-call-used-regs=used-gpr -fno-inline-functions-called-once
-falign-functions=64 -Wdeclaration-after-statement -Wvla
-Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds
-Wno-array-bounds -Wno-stringop-overflow -Wno-restrict
-Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check
-fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types
-Werror=designated-init -Wno-packed-not-aligned -fno-function-sections
-fno-data-sections -DKBUILD_MODFILE='"init/main"'
-DKBUILD_BASENAME='"main"' -DKBUILD_MODNAME='"main"'
-D__KBUILD_MODNAME=kmod_main init/main.c

/bin/sh: line 1: 88064 Segmentation fault (core dumped) sparse
-D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise
-Wno-return-void -Wno-unknown-attribute -fdiagnostic-prefix
-D__CHECK_ENDIAN__ -D__NDS32_EB__ --arch=nds32 -mbig-endian -m32
-Wp,-MMD,kernel/events/.core.o.d -nostdinc -isystem
/root/0day/gcc-11.2.0-nolibc/nds32le-linux/bin/../lib/gcc/nds32le-linux/11.2.0/include
-I./arch/nds32/include -I./arch/nds32/include/generated -I./include
-I./arch/nds32/include/uapi -I./arch/nds32/include/generated/uapi
-I./include/uapi -I./include/generated/uapi -include
./include/linux/compiler-version.h -include ./include/linux/kconfig.h
-include ./include/linux/compiler_types.h -D__KERNEL__
-fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes
-Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE
-Werror=implicit-function-declaration -Werror=implicit-int
-Werror=return-type -Wno-format-security -std=gnu89
-mno-sched-prolog-epilog -mcmodel=large -mno-ext-fpu-sp
-mno-ext-fpu-dp -mfloat-abi=soft -EB -fno-delete-null-pointer-checks
-Wno-frame-address -Wno-format-truncation -Wno-format-overflow
-Wno-address-of-packed-member -O2 -fno-allow-store-data-races
-fno-reorder-blocks -fno-ipa-cp-clone -fno-partial-inlining
-Wframe-larger-than=1024 -fno-stack-protector -Wimplicit-fallthrough=5
-Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable
-fomit-frame-pointer -fno-stack-clash-protection
-fzero-call-used-regs=used-gpr -fno-inline-functions-called-once
-falign-functions=64 -Wdeclaration-after-statement -Wvla
-Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds
-Wno-array-bounds -Wno-stringop-overflow -Wno-restrict
-Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check
-fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types
-Werror=designated-init -Wno-packed-not-aligned
-DKBUILD_MODFILE='"kernel/events/core"' -DKBUILD_BASENAME='"core"'
-DKBUILD_MODNAME='"core"' -D__KBUILD_MODNAME=kmod_core
kernel/events/core.c

/bin/sh: line 1: 88141 Segmentation fault (core dumped) sparse
-D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise
-Wno-return-void -Wno-unknown-attribute -fdiagnostic-prefix
-D__CHECK_ENDIAN__ -D__NDS32_EB__ --arch=nds32 -mbig-endian -m32
-Wp,-MMD,mm/.balloon_compaction.o.d -nostdinc -isystem
/root/0day/gcc-11.2.0-nolibc/nds32le-linux/bin/../lib/gcc/nds32le-linux/11.2.0/include
-I./arch/nds32/include -I./arch/nds32/include/generated -I./include
-I./arch/nds32/include/uapi -I./arch/nds32/include/generated/uapi
-I./include/uapi -I./include/generated/uapi -include
./include/linux/compiler-version.h -include ./include/linux/kconfig.h
-include ./include/linux/compiler_types.h -D__KERNEL__
-fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes
-Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE
-Werror=implicit-function-declaration -Werror=implicit-int
-Werror=return-type -Wno-format-security -std=gnu89
-mno-sched-prolog-epilog -mcmodel=large -mno-ext-fpu-sp
-mno-ext-fpu-dp -mfloat-abi=soft -EB -fno-delete-null-pointer-checks
-Wno-frame-address -Wno-format-truncation -Wno-format-overflow
-Wno-address-of-packed-member -O2 -fno-allow-store-data-races
-fno-reorder-blocks -fno-ipa-cp-clone -fno-partial-inlining
-Wframe-larger-than=1024 -fno-stack-protector -Wimplicit-fallthrough=5
-Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable
-fomit-frame-pointer -fno-stack-clash-protection
-fzero-call-used-regs=used-gpr -fno-inline-functions-called-once
-falign-functions=64 -Wdeclaration-after-statement -Wvla
-Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds
-Wno-array-bounds -Wno-stringop-overflow -Wno-restrict
-Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check
-fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types
-Werror=designated-init -Wno-packed-not-aligned
-DKBUILD_MODFILE='"mm/balloon_compaction"'
-DKBUILD_BASENAME='"balloon_compaction"'
-DKBUILD_MODNAME='"balloon_compaction"'
-D__KBUILD_MODNAME=kmod_balloon_compaction mm/balloon_compaction.c

....

And those Segmentation fault of sparse can also be found in dmesg,
[ 5540.785485] sparse[91520]: segfault at 0 ip 0000000000417bff sp
00007ffe318f1e80 error 4 in sparse[400000+53000]
[ 5540.785489] Code: ff ff ff e9 dc fd ff ff 0f 1f 00 48 8b 7f 20 e8
97 fc ff ff 48 3b 43 20 48 89 c5 0f 85 3f fd ff ff e9 be fd ff ff 48
8b 6f 28 <80> 7d 00 18 0f 85 9b fd ff ff 4c 8b 77 08 4c 8b 6f 20 31 ff
e8 38
[ 5541.924384] sparse[91643]: segfault at 0 ip 0000000000417bff sp
00007ffc4f408a30 error 4 in sparse[400000+53000]
[ 5541.924389] Code: ff ff ff e9 dc fd ff ff 0f 1f 00 48 8b 7f 20 e8
97 fc ff ff 48 3b 43 20 48 89 c5 0f 85 3f fd ff ff e9 be fd ff ff 48
8b 6f 28 <80> 7d 00 18 0f 85 9b fd ff ff 4c 8b 77 08 4c 8b 6f 20 31 ff
e8 38
[ 5542.836875] sparse[91748]: segfault at 0 ip 0000000000417bff sp
00007ffdebd5d880 error 4 in sparse[400000+53000]
[ 5542.836881] Code: ff ff ff e9 dc fd ff ff 0f 1f 00 48 8b 7f 20 e8
97 fc ff ff 48 3b 43 20 48 89 c5 0f 85 3f fd ff ff e9 be fd ff ff 48
8b 6f 28 <80> 7d 00 18 0f 85 9b fd ff ff 4c 8b 77 08 4c 8b 6f 20 31 ff
e8 38
[ 5543.763152] sparse[91855]: segfault at 0 ip 0000000000417bff sp
00007ffd4b9789c0 error 4 in sparse[400000+53000]
[ 5543.763158] Code: ff ff ff e9 dc fd ff ff 0f 1f 00 48 8b 7f 20 e8
97 fc ff ff 48 3b 43 20 48 89 c5 0f 85 3f fd ff ff e9 be fd ff ff 48
8b 6f 28 <80> 7d 00 18 0f 85 9b fd ff ff 4c 8b 77 08 4c 8b 6f 20 31 ff
e8 38
[ 5545.193189] sparse[91999]: segfault at 0 ip 0000000000417bff sp
00007ffcfa153710 error 4 in sparse[400000+53000]
[ 5545.193216] Code: ff ff ff e9 dc fd ff ff 0f 1f 00 48 8b 7f 20 e8
97 fc ff ff 48 3b 43 20 48 89 c5 0f 85 3f fd ff ff e9 be fd ff ff 48
8b 6f 28 <80> 7d 00 18 0f 85 9b fd ff ff 4c 8b 77 08 4c 8b 6f 20 31 ff
e8 38
....

Doesn't that mean there is a bug in the sparse ?


> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All errors (new ones prefixed by >>):
>
> kernel/sched/fair.c: note: in included file (through include/linux/ww_mutex.h, include/linux/seqlock.h, include/linux/hrtimer.h, ...):
> include/linux/rtmutex.h:70:65: sparse: sparse: Expected ) in function declarator
> include/linux/rtmutex.h:70:65: sparse: sparse: got $
> kernel/sched/fair.c: note: in included file (through include/linux/sched.h, kernel/sched/sched.h):
> include/linux/seccomp.h:96:63: sparse: sparse: Expected ) in function declarator
> include/linux/seccomp.h:96:63: sparse: sparse: got $
> include/linux/seccomp.h:99:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/seccomp.h:99:1: sparse: sparse: got }
> include/linux/seccomp.h:103:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/seccomp.h:103:1: sparse: sparse: got }
> include/linux/seccomp.h:116:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/seccomp.h:116:1: sparse: sparse: got }
> include/linux/seccomp.h:122:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/seccomp.h:122:1: sparse: sparse: got }
> kernel/sched/fair.c: note: in included file (through include/linux/nodemask.h, include/linux/sched.h, kernel/sched/sched.h):
> include/linux/numa.h:50:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/numa.h:50:1: sparse: sparse: got }
> include/linux/numa.h:54:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/numa.h:54:1: sparse: sparse: got }
> include/linux/numa.h:58:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/numa.h:58:1: sparse: sparse: got }
> kernel/sched/fair.c: note: in included file (through include/linux/sched.h, kernel/sched/sched.h):
> include/linux/nodemask.h:98:54: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:98:54: sparse: sparse: got }
> include/linux/nodemask.h:99:19: sparse: sparse: Expected ; at end of declaration
> include/linux/nodemask.h:99:19: sparse: sparse: got _unused_nodemask_arg_
> include/linux/nodemask.h:109:68: sparse: sparse: Expected ) in function declarator
> include/linux/nodemask.h:109:68: sparse: sparse: got *
> include/linux/nodemask.h:112:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:112:1: sparse: sparse: got }
> include/linux/nodemask.h:116:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:116:1: sparse: sparse: got }
> include/linux/nodemask.h:131:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:131:1: sparse: sparse: got }
> include/linux/nodemask.h:137:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:137:1: sparse: sparse: got }
> include/linux/nodemask.h:143:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:143:1: sparse: sparse: got }
> include/linux/nodemask.h:149:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:149:1: sparse: sparse: got }
> include/linux/nodemask.h:159:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:159:1: sparse: sparse: got }
> include/linux/nodemask.h:167:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:167:1: sparse: sparse: got }
> include/linux/nodemask.h:175:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:175:1: sparse: sparse: got }
> include/linux/nodemask.h:183:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:183:1: sparse: sparse: got }
> include/linux/nodemask.h:191:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:191:1: sparse: sparse: got }
> include/linux/nodemask.h:199:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:199:1: sparse: sparse: got }
> include/linux/nodemask.h:207:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:207:1: sparse: sparse: got }
> include/linux/nodemask.h:215:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:215:1: sparse: sparse: got }
> include/linux/nodemask.h:223:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:223:1: sparse: sparse: got }
> include/linux/nodemask.h:229:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:229:1: sparse: sparse: got }
> include/linux/nodemask.h:235:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:235:1: sparse: sparse: got }
> include/linux/nodemask.h:241:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:241:1: sparse: sparse: got }
> include/linux/nodemask.h:249:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:249:1: sparse: sparse: got }
> include/linux/nodemask.h:257:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:257:1: sparse: sparse: got }
> include/linux/nodemask.h:265:16: sparse: sparse: Expected ) in nested declarator
> include/linux/nodemask.h:265:16: sparse: sparse: got <
> include/linux/nodemask.h:265:16: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:265:16: sparse: sparse: got }
> include/linux/nodemask.h:266:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:266:1: sparse: sparse: got }
> include/linux/nodemask.h:271:16: sparse: sparse: Expected ) in nested declarator
> include/linux/nodemask.h:271:16: sparse: sparse: got <
> include/linux/nodemask.h:271:16: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:271:16: sparse: sparse: got }
> include/linux/nodemask.h:272:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:272:1: sparse: sparse: got }
> include/linux/nodemask.h:281:53: sparse: sparse: Expected ) in function declarator
> include/linux/nodemask.h:281:53: sparse: sparse: got *
> include/linux/nodemask.h:284:9: sparse: sparse: Expected ) in function declarator
> include/linux/nodemask.h:284:9: sparse: sparse: got (
> include/linux/nodemask.h:285:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:285:1: sparse: sparse: got }
> include/linux/nodemask.h:301:16: sparse: sparse: Expected ) in nested declarator
> include/linux/nodemask.h:301:16: sparse: sparse: got <
> include/linux/nodemask.h:301:16: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:301:16: sparse: sparse: got }
> include/linux/nodemask.h:303:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:303:1: sparse: sparse: got }
> include/linux/nodemask.h:337:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:337:1: sparse: sparse: got }
> include/linux/nodemask.h:343:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:343:1: sparse: sparse: got }
> include/linux/nodemask.h:351:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:351:1: sparse: sparse: got }
> include/linux/nodemask.h:359:1: sparse: sparse: Expected ; at the end of type declaration
> include/linux/nodemask.h:359:1: sparse: sparse: too many errors
> >> /bin/bash: line 1: 21320 Segmentation fault sparse -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise -Wno-return-void -Wno-unknown-attribute -fdiagnostic-prefix -D__CHECK_ENDIAN__ -D__NDS32_EB__ --arch=nds32 -mbig-endian -m32 -Wp,-MMD,kernel/sched/.fair.o.d -nostdinc -isystem /opt/cross/gcc-11.2.0-nolibc/nds32le-linux/bin/../lib/gcc/nds32le-linux/11.2.0/include -Iarch/nds32/include -I./arch/nds32/include/generated -Iinclude -I./include -Iarch/nds32/include/uapi -I./arch/nds32/include/generated/uapi -Iinclude/uapi -I./include/generated/uapi -include include/linux/compiler-version.h -include include/linux/kconfig.h -include include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map== -DKBUILD_EXTRA_WARN1 -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu89 -mno-sched-prolog-epilog -mcmodel=large -mno-ext-fpu-sp -mno-ext-fpu-dp -mfloat-abi=soft -EB -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -fno-reorder-blocks -fno-ipa-cp-clone -fno-partial-inlining -Wframe-larger-than=1024 -fno-stack-protector -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fomit-frame-pointer -fno-stack-clash-protection -fzero-call-used-regs=used-gpr -fno-inline-functions-called-once -falign-functions=64 -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -Wno-zero-length-bounds -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -Wextra -Wunused -Wno-unused-parameter -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wold-style-definition -Wmissing-include-dirs -Wunused-but-set-variable -Wunused-const-variable -Wpacked-not-aligned -Wstringop-truncation -Wno-missing-field-initializers -Wno-sign-compare -Wno-type-limits -I kernel/sched -I ./kernel/sched -DKBUILD_MODFILE='"kernel/sched/fair"' -DKBUILD_BASENAME='"fair"' -DKBUILD_MODNAME='"fair"' -D__KBUILD_MODNAME=kmod_fair kernel/sched/fair.c
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx



--
Thanks
Yafang