public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* starfive crypto list_add corruption
@ 2023-08-30 10:26 Conor Dooley
  2023-08-31 19:08 ` Aurelien Jarno
  0 siblings, 1 reply; 6+ messages in thread
From: Conor Dooley @ 2023-08-30 10:26 UTC (permalink / raw)
  To: jiajie.ho, huan.feng
  Cc: herbert, linux-kernel, linux-crypto, conor.dooley, kernel,
	linux-riscv, davidlt

[-- Attachment #1: Type: text/plain, Size: 3171 bytes --]

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]
	Modules linked in: jh7110_crypto spidev pcs_xpcs clk_starfive_jh7110_aon pinctrl_starfive_jh7110_aon clk_starfive_jh7110_stg crypto_engine phylink dw_mmc_starfive dw_mmc_pltfm clk_starfive_jh7110_vout phy_jh7110_pcie spi_
	pl022 clk_starfive_jh7110_isp dw_mmc phy_jh7110_usb i2c_designware_platform pinctrl_starfive_jh7110_sys i2c_designware_core sunrpc ip6_tables ip_tables i2c_dev fuse                                                                        
	CPU: 2 PID: 53 Comm: kworker/u8:2 Not tainted 6.5.0-next-20230829 #13
	Hardware name: StarFive VisionFive 2 v1.3B (DT)
	Workqueue: events_unbound deferred_probe_work_func
	epc : __list_add_valid_or_report+0x82/0x96
	 ra : __list_add_valid_or_report+0x82/0x96
	epc : ffffffff80640808 ra : ffffffff80640808 sp : ffffffc8002dbb10
	 gp : ffffffff81f9ea48 tp : ffffffd8c0ac3a00 t0 : ffffffff80c8f5fc
	 t1 : 0720072007200720 t2 : 206464615f747369 s0 : ffffffc8002dbb20
	 s1 : ffffffd8ecf11040 a0 : 0000000000000075 a1 : ffffffd8fdd71a48
	 a2 : ffffffd8fdd7e728 a3 : 0000000000000000 a4 : 0000000000000000
	 a5 : 0000000000000000 a6 : ffffffff81fc3818 a7 : 0000000000000034
	 s2 : ffffffd8eef15840 s3 : ffffffff02f65320 s4 : ffffffd8c02a3c10
	 s5 : ffffffd8ecf11178 s6 : ffffffd8ecf11150 s7 : ffffffff02f65250
	 s8 : ffffffff823953d8 s9 : ffffffff8109ba08 s10: ffffffd8c0154000
	 s11: ffffffd8c0b1c540 t3 : ffffffd8c0161f00 t4 : ffffffd8c0161f00
	 t5 : ffffffd8c0161000 t6 : ffffffc8002db918
	status: 0000000200000120 badaddr: 0000000000000000 cause: 0000000000000003
	[<ffffffff80640808>] __list_add_valid_or_report+0x82/0x96
	[<ffffffff02df646c>] starfive_cryp_probe+0x1e0/0x4bc [jh7110_crypto]
	[<ffffffff80835062>] platform_probe+0x5e/0xba
	[<ffffffff8083205c>] really_probe+0xa0/0x35a
	[<ffffffff80832398>] __driver_probe_device+0x82/0x140
	[<ffffffff8083248e>] driver_probe_device+0x38/0xb6
	[<ffffffff8083258e>] __device_attach_driver+0x82/0xe4
	[<ffffffff8082fe90>] bus_for_each_drv+0x72/0xc8
	[<ffffffff8083299e>] __device_attach+0x94/0x18a
	[<ffffffff80832c92>] device_initial_probe+0x1a/0x22
	[<ffffffff80830e9a>] bus_probe_device+0x96/0x98
	[<ffffffff80831c6a>] deferred_probe_work_func+0xb2/0x102
	[<ffffffff800542be>] process_one_work+0x18a/0x32a
	[<ffffffff80054fe2>] worker_thread+0x2fc/0x44a
	[<ffffffff8005e3e0>] kthread+0xc4/0xe4
	[<ffffffff80003c12>] ret_from_fork+0xe/0x20
	Code: 9002 86be 1517 0157 0513 b685 1097 0065 80e7 92a0 (9002) 1517 
	---[ end trace 0000000000000000 ]---
	Kernel panic - not syncing: Fatal exception in interrupt
	SMP: stopping secondary CPUs
	---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---

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.

Thanks,
Conor.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: starfive crypto list_add corruption
  2023-08-30 10:26 starfive crypto list_add corruption Conor Dooley
@ 2023-08-31 19:08 ` Aurelien Jarno
  2023-09-01  2:39   ` JiaJie Ho
  0 siblings, 1 reply; 6+ messages in thread
From: Aurelien Jarno @ 2023-08-31 19:08 UTC (permalink / raw)
  To: Conor Dooley
  Cc: jiajie.ho, huan.feng, herbert, linux-kernel, linux-crypto, kernel,
	linux-riscv, davidlt

[-- Attachment #1: Type: text/plain, Size: 4260 bytes --]

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@aurel32.net                     http://aurel32.net

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: starfive crypto list_add corruption
  2023-08-31 19:08 ` Aurelien Jarno
