[Bug report] kernel BUG at include/linux/scatterlist.h

Zorro Lang
2024-11-22T04:51:14Z

Hi,

I hit a kernel panic on aarch64 several times recently, when I tried to do a
fstests test. It's not related with fstests, due to I hit it when I boot the
latest mainline linux kernel (HEAD=fc39fb56917bb3cb53e99560ca3612a84456ada2).

The console log looks like related with crypto things, I'm not familar with
it, so just send this email to linux-crypto@ and cc linux-kernel@.

I hit this panic several times, I did nothing except building and installing
the latest kernel and then boot it, then it crash directly on booting time.
Looks like crash from:

183 static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
184 unsigned int buflen)
185 {
186 #ifdef CONFIG_DEBUG_SG
==> 187 BUG_ON(!virt_addr_valid(buf));
188 #endif
189 sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
190 }

If someone need, I can provide the big linux/.config file.

Thanks,
Zorro

[1]
...
[ 7.313015] registered taskstats version 1
[ 7.320132] Loading compiled-in X.509 certificates
[ 7.347635] Loaded X.509 cert 'Build time autogenerated kernel key: ed2b2ec16b583dda991830c146172ef4fd4cd1cf'
[ 7.522429] Demotion targets for Node 0: null
[ 7.523941] debug_vm_pgtable: [debug_vm_pgtable ]: Validating architecture page table helpers
[ 7.530102] page_owner is disabled
[ 7.532083] Key type .fscrypt registered
[ 7.533070] Key type fscrypt-provisioning registered
[ 7.535734] Key type big_key registered
[ 7.539305] Key type encrypted registered
[ 7.541143] ima: secureboot mode disabled
[ 7.542177] ima: No TPM chip found, activating TPM-bypass!
[ 7.543508] Loading compiled-in module X.509 certificates
[ 7.546783] Loaded X.509 cert 'Build time autogenerated kernel key: ed2b2ec16b583dda991830c146172ef4fd4cd1cf'
[ 7.549427] ima: Allocated hash algorithm: sha256
[ 7.550827] ima: No architecture policies found
[ 7.552706] evm: Initialising EVM extended attributes:
[ 7.554011] evm: security.selinux
[ 7.554842] evm: security.SMACK64 (disabled)
[ 7.555877] evm: security.SMACK64EXEC (disabled)
[ 7.557025] evm: security.SMACK64TRANSMUTE (disabled)
[ 7.558367] evm: security.SMACK64MMAP (disabled)
[ 7.559696] evm: security.apparmor (disabled)
[ 7.560726] evm: security.ima
[ 7.561451] evm: security.capability
[ 7.562297] evm: HMAC attrs: 0x1
[ 7.631769] Running certificate verification RSA selftest
[ 7.652546] ------------[ cut here ]------------
[ 7.653656] kernel BUG at include/linux/scatterlist.h:187!
[ 7.654975] Internal error: Oops - BUG: 00000000f2000800 [#1] SMP
[ 7.656386] Modules linked in:
[ 7.657104] CPU: 3 UID: 0 PID: 176 Comm: cryptomgr_test Not tainted 6.12.0+ #1
[ 7.658822] Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
[ 7.660575] pstate: 20400005 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 7.662385] pc : sg_init_one+0x124/0x150
[ 7.663401] lr : sg_init_one+0x34/0x150
[ 7.664380] sp : ffff800083e87950
[ 7.665240] x29: ffff800083e87950 x28: 0000000000000048 x27: ffff3fc6f3aabc00
[ 7.667078] x26: ffff3fc6f3aabc48 x25: ffff800083e87a60 x24: 1fffe7f8de689885
[ 7.668895] x23: ffffb3207fb10fe0 x22: 0000000000000100 x21: ffffb3207fb7d880
[ 7.670774] x20: ffff800083e87a20 x19: 0000b3207fb7d880 x18: 0000000000000000
[ 7.672568] x17: ffffb3207de83630 x16: ffffb3207de8306c x15: ffffb3207de78cb0
[ 7.674370] x14: ffffb3207d916474 x13: ffffb3207cf38c70 x12: ffff7000107d0f48
[ 7.676156] x11: 1ffff000107d0f47 x10: ffff7000107d0f47 x9 : dfff800000000000
[ 7.677939] x8 : ffff800083e87a40 x7 : 0000000000000000 x6 : 0000000000000004
[ 7.679738] x5 : ffff800083e87a20 x4 : 0000000000000000 x3 : 1ffff000107d0f44
[ 7.681515] x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000600000000000
[ 7.683305] Call trace:
[ 7.683926] sg_init_one+0x124/0x150 (P)
[ 7.684919] sg_init_one+0x34/0x150 (L)
[ 7.685890] rsassa_pkcs1_verify+0x288/0x980
[ 7.686976] test_sig_one+0x344/0x848
[ 7.687916] alg_test_sig+0xc0/0x168
[ 7.688859] alg_test+0x2e0/0xd58
[ 7.689715] cryptomgr_test+0x58/0x88
[ 7.690702] kthread+0x270/0x2f8
[ 7.691542] ret_from_fork+0x10/0x20
[ 7.692470] Code: a8c47bfd d50323bf d65f03c0 d4210000 (d4210000)
[ 7.694042] ---[ end trace 0000000000000000 ]---
[ 7.695246] Kernel panic - not syncing: Oops - BUG: Fatal exception
[ 7.696819] SMP: stopping secondary CPUs
[ 7.697868] Kernel Offset: 0x331ffcf20000 from 0xffff800080000000
[ 7.699457] PHYS_OFFSET: 0xffffc03ac0000000
[ 7.700505] CPU features: 0x00,40000045,00801240,82004203
[ 7.701867] Memory Limit: none
[ 7.702637] ---[ end Kernel panic - not syncing: Oops - BUG: Fatal exception ]---