Re: [linus:master] [kconfig] f79dc03fe6: segfault_at_ip_sp_error

From: Masahiro Yamada
Date: Thu Aug 08 2024 - 04:28:25 EST


On Thu, Aug 8, 2024 at 4:53 PM Oliver Sang <oliver.sang@xxxxxxxxx> wrote:
>
> hi, Masahiro Yamada,
>
> On Tue, Aug 06, 2024 at 05:57:47PM +0900, Masahiro Yamada wrote:
> > On Tue, Aug 6, 2024 at 5:21 PM kernel test robot <oliver.sang@xxxxxxxxx> wrote:
> > >
> > >
> > > hi, Masahiro Yamada,
> > >
> > > the config for this test is a random config, by this commit, the config has
> > > below diff with parent:
> > >
> > > --- /pkg/linux/i386-randconfig-r032-20230623/gcc-12/ee29e6204c32dce013ac6d1078d98dce5607ce86/.config 2024-08-05 12:56:30.744686432 +0800
> > > +++ /pkg/linux/i386-randconfig-r032-20230623/gcc-12/f79dc03fe68c79d388908182e68d702f7f1786bc/.config 2024-08-05 12:56:37.620536644 +0800
> > > @@ -770,14 +770,14 @@ CONFIG_MODULE_UNLOAD=y
> > > CONFIG_MODULE_SIG=y
> > > # CONFIG_MODULE_SIG_FORCE is not set
> > > CONFIG_MODULE_SIG_ALL=y
> > > -CONFIG_MODULE_SIG_SHA1=y
> > > +# CONFIG_MODULE_SIG_SHA1 is not set
> > > # CONFIG_MODULE_SIG_SHA256 is not set
> > > # CONFIG_MODULE_SIG_SHA384 is not set
> > > # CONFIG_MODULE_SIG_SHA512 is not set
> > > -# CONFIG_MODULE_SIG_SHA3_256 is not set
> > > +CONFIG_MODULE_SIG_SHA3_256=y
> > > # CONFIG_MODULE_SIG_SHA3_384 is not set
> > > # CONFIG_MODULE_SIG_SHA3_512 is not set
> > > -CONFIG_MODULE_SIG_HASH="sha1"
> > > +CONFIG_MODULE_SIG_HASH="sha3-256"
> > > CONFIG_MODULE_COMPRESS_NONE=y
> > > # CONFIG_MODULE_COMPRESS_GZIP is not set
> > > # CONFIG_MODULE_COMPRESS_XZ is not set
> > > @@ -6201,7 +6201,6 @@ CONFIG_FIPS_SIGNATURE_SELFTEST_ECDSA=y
> > > #
> > > CONFIG_MODULE_SIG_KEY="certs/signing_key.pem"
> > > CONFIG_MODULE_SIG_KEY_TYPE_RSA=y
> > > -# CONFIG_MODULE_SIG_KEY_TYPE_ECDSA is not set
> > > CONFIG_SYSTEM_TRUSTED_KEYRING=y
> > > CONFIG_SYSTEM_TRUSTED_KEYS=""
> > > CONFIG_SYSTEM_EXTRA_CERTIFICATE=y
> > >
> > >
> > > we are not sure if these are expected?
> >
> >
> > This is expected.
> >
> > f79dc03fe68c79d388908182e68d702f7f1786bc changed the way how choice is
> > calculated.
> > So, the randconfig from the same seed can result in a different .config file.
> >
> >
> >
> > > we are not sure either if the issue in below report is caused by this config
> > > diff. just report what we observed in our tests FYI.
> >
> >
> > I believe it is a different issue.
> >
> > It is just a problem with the combination of depmod
> > and CONFIG_MODULE_SIG_SHA3_256=y, isn't it?
>
> we are not sure. we just use randconfig to run rcutorture tests.



See this line in the error report:


[ 15.209351][ T483] depmod[483]: segfault at 0 ip b7abe4f6 sp
bfb00aa4 error 4 in libc-2.31.so[8c4f6,b7a4b000+155000] likely on CPU
0 (core 0, socket 0)







> >
> >
> > What is your depmod (kmod) version?
>
> our kmod version is 28


See this again:

https://lore.kernel.org/linux-kbuild/E1rNVlL-000qDm-Pg@xxxxxxxxxxxxxxxxxxxxxx/


It clearly explains when the issue happens:

When using the SHA3 module signing options, kmod 28 segfaults during
"make modules_install" on the build host.



If you are using kmod 28, upgrading it will presumably fix the issue.




>
> >
> > The crash of kmod<=28 with CONFIG_MODULE_SIG_SHA3_384=y is a known issue:
> >
> > https://lore.kernel.org/linux-kbuild/E1rNVlL-000qDm-Pg@xxxxxxxxxxxxxxxxxxxxxx/
> >
> >
> >
> > >
> > >
> > > Hello,
> > >
> > > kernel test robot noticed "segfault_at_ip_sp_error" on:
> > >
> > > commit: f79dc03fe68c79d388908182e68d702f7f1786bc ("kconfig: refactor choice value calculation")
> > > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git master
> > >
> > > [test failed on linus/master de9c2c66ad8e787abec7c9d7eff4f8c3cdd28aed]
> > > [test failed on linux-next/master d6dbc9f56c3a70e915625b6f1887882c23dc5c91]
> > >
> > > in testcase: rcutorture
> > > version:
> > > with following parameters:
> > >
> > > runtime: 300s
> > > test: default
> > > torture_type: srcud
> > >
> > >
> > >
> > > compiler: gcc-12
> > > test machine: qemu-system-i386 -enable-kvm -cpu SandyBridge -smp 2 -m 4G
> > >
> > > (please refer to attached dmesg/kmsg for entire log/backtrace)
> > >
> > >
> > > +-------------------------+------------+------------+
> > > | | ee29e6204c | f79dc03fe6 |
> > > +-------------------------+------------+------------+
> > > | segfault_at_ip_sp_error | 0 | 30 |
> > > +-------------------------+------------+------------+
> > >
> > >
> > > 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 <oliver.sang@xxxxxxxxx>
> > > | Closes: https://lore.kernel.org/oe-lkp/202408061634.fe6be94-oliver.sang@xxxxxxxxx
> > >
> > >
> > > [ OK ] Started OpenBSD Secure Shell server.
> > > LKP: ttyS0: 263: Kernel tests: Boot OK!
> > > LKP: ttyS0: 263: HOSTNAME vm-snb-i386, MAC 52:54:00:12:34:56, kernel 6.10.0-rc7-00022-gf79dc03fe68c 1
> > > [ 12.271477][ T23] input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input3
> > > LKP: ttyS0: 263: /lkp/lkp/src/bin/run-lkp /lkp/jobs/scheduled/vm-meta-59/rcutorture-300s-default-srcud-debian-11.1-i386-20220923.cgz-i386-randconfig-r032-20230623-f79dc03fe68c-20240805-47158-x4nrel-3.yaml
> > > [ 15.209351][ T483] depmod[483]: segfault at 0 ip b7abe4f6 sp bfb00aa4 error 4 in libc-2.31.so[8c4f6,b7a4b000+155000] likely on CPU 0 (core 0, socket 0)
> > > [ 15.210249][ T483] Code: 5b 5e 29 f8 5f c3 66 90 66 90 66 90 66 90 66 90 66 90 66 90 56 57 8b 7c 24 0c 31 c0 89 f9 83 e1 3f 66 0f ef c0 83 f9 30 77 17 <f3> 0f 6f 0f 66 0f 74 c1 66 0f d7 d0 85 d2 75 73 89 f8 83 e0 f0 eb
> > > All code
> > > ========
> > > 0: 5b pop %rbx
> > > 1: 5e pop %rsi
> > > 2: 29 f8 sub %edi,%eax
> > > 4: 5f pop %rdi
> > > 5: c3 retq
> > > 6: 66 90 xchg %ax,%ax
> > > 8: 66 90 xchg %ax,%ax
> > > a: 66 90 xchg %ax,%ax
> > > c: 66 90 xchg %ax,%ax
> > > e: 66 90 xchg %ax,%ax
> > > 10: 66 90 xchg %ax,%ax
> > > 12: 66 90 xchg %ax,%ax
> > > 14: 56 push %rsi
> > > 15: 57 push %rdi
> > > 16: 8b 7c 24 0c mov 0xc(%rsp),%edi
> > > 1a: 31 c0 xor %eax,%eax
> > > 1c: 89 f9 mov %edi,%ecx
> > > 1e: 83 e1 3f and $0x3f,%ecx
> > > 21: 66 0f ef c0 pxor %xmm0,%xmm0
> > > 25: 83 f9 30 cmp $0x30,%ecx
> > > 28: 77 17 ja 0x41
> > > 2a:* f3 0f 6f 0f movdqu (%rdi),%xmm1 <-- trapping instruction
> > > 2e: 66 0f 74 c1 pcmpeqb %xmm1,%xmm0
> > > 32: 66 0f d7 d0 pmovmskb %xmm0,%edx
> > > 36: 85 d2 test %edx,%edx
> > > 38: 75 73 jne 0xad
> > > 3a: 89 f8 mov %edi,%eax
> > > 3c: 83 e0 f0 and $0xfffffff0,%eax
> > > 3f: eb .byte 0xeb
> > >
> > > Code starting with the faulting instruction
> > > ===========================================
> > > 0: f3 0f 6f 0f movdqu (%rdi),%xmm1
> > > 4: 66 0f 74 c1 pcmpeqb %xmm1,%xmm0
> > > 8: 66 0f d7 d0 pmovmskb %xmm0,%edx
> > > c: 85 d2 test %edx,%edx
> > > e: 75 73 jne 0x83
> > > 10: 89 f8 mov %edi,%eax
> > > 12: 83 e0 f0 and $0xfffffff0,%eax
> > > 15: eb .byte 0xeb
> > > [ 15.251290][ T487] torture module --- srcud: disable_onoff_at_boot=0 ftrace_dump_at_shutdown=0 verbose_sleep_frequency=0 verbose_sleep_duration=1 random_shuffle=0
> > > [ 15.255881][ T487] srcud-torture:--- Start of test: nreaders=1 nfakewriters=4 stat_interval=60 verbose=1 test_no_idle_hz=1 shuffle_interval=3 stutter=5 irqreader=1 fqs_duration=0 fqs_holdoff=0 fqs_stutter=3 test_boost=1/0 test_boost_interval=7 test_boost_duration=4 shutdown_secs=0 stall_cpu=0 stall_cpu_holdoff=10 stall_cpu_irqsoff=0 stall_cpu_block=0 n_barrier_cbs=0 onoff_interval=0 onoff_holdoff=0 read_exit_delay=13 read_exit_burst=16 nocbs_nthreads=0 nocbs_toggle=1000 test_nmis=0
> > > [ 15.258765][ T487] srcud: Start-test grace-period state: g0 f0x0
> > > [ 15.259257][ T487] rcu_torture_write_types: Testing expedited GPs.
> > > [ 15.259713][ T487] rcu_torture_write_types: Testing asynchronous GPs.
> > >
> > >
> > > The kernel config and materials to reproduce are available at:
> > > https://download.01.org/0day-ci/archive/20240806/202408061634.fe6be94-oliver.sang@xxxxxxxxx
> > >
> > >
> > >
> > > --
> > > 0-DAY CI Kernel Test Service
> > > https://github.com/intel/lkp-tests/wiki
> > >
> >
> >
> > --
> > Best Regards
> > Masahiro Yamada



--
Best Regards
Masahiro Yamada