@ 2023-09-01  2:39   ` JiaJie Ho
  2023-09-10 20:59     ` Chris Hofstaedtler
  0 siblings, 1 reply; 6+ messages in thread
From: JiaJie Ho @ 2023-09-01  2:39 UTC (permalink / raw)
  To: Aurelien Jarno, Conor Dooley
  Cc: herbert@gondor.apana.org.au, linux-kernel@vger.kernel.org,
	linux-crypto@vger.kernel.org, kernel@esmil.dk,
	linux-riscv@lists.infradead.org, davidlt@rivosinc.com

Hi Aurelian/Conor,

Thanks for bringing this up.

> 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,

Thanks for bringing this up.
I'll submit a patch to fix the Kconfig dependencies.

> 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
[...]

I'll investigate this error.

Thanks,
Jia Jie

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: starfive crypto list_add corruption
  2023-09-01  2:39   ` JiaJie Ho
@ 2023-09-10 20:59     ` Chris Hofstaedtler
  2023-09-10 21:38       ` Mirsad Todorovac
  2023-09-19  5:31       ` JiaJie Ho
  0 siblings, 2 replies; 6+ messages in thread
From: Chris Hofstaedtler @ 2023-09-10 20:59 UTC (permalink / raw)
  To: jiajie.ho
  Cc: aurelien, conor.dooley, davidlt, herbert, kernel, linux-crypto,
	linux-kernel, linux-riscv

> > 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,

I still see the list_add corruption trace with CONFIG_ARM_AMBA and
CONFIG_AMBA_PL08X set:

[    3.528140] ------------[ cut here ]------------
[    3.528535] dwmmc_starfive 16020000.mmc: IDMAC supports 32-bit address mode.
[    3.532795] list_add corruption. next->prev should be prev (ffffffff816ec4d0), but was ffffffff80e33f38. (next=ffffffd8c0133c40).
[    3.539866] dwmmc_starfive 16020000.mmc: Using internal DMA controller.
[    3.551539] WARNING: CPU: 2 PID: 10 at lib/list_debug.c:27 __list_add_valid+0x8a/0xac
[    3.551564] Modules linked in:
[    3.551574] CPU: 2 PID: 10 Comm: kworker/u8:0 Not tainted 6.5.0zeha3-00072-g385eddf4e78f #6
[    3.551586] Hardware name: StarFive VisionFive 2 v1.2A (DT)
[    3.551592] Workqueue: events_unbound deferred_probe_work_func
[    3.551607] epc : __list_add_valid+0x8a/0xac
[    3.551618]  ra : __list_add_valid+0x8a/0xac
[    3.551628] epc : ffffffff804d21be ra : ffffffff804d21be sp : ffffffc80006bb50
[    3.551636]  gp : ffffffff81723980 tp : ffffffd8c0156780 t0 : 2000000000000000
[    3.551644]  t1 : 000000000000006c t2 : 206464615f747369 s0 : ffffffc80006bb60
[    3.551652]  s1 : ffffffd8c200ae40 a0 : 0000000000000075 a1 : 0000000000000018
[    3.551659]  a2 : 0000000000000010 a3 : 0000000000000000 a4 : 0000000000000000
[    3.551665]  a5 : 0000000000000000 a6 : ffffffd8c0242640 a7 : 0000000000000038
[    3.551672]  s2 : ffffffd8c0133c40 s3 : ffffffff816ec400 s4 : ffffffd8c00f7410
[    3.551680]  s5 : ffffffd8c200af30 s6 : ffffffff816ec4d0 s7 : ffffffd8c004c038
[    3.551687]  s8 : 0000000000000402 s9 : ffffffff80024be4 s10: 0000000000001000
[    3.551694]  s11: ffffffd8c008fc00 t3 : ffffffff81736f17 t4 : ffffffff81736f17
[    3.551701]  t5 : ffffffff81736f18 t6 : ffffffff81736f17
[    3.551707] status: 0000000200000120 badaddr: 0000000000000000 cause: 0000000000000003
[    3.551715] [<ffffffff804d21be>] __list_add_valid+0x8a/0xac
[    3.551727] [<ffffffff808672a8>] starfive_cryp_probe+0x184/0x3fa
[    3.551745] [<ffffffff8061fcfa>] platform_probe+0x4e/0x92
[    3.551759] [<ffffffff8061d96a>] really_probe+0x82/0x210
[    3.551770] [<ffffffff8061db54>] __driver_probe_device+0x5c/0xd0
[    3.551782] [<ffffffff8061dbf4>] driver_probe_device+0x2c/0xb0
[    3.551793] [<ffffffff8061dce6>] __device_attach_driver+0x6e/0x8e
[    3.551805] [<ffffffff8061bc66>] bus_for_each_drv+0x5c/0xb0
[    3.551816] [<ffffffff8061dfa4>] __device_attach+0x82/0x144
[    3.551827] [<ffffffff8061e1dc>] device_initial_probe+0xe/0x16
[    3.551839] [<ffffffff8061cb76>] bus_probe_device+0x86/0x88
[    3.551849] [<ffffffff8061d73c>] deferred_probe_work_func+0x86/0xbe
[    3.551861] [<ffffffff80024a0c>] process_one_work+0x162/0x284
[    3.551876] [<ffffffff80024cd2>] worker_thread+0x1a4/0x348
[    3.551889] [<ffffffff8002bde6>] kthread+0xc2/0xd6
[    3.551900] [<ffffffff8000336a>] ret_from_fork+0xa/0x1c
[    3.551913] ---[ end trace 0000000000000000 ]---

> > name: StarFive VisionFive 2 v1.2A (DT) epc : crypto_wait_for_test+0x8e/0x92
[..]
> I'll investigate this error.

I also see this panic:

