Re: starfive crypto list_add corruption

From: Aurelien Jarno
Date: Thu Aug 31 2023 - 15:09:39 EST


Hi Conor,

On 2023-08-30 11:26, Conor Dooley wrote:
> Hi,
>
> There's been a report on the irc fedora-riscv irc of list_add corruption
> with the starfive crypto stuff:
> list_add corruption. next->prev should be prev (ffffffff02f65320), but was ffffffd8eef15848. (next=ffffffd8eef15840).
> ------------[ cut here ]------------
> kernel BUG at lib/list_debug.c:29!
> Kernel BUG [#1]

[snip]

> I feel like this isn't the first report I saw, but the other might've
> been for the equivalent driver in the vendor tree & I probably didn't
> pay any attention to.

I got this issue, if I remember correctly, I fixed it by enabling
CONFIG_ARM_AMBA and CONFIG_AMBA_PL08X. It improved things a bit, but now
the driver is still not functional and instead I get this kind of trace
appearing during the self test of the driver:

------------[ cut here ]------------
WARNING: CPU: 3 PID: 292 at crypto/api.c:176 crypto_wait_for_test+0x8e/0x92
Modules linked in: nvme_fabrics ad7418 binfmt_misc jh7110_tdm snd_soc_core snd_pcm_dmaengine ofpart spi_nor snd_pcm starfive_wdt mtd watchdog jh7110_crypto(+) snd_timer jh7110_trng crypto_engine rng_core snd soundcore sfctemp cpufreq_dt drm loop fuse drm_panel_orientation_quirks configfs ip_tables x_tables autofs4 ext4 crc32c_generic crc16 mbcache jbd2 rtc_ds1307 dm_mod dax nvme xhci_pci nvme_core t10_pi crc64_rocksoft crc64 crc_t10dif crct10dif_generic crct10dif_common xhci_hcd usbcore axp20x_regulator dwmac_starfive stmmac_platform usb_common dw_mmc_starfive dw_mmc_pltfm axp20x_i2c axp20x mfd_core regmap_i2c stmmac dw_mmc pcs_xpcs of_mdio fixed_phy phylink fwnode_mdio mmc_core libphy clk_starfive_jh7110_vout clk_starfive_jh7110_isp clk_starfive_jh7110_aon spi_cadence_quadspi i2c_designware_platform clk_starfive_jh7110_stg phy_jh7110_usb phy_jh7110_pcie i2c_designware_core
CPU: 3 PID: 292 Comm: (udev-worker) Not tainted 6.5.0-rc7+ #1
Hardware name: StarFive VisionFive 2 v1.2A (DT)
epc : crypto_wait_for_test+0x8e/0x92
ra : crypto_wait_for_test+0x44/0x92
epc : ffffffff803d421e ra : ffffffff803d41d4 sp : ffffffc80067b830
gp : ffffffff8198de98 tp : ffffffd8ce189b80 t0 : 0000000000000000
t1 : 00000000000000aa t2 : 000000000000031e s0 : ffffffc80067b850
s1 : ffffffd8d9df5e00 a0 : fffffffffffffe00 a1 : ffffffc80067b798
a2 : ffffffc80067b798 a3 : ffffffd8d9df5f98 a4 : 0000000000000000
a5 : fffffffffffffe00 a6 : ffffffd8c1285400 a7 : 00000000000000a9
s2 : ffffffff0343e340 s3 : 0000000000000000 s4 : ffffffff0343e280
s5 : 000000000000000a s6 : ffffffff80e5cef0 s7 : ffffffff819ceba8
s8 : 0000000000000000 s9 : ffffffc80067bd58 s10: ffffffff0343fb58
s11: ffffffc80067bca0 t3 : 000000000000ff00 t4 : 0000000000ff0000
t5 : 0000000000000040 t6 : 0000000000000006
status: 0000000200000120 badaddr: 0000000000000000 cause: 0000000000000003
[<ffffffff803d421e>] crypto_wait_for_test+0x8e/0x92
[<ffffffff803d62f8>] crypto_register_alg+0xa8/0xea
[<ffffffff803d941c>] crypto_register_ahashes+0x4c/0xd0
[<ffffffff033e48e0>] starfive_hash_register_algs+0x22/0x2a [jh7110_crypto]
[<ffffffff033e35dc>] starfive_cryp_probe+0x3ca/0x468 [jh7110_crypto]
[<ffffffff806525d6>] platform_probe+0x5e/0xba
[<ffffffff8064f5f4>] really_probe+0xa0/0x35a
[<ffffffff8064f928>] __driver_probe_device+0x7a/0x138
[<ffffffff8064fa1e>] driver_probe_device+0x38/0xc6
[<ffffffff8064fc60>] __driver_attach+0xd0/0x1b8
[<ffffffff8064d18e>] bus_for_each_dev+0x6c/0xba
[<ffffffff8064ee8a>] driver_attach+0x26/0x2e
[<ffffffff8064e688>] bus_add_driver+0x108/0x20a
[<ffffffff80650d52>] driver_register+0x52/0xf4
[<ffffffff806521c2>] __platform_driver_register+0x28/0x30
[<ffffffff033e9028>] starfive_cryp_driver_init+0x28/0x1000 [jh7110_crypto]
[<ffffffff800028be>] do_one_initcall+0x5c/0x22e
[<ffffffff800b3e36>] do_init_module+0x5e/0x21a
[<ffffffff800b5b06>] load_module+0x1842/0x1db4
[<ffffffff800b6272>] init_module_from_file+0x82/0xba
[<ffffffff800b645e>] sys_finit_module+0x194/0x326
[<ffffffff80939194>] do_trap_ecall_u+0xc6/0x134
[<ffffffff80003cec>] ret_from_exception+0x0/0x64
---[ end trace 0000000000000000 ]---

Regards
Aurelien

--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@xxxxxxxxxxx http://aurel32.net

Attachment: signature.asc
Description: PGP signature