[    3.558296] jh7110-crypto 16000000.crypto: will run requests pump with realtime priority
[    3.565961] dwmmc_starfive 16020000.mmc: Version ID is 290a
[    3.566016] dwmmc_starfive 16020000.mmc: DW MMC controller at irq 70,32 bit host data width,32 deep fifo
[    3.574329] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    3.577585] mmc_host mmc1: card is polling.
[    3.606327] Unable to handle kernel paging request at virtual address ffffffff800fab24
[    3.820748] Oops [#1]
[    3.823027] Modules linked in:
[    3.826090] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G        W          6.5.0zeha3-00072-g385eddf4e78f #6
[    3.832229] mmc_host mmc1: Bus speed (slot 0) = 49500000Hz (slot req 400000Hz, actual 399193HZ div = 62)
[    3.835566] Hardware name: StarFive VisionFive 2 v1.2A (DT)
[    3.850595] epc : starfive_rsa_enc_core+0x30/0x116
[    3.855402]  ra : starfive_rsa_enc+0x5e/0xbc
[    3.859679] epc : ffffffff8086937a ra : ffffffff808694be sp : ffffffc800023910
[    3.866898]  gp : ffffffff81723980 tp : ffffffd8c0150000 t0 : ffffffd8c22380c8
[    3.874117]  t1 : 0000000000000000 t2 : 472f9351d07df710 s0 : ffffffc800023960
[    3.881335]  s1 : ffffffd8c013ea80 a0 : ffffffd8c013ea80 a1 : 0000000000000001
[    3.888553]  a2 : 0000010000000000 a3 : ffffffd8c0133c40 a4 : 0000000000000002
[    3.895770]  a5 : ffffffff800fab24 a6 : ffffffd8ff1d6d90 a7 : 0000000000000000
[    3.902988]  s2 : ffffffd8c013ea40 s3 : ffffffd8c2238180 s4 : 0000000000000001
[    3.910206]  s5 : ffffffd8c22380b0 s6 : ffffffd8c0133c40 s7 : 00000000000002a8
[    3.917425]  s8 : ffffffff8114c240 s9 : 000000001f030000 s10: 0000000000000001
[    3.924642]  s11: ffffffd8c0048300 t3 : 0a1255840a4b7df8 t4 : 28fc2f2b1f3b4e7d
[    3.931861]  t5 : e2bb8080e13469b3 t6 : ffffffd8c2238440
[    3.937170] status: 0000000200000120 badaddr: ffffffff800fab24 cause: 000000000000000f
[    3.945083] [<ffffffff8086937a>] starfive_rsa_enc_core+0x30/0x116
[    3.951183] [<ffffffff808694be>] starfive_rsa_enc+0x5e/0xbc
[    3.956762] [<ffffffff8045edc4>] pkcs1pad_verify+0xb2/0xea
[    3.962256] [<ffffffff8045e21a>] crypto_sig_verify+0xa2/0xd0
[    3.967919] [<ffffffff8047e8c0>] public_key_verify_signature+0x168/0x1d2
[    3.974625] [<ffffffff80480018>] x509_check_for_self_signed+0x58/0xa0
[    3.981071] [<ffffffff8047f486>] x509_cert_parse+0x148/0x19e
[    3.986735] [<ffffffff8047fd08>] x509_key_preparse+0x20/0x18c
[    3.992485] [<ffffffff8047d8b4>] asymmetric_key_preparse+0x52/0x86
[    3.998668] [<ffffffff8044fcb8>] __key_create_or_update+0x16c/0x372
[    4.004941] [<ffffffff8044fecc>] key_create_or_update+0xe/0x16
[    4.010780] [<ffffffff8047fc78>] x509_load_certificate_list+0x86/0xf6
[    4.017226] [<ffffffff80c3a59a>] regulatory_init_db+0x92/0x124
[    4.023068] [<ffffffff800020f0>] do_one_initcall+0x38/0x17c
[    4.028646] [<ffffffff80c00f1c>] kernel_init_freeable+0x1a2/0x204
[    4.034749] [<ffffffff80bb4b56>] kernel_init+0x1e/0x10a
[    4.039979] [<ffffffff8000336a>] ret_from_fork+0xa/0x1c
[    4.045218] Code: 0205 84aa 8a2e 000f 0140 3783 030b 4709 8793 4007 (c398) 2783 
[    4.052715] ---[ end trace 0000000000000000 ]---
[    4.057339] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    4.064990] SMP: stopping secondary CPUs
[    4.068927] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---

Maybe this can also be investigated.

Thanks,
Chris


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: starfive crypto list_add corruption
  2023-09-10 20:59     ` Chris Hofstaedtler
@ 2023-09-10 21:38       ` Mirsad Todorovac
  2023-09-19  5:31       ` JiaJie Ho
  1 sibling, 0 replies; 6+ messages in thread
From: Mirsad Todorovac @ 2023-09-10 21:38 UTC (permalink / raw)
  To: Chris Hofstaedtler, jiajie.ho
  Cc: aurelien, conor.dooley, davidlt, herbert, kernel, linux-crypto,
	linux-kernel, linux-riscv

On 9/10/23 22:59, Chris Hofstaedtler wrote:
>>> 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,
> 
> I still see the list_add corruption trace with CONFIG_ARM_AMBA and
> CONFIG_AMBA_PL08X set:
> 
> [    3.528140] ------------[ cut here ]------------
> [    3.528535] dwmmc_starfive 16020000.mmc: IDMAC supports 32-bit address mode.
> [    3.532795] list_add corruption. next->prev should be prev (ffffffff816ec4d0), but was ffffffff80e33f38. (next=ffffffd8c0133c40).
> [    3.539866] dwmmc_starfive 16020000.mmc: Using internal DMA controller.
> [    3.551539] WARNING: CPU: 2 PID: 10 at lib/list_debug.c:27 __list_add_valid+0x8a/0xac
> [    3.551564] Modules linked in:
> [    3.551574] CPU: 2 PID: 10 Comm: kworker/u8:0 Not tainted 6.5.0zeha3-00072-g385eddf4e78f #6
> [    3.551586] Hardware name: StarFive VisionFive 2 v1.2A (DT)
> [    3.551592] Workqueue: events_unbound deferred_probe_work_func
> [    3.551607] epc : __list_add_valid+0x8a/0xac
> [    3.551618]  ra : __list_add_valid+0x8a/0xac
> [    3.551628] epc : ffffffff804d21be ra : ffffffff804d21be sp : ffffffc80006bb50
> [    3.551636]  gp : ffffffff81723980 tp : ffffffd8c0156780 t0 : 2000000000000000
> [    3.551644]  t1 : 000000000000006c t2 : 206464615f747369 s0 : ffffffc80006bb60
> [    3.551652]  s1 : ffffffd8c200ae40 a0 : 0000000000000075 a1 : 0000000000000018
> [    3.551659]  a2 : 0000000000000010 a3 : 0000000000000000 a4 : 0000000000000000
> [    3.551665]  a5 : 0000000000000000 a6 : ffffffd8c0242640 a7 : 0000000000000038
> [    3.551672]  s2 : ffffffd8c0133c40 s3 : ffffffff816ec400 s4 : ffffffd8c00f7410
> [    3.551680]  s5 : ffffffd8c200af30 s6 : ffffffff816ec4d0 s7 : ffffffd8c004c038
> [    3.551687]  s8 : 0000000000000402 s9 : ffffffff80024be4 s10: 0000000000001000
> [    3.551694]  s11: ffffffd8c008fc00 t3 : ffffffff81736f17 t4 : ffffffff81736f17
> [    3.551701]  t5 : ffffffff81736f18 t6 : ffffffff81736f17
> [    3.551707] status: 0000000200000120 badaddr: 0000000000000000 cause: 0000000000000003
> [    3.551715] [<ffffffff804d21be>] __list_add_valid+0x8a/0xac
> [    3.551727] [<ffffffff808672a8>] starfive_cryp_probe+0x184/0x3fa
> [    3.551745] [<ffffffff8061fcfa>] platform_probe+0x4e/0x92
> [    3.551759] [<ffffffff8061d96a>] really_probe+0x82/0x210
> [    3.551770] [<ffffffff8061db54>] __driver_probe_device+0x5c/0xd0
> [    3.551782] [<ffffffff8061dbf4>] driver_probe_device+0x2c/0xb0
> [    3.551793] [<ffffffff8061dce6>] __device_attach_driver+0x6e/0x8e
> [    3.551805] [<ffffffff8061bc66>] bus_for_each_drv+0x5c/0xb0
> [    3.551816] [<ffffffff8061dfa4>] __device_attach+0x82/0x144
> [    3.551827] [<ffffffff8061e1dc>] device_initial_probe+0xe/0x16
> [    3.551839] [<ffffffff8061cb76>] bus_probe_device+0x86/0x88
> [    3.551849] [<ffffffff8061d73c>] deferred_probe_work_func+0x86/0xbe
> [    3.551861] [<ffffffff80024a0c>] process_one_work+0x162/0x284
> [    3.551876] [<ffffffff80024cd2>] worker_thread+0x1a4/0x348
> [    3.551889] [<ffffffff8002bde6>] kthread+0xc2/0xd6
> [    3.551900] [<ffffffff8000336a>] ret_from_fork+0xa/0x1c
> [    3.551913] ---[ end trace 0000000000000000 ]---
> 
>>> name: StarFive VisionFive 2 v1.2A (DT) epc : crypto_wait_for_test+0x8e/0x92
> [..]
>> I'll investigate this error.
> 
> I also see this panic:
> 
> [    3.558296] jh7110-crypto 16000000.crypto: will run requests pump with realtime priority
> [    3.565961] dwmmc_starfive 16020000.mmc: Version ID is 290a
> [    3.566016] dwmmc_starfive 16020000.mmc: DW MMC controller at irq 70,32 bit host data width,32 deep fifo
> [    3.574329] cfg80211: Loading compiled-in X.509 certificates for regulatory database
> [    3.577585] mmc_host mmc1: card is polling.
> [    3.606327] Unable to handle kernel paging request at virtual address ffffffff800fab24
> [    3.820748] Oops [#1]
> [    3.823027] Modules linked in:
> [    3.826090] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G        W          6.5.0zeha3-00072-g385eddf4e78f #6
> [    3.832229] mmc_host mmc1: Bus speed (slot 0) = 49500000Hz (slot req 400000Hz, actual 399193HZ div = 62)
> [    3.835566] Hardware name: StarFive VisionFive 2 v1.2A (DT)
> [    3.850595] epc : starfive_rsa_enc_core+0x30/0x116
> [    3.855402]  ra : starfive_rsa_enc+0x5e/0xbc
> [    3.859679] epc : ffffffff8086937a ra : ffffffff808694be sp : ffffffc800023910
> [    3.866898]  gp : ffffffff81723980 tp : ffffffd8c0150000 t0 : ffffffd8c22380c8
> [    3.874117]  t1 : 0000000000000000 t2 : 472f9351d07df710 s0 : ffffffc800023960
> [    3.881335]  s1 : ffffffd8c013ea80 a0 : ffffffd8c013ea80 a1 : 0000000000000001
> [    3.888553]  a2 : 0000010000000000 a3 : ffffffd8c0133c40 a4 : 0000000000000002
> [    3.895770]  a5 : ffffffff800fab24 a6 : ffffffd8ff1d6d90 a7 : 0000000000000000
> [    3.902988]  s2 : ffffffd8c013ea40 s3 : ffffffd8c2238180 s4 : 0000000000000001
> [    3.910206]  s5 : ffffffd8c22380b0 s6 : ffffffd8c0133c40 s7 : 00000000000002a8
> [    3.917425]  s8 : ffffffff8114c240 s9 : 000000001f030000 s10: 0000000000000001
> [    3.924642]  s11: ffffffd8c0048300 t3 : 0a1255840a4b7df8 t4 : 28fc2f2b1f3b4e7d
> [    3.931861]  t5 : e2bb8080e13469b3 t6 : ffffffd8c2238440
> [    3.937170] status: 0000000200000120 badaddr: ffffffff800fab24 cause: 000000000000000f
> [    3.945083] [<ffffffff8086937a>] starfive_rsa_enc_core+0x30/0x116
> [    3.951183] [<ffffffff808694be>] starfive_rsa_enc+0x5e/0xbc
> [    3.956762] [<ffffffff8045edc4>] pkcs1pad_verify+0xb2/0xea
> [    3.962256] [<ffffffff8045e21a>] crypto_sig_verify+0xa2/0xd0
> [    3.967919] [<ffffffff8047e8c0>] public_key_verify_signature+0x168/0x1d2
> [    3.974625] [<ffffffff80480018>] x509_check_for_self_signed+0x58/0xa0
> [    3.981071] [<ffffffff8047f486>] x509_cert_parse+0x148/0x19e
> [    3.986735] [<ffffffff8047fd08>] x509_key_preparse+0x20/0x18c
> [    3.992485] [<ffffffff8047d8b4>] asymmetric_key_preparse+0x52/0x86
> [    3.998668] [<ffffffff8044fcb8>] __key_create_or_update+0x16c/0x372
> [    4.004941] [<ffffffff8044fecc>] key_create_or_update+0xe/0x16
> [    4.010780] [<ffffffff8047fc78>] x509_load_certificate_list+0x86/0xf6
> [    4.017226] [<ffffffff80c3a59a>] regulatory_init_db+0x92/0x124
> [    4.023068] [<ffffffff800020f0>] do_one_initcall+0x38/0x17c
> [    4.028646] [<ffffffff80c00f1c>] kernel_init_freeable+0x1a2/0x204
> [    4.034749] [<ffffffff80bb4b56>] kernel_init+0x1e/0x10a
> [    4.039979] [<ffffffff8000336a>] ret_from_fork+0xa/0x1c
> [    4.045218] Code: 0205 84aa 8a2e 000f 0140 3783 030b 4709 8793 4007 (c398) 2783
> [    4.052715] ---[ end trace 0000000000000000 ]---
> [    4.057339] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
> [    4.064990] SMP: stopping secondary CPUs
> [    4.068927] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b ]---
> 
> Maybe this can also be investigated.
> 
> Thanks,
> Chris

Hi, Chris,

Just a hint: running the kernel log output through decode_stacktrace.sh might make it more
useful for the developers ...

Best regards,
Mirsad Todorovac

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: starfive crypto list_add corruption
  2023-09-10 20:59     ` Chris Hofstaedtler
  2023-09-10 21:38       ` Mirsad Todorovac
@ 2023-09-19  5:31       ` JiaJie Ho
  1 sibling, 0 replies; 6+ messages in thread
From: JiaJie Ho @ 2023-09-19  5:31 UTC (permalink / raw)
  To: Chris Hofstaedtler
  Cc: aurelien@aurel32.net, conor.dooley@microchip.com,
	davidlt@rivosinc.com, herbert@gondor.apana.org.au,
	kernel@esmil.dk, linux-crypto@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org

> > > 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,
> 
> I still see the list_add corruption trace with CONFIG_ARM_AMBA and
> CONFIG_AMBA_PL08X set:
> 

[...]
 
> I also see this panic:
> 
> [    3.558296] jh7110-crypto 16000000.crypto: will run requests pump with
> realtime priority
> [    3.565961] dwmmc_starfive 16020000.mmc: Version ID is 290a
> [    3.566016] dwmmc_starfive 16020000.mmc: DW MMC controller at irq
> 70,32 bit host data width,32 deep fifo
> [    3.574329] cfg80211: Loading compiled-in X.509 certificates for regulatory
> database
> [    3.577585] mmc_host mmc1: card is polling.
> [    3.606327] Unable to handle kernel paging request at virtual address
> ffffffff800fab24
> [    3.820748] Oops [#1]
> [    3.823027] Modules linked in:
> [    3.826090] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G        W
> 6.5.0zeha3-00072-g385eddf4e78f #6
> [    3.832229] mmc_host mmc1: Bus speed (slot 0) = 49500000Hz (slot req
> 400000Hz, actual 399193HZ div = 62)
> [    3.835566] Hardware name: StarFive VisionFive 2 v1.2A (DT)
> [    3.850595] epc : starfive_rsa_enc_core+0x30/0x116
> [    3.855402]  ra : starfive_rsa_enc+0x5e/0xbc
> [    3.859679] epc : ffffffff8086937a ra : ffffffff808694be sp : ffffffc800023910
> [    3.866898]  gp : ffffffff81723980 tp : ffffffd8c0150000 t0 :
> ffffffd8c22380c8
> [    3.874117]  t1 : 0000000000000000 t2 : 472f9351d07df710 s0 :
> ffffffc800023960
> [    3.881335]  s1 : ffffffd8c013ea80 a0 : ffffffd8c013ea80 a1 :
> 0000000000000001
> [    3.888553]  a2 : 0000010000000000 a3 : ffffffd8c0133c40 a4 :
> 0000000000000002
> [    3.895770]  a5 : ffffffff800fab24 a6 : ffffffd8ff1d6d90 a7 :
> 0000000000000000
> [    3.902988]  s2 : ffffffd8c013ea40 s3 : ffffffd8c2238180 s4 :
> 0000000000000001
> [    3.910206]  s5 : ffffffd8c22380b0 s6 : ffffffd8c0133c40 s7 :
> 00000000000002a8
> [    3.917425]  s8 : ffffffff8114c240 s9 : 000000001f030000 s10:
> 0000000000000001
> [    3.924642]  s11: ffffffd8c0048300 t3 : 0a1255840a4b7df8 t4 :
> 28fc2f2b1f3b4e7d
> [    3.931861]  t5 : e2bb8080e13469b3 t6 : ffffffd8c2238440
> [    3.937170] status: 0000000200000120 badaddr: ffffffff800fab24 cause:
> 000000000000000f
> [    3.945083] [<ffffffff8086937a>] starfive_rsa_enc_core+0x30/0x116
> [    3.951183] [<ffffffff808694be>] starfive_rsa_enc+0x5e/0xbc
> [    3.956762] [<ffffffff8045edc4>] pkcs1pad_verify+0xb2/0xea
> [    3.962256] [<ffffffff8045e21a>] crypto_sig_verify+0xa2/0xd0
> [    3.967919] [<ffffffff8047e8c0>] public_key_verify_signature+0x168/0x1d2
> [    3.974625] [<ffffffff80480018>] x509_check_for_self_signed+0x58/0xa0
> [    3.981071] [<ffffffff8047f486>] x509_cert_parse+0x148/0x19e
> [    3.986735] [<ffffffff8047fd08>] x509_key_preparse+0x20/0x18c
> [    3.992485] [<ffffffff8047d8b4>] asymmetric_key_preparse+0x52/0x86
> [    3.998668] [<ffffffff8044fcb8>] __key_create_or_update+0x16c/0x372
> [    4.004941] [<ffffffff8044fecc>] key_create_or_update+0xe/0x16
> [    4.010780] [<ffffffff8047fc78>] x509_load_certificate_list+0x86/0xf6
> [    4.017226] [<ffffffff80c3a59a>] regulatory_init_db+0x92/0x124
> [    4.023068] [<ffffffff800020f0>] do_one_initcall+0x38/0x17c
> [    4.028646] [<ffffffff80c00f1c>] kernel_init_freeable+0x1a2/0x204
> [    4.034749] [<ffffffff80bb4b56>] kernel_init+0x1e/0x10a
> [    4.039979] [<ffffffff8000336a>] ret_from_fork+0xa/0x1c
> [    4.045218] Code: 0205 84aa 8a2e 000f 0140 3783 030b 4709 8793 4007
> (c398) 2783
> [    4.052715] ---[ end trace 0000000000000000 ]---
> [    4.057339] Kernel panic - not syncing: Attempted to kill init!
> exitcode=0x0000000b
> [    4.064990] SMP: stopping secondary CPUs
> [    4.068927] ---[ end Kernel panic - not syncing: Attempted to kill init!
> exitcode=0x0000000b ]---
> 
> Maybe this can also be investigated.

Is there a guide/wiki to compile a fedora-riscv image for VF2 board?
I'll will try reproducing and fix these issues on my side.

Thanks
Jia Jie

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-09-19  5:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-30 10:26 starfive crypto list_add corruption Conor Dooley
2023-08-31 19:08 ` Aurelien Jarno
2023-09-01  2:39   ` JiaJie Ho
2023-09-10 20:59     ` Chris Hofstaedtler
2023-09-10 21:38       ` Mirsad Todorovac
2023-09-19  5:31       ` JiaJie Ho

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox