Skip to content

Conversation

@opsiff
Copy link
Member

@opsiff opsiff commented Aug 7, 2025

Log:
[09:22:50:784] [ 4.205148] Kernel panic - not syncing: CRED: put_cred_rcu() sees (ptrval) with usage -5␍␊
[09:22:50:793] [ 4.214015] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 6.6.101-loong64-desktop-hwe #25.01.00.31 ␍␊
[09:22:50:800] [ 4.222879] Hardware name: Loongson Loongson-3A6000-HV-7A2000-1w-V0.1-EVB/Loongson-3A6000-HV-7A2000-1w-EVB-V1.21, BIOS Loongson-UDK2018-V4.0.05756-prestab␍␊
[09:22:50:820] [ 4.236884] Stack : 90000000044c1c48 9000000002755220 900000000023ff8c 9000000100474000␍␊
[09:22:50:823] [ 4.244977] 9000000100263c40 0000000000000000 9000000100263c48 9000000002755220␍␊
[09:22:50:831] [ 4.253067] 9000000008a319e0 9000000008a319d8 9000000100263b90 0000000000000001␍␊
[09:22:50:839] [ 4.261155] 0000000000000001 a8fd0f104f1068ea 0000000008f40000 9000000100595a80␍␊
[09:22:50:847] [ 4.269244] 0000000000000001 fffffffffffffffe 9000000100cba6f0 ffffffffffffffff␍␊
[09:22:50:856] [ 4.277332] 0000000000000002 0000000000000003 0000000008f40000 90000000031a1000␍␊
[09:22:50:863] [ 4.285421] 90000000031a1000 9000000002755220 0000000000000000 0000000000000000␍␊
[09:22:50:873] [ 4.293508] 9000000002717a58 0000000000000000 0000000000000001 900000000a82c0f8␍␊
[09:22:50:880] [ 4.301595] 9000000003490b48 9000000002755220 900000000024448c 00007ffff21aa2b3␍␊
[09:22:50:889] [ 4.309684] 00000000000002b0 000000000000000c 0000000000000000 0000000000071c1d␍␊
[09:22:50:897] [ 4.317773] ...␍␊
[09:22:50:906] [ 4.320327] Call Trace:␍␊
[09:22:50:906] [ 4.320329] [<900000000024448c>] show_stack+0x3c/0x150␍␊
[09:22:50:906] [ 4.328115] [<900000000023ff88>] dump_stack_lvl+0x5c/0x88␍␊
[09:22:50:914] [ 4.333607] [<9000000000220c8c>] panic+0x13c/0x358␍␊
[09:22:50:923] [ 4.338489] [<900000000029ff3c>] put_cred_rcu+0x134/0x138␍␊
[09:22:50:923] [ 4.343976] [<9000000000331ff8>] rcu_do_batch+0x190/0x600␍␊
[09:22:50:930] [ 4.347152] ata3: SATA link down (SStatus 0 SControl 300)␍␊
[09:22:50:939] [ 4.354941] [<9000000000337ae8>] rcu_core+0x178/0x3c0␍␊
[09:22:50:939] [ 4.360077] [<9000000000271ecc>] handle_softirqs+0x12c/0x3b0␍␊
[09:22:50:946] [ 4.365815] [<90000000002722c8>] __irq_exit_rcu+0x120/0x158␍␊
[09:22:50:955] [ 4.371465] [<9000000001787494>] do_vint+0x7c/0xd0␍␊
[09:22:50:955] [ 4.376338] [<90000000002420cc>] __arch_cpu_idle+0xc/0x10␍␊
[09:22:50:962] [ 4.381814] [<9000000001789c38>] arch_cpu_idle+0x8/0x30␍␊
[09:22:50:969] [ 4.387117] [<9000000001789de0>] default_idle_call+0x20/0x130␍␊
[09:22:50:979] [ 4.392938] [<90000000002da2f4>] do_idle+0xb4/0x130␍␊
[09:22:50:979] [ 4.397892] [<90000000002da5c0>] cpu_startup_entry+0x38/0x40␍␊
[09:22:50:988] [ 4.403624] [<9000000000252970>] start_secondary+0xa8/0xb8␍␊
[09:22:50:988] [ 4.409184] [<900000000178a15c>] smpboot_entry+0x64/0x6c␍␊
[09:22:50:995] [ 4.414571] ␍␊
[09:22:50:995] [ 4.416157] ------------[ cut here ]------------␍␊
[09:22:51:003] [ 4.420850] WARNING: CPU: 2 PID: 0 at kernel/smp.c:786 smp_call_function_many_cond+0x670/0x6e8␍␊
[09:22:51:013] [ 4.429526] Modules linked in:␍␊
[09:22:51:013] [ 4.432666] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 6.6.101-loong64-desktop-hwe #25.01.00.31 ␍␊
[09:22:51:020] [ 4.441511] Hardware name: Loongson Loongson-3A6000-HV-7A2000-1w-V0.1-EVB/Loongson-3A6000-HV-7A2000-1w-EVB-V1.21, BIOS Loongson-UDK2018-V4.0.05756-prestab␍␊
[09:22:51:033] [ 4.455479] pc 9000000000373620 ra 90000000003736e0 tp 9000000100474000 sp 9000000100263ce0␍␊
[09:22:51:041] [ 4.463892] a0 90000000033a49b0 a1 90000000002523d8 a2 0000000000000000 a3 0000000000000000␍␊
[09:22:51:051] [ 4.472306] a4 0000000000000000 a5 90000001002639c0 a6 0000000000000001 a7 0000000000000001␍␊
[09:22:51:060] [ 4.480719] t0 90000000033a49b0 t1 0000000000000100 t2 0000000000000001 t3 0000000000000103␍␊
[09:22:51:068] [ 4.489132] t4 00000000000000ff t5 9000000100cba6e0 t6 ffffffffffffffff t7 0000000000000002␍␊
[09:22:51:077] [ 4.497545] t8 0000000000000003 u0 9000000002755220 s9 90000000031a1000 s0 90000000044c17e8␍␊
[09:22:51:087] [ 4.505958] s1 0000000000000000 s2 90000000002523d8 s3 90000000033a49b0 s4 9000000002717a58␍␊
[09:22:51:095] [ 4.514372] s5 90000000033a5000 s6 0000000000000002 s7 0000000000000002 s8 0000000000000000␍␊
[09:22:51:104] [ 4.522788] ra: 90000000003736e0 smp_call_function+0x38/0x88␍␊
[09:22:51:112] [ 4.528784] ERA: 9000000000373620 smp_call_function_many_cond+0x670/0x6e8␍␊
[09:22:51:122] [ 4.535818] CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE)␍␊
[09:22:51:122] [ 4.542078] PRMD: 00000008 (PPLV0 -PIE +PWE)␍␊
[09:22:51:130] [ 4.546520] EUEN: 00000000 (-FPE -SXE -ASXE -BTE)␍␊
[09:22:51:130] [ 4.551395] ECFG: 00071c1d (LIE=0,2-4,10-12 VS=7)␍␊
[09:22:51:139] [ 4.556269] ESTAT: 000c1800 [BRK] (IS=11-12 ECode=12 EsubCode=0)␍␊
[09:22:51:147] [ 4.562355] PRID: 0014d000 (Loongson-64bit, Loongson-3A6000-HV)␍␊
[09:22:51:147] [ 4.568439] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 6.6.101-loong64-desktop-hwe #25.01.00.31 ␍␊
[09:22:51:156] [ 4.577293] Hardware name: Loongson Loongson-3A6000-HV-7A2000-1w-V0.1-EVB/Loongson-3A6000-HV-7A2000-1w-EVB-V1.21, BIOS Loongson-UDK2018-V4.0.05756-prestab␍␊
[09:22:51:169] [ 4.591283] Stack : 90000000044c1c48 9000000002755220 900000000023ff8c 9000000100474000␍␊
[09:22:51:184] [ 4.599368] 9000000100263950 0000000000000000 9000000100263958 9000000002755220␍␊
[09:22:51:193] [ 4.607453] 9000000008a319e0 9000000008a319d8 90000001002638a0 0000000000000001␍␊
[09:22:51:193] [ 4.615538] 0000000000000001 a8fd0f104f1068ea 0000000008f40000 9000000100595a80␍␊
[09:22:51:210] [ 4.623625] 0000000000000001 fffffffffffffffe 9000000100cba650 ffffffffffffffff␍␊
[09:22:51:210] [ 4.631712] 0000000000000002 0000000000000003 0000000008f40000 90000000031a1000␍␊
[09:22:51:219] [ 4.639801] 90000000031a1000 9000000002755220 0000000000000000 0000000000000009␍␊
[09:22:51:230] [ 4.647889] 9000000000373620 0000000000000312 0000000000000002 0000000000000002␍␊
[09:22:51:239] [ 4.651201] ata4: SATA link down (SStatus 0 SControl 300)␍␊
[09:22:51:239] [ 4.661469] 0000000000000000 9000000002755220 900000000024448c 00007ffff21aa2b3␍␊
[09:22:51:256] [ 4.669562] 00000000000002b0 0000000000000008 0000000000000000 0000000000071c1d␍␊
[09:22:51:256] [ 4.677654] ...␍␊
[09:22:51:263] [ 4.680213] Call Trace:␍␊
[09:22:51:263] [ 4.680214] [<900000000024448c>] show_stack+0x3c/0x150␍␊
[09:22:51:272] [ 4.688001] [<900000000023ff88>] dump_stack_lvl+0x5c/0x88␍␊
[09:22:51:272] [ 4.693492] [<9000000000268220>] __warn+0x88/0x188␍␊
[09:22:51:280] [ 4.698376] [<9000000001752a3c>] report_bug+0x1d4/0x2e0␍␊
[09:22:51:289] [ 4.703690] [<9000000001788220>] do_bp+0x1c8/0x408␍␊
[09:22:51:289] [ 4.708570] ␍␊
[09:22:51:289] [ 4.710159] ---[ end trace 0000000000000000 ]---␍␊
[09:22:51:296] [ 4.714867] Rebooting in 30 seconds..␍␊

Fixes: a7369f4 ("HAOC: CREDP: protect commit_creds() from ROP attack.")

Summary by Sourcery

Bug Fixes:

  • Initialize p->cred and p->real_cred in copy_creds when CONFIG_CREDP is disabled to prevent boot-time kernel panic.

Log:
[09:22:50:784] [    4.205148] Kernel panic - not syncing: CRED: put_cred_rcu() sees (____ptrval____) with usage -5␍␊
[09:22:50:793] [    4.214015] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 6.6.101-loong64-desktop-hwe deepin-community#25.01.00.31  ␍␊
[09:22:50:800] [    4.222879] Hardware name: Loongson Loongson-3A6000-HV-7A2000-1w-V0.1-EVB/Loongson-3A6000-HV-7A2000-1w-EVB-V1.21, BIOS Loongson-UDK2018-V4.0.05756-prestab␍␊
[09:22:50:820] [    4.236884] Stack : 90000000044c1c48 9000000002755220 900000000023ff8c 9000000100474000␍␊
[09:22:50:823] [    4.244977]         9000000100263c40 0000000000000000 9000000100263c48 9000000002755220␍␊
[09:22:50:831] [    4.253067]         9000000008a319e0 9000000008a319d8 9000000100263b90 0000000000000001␍␊
[09:22:50:839] [    4.261155]         0000000000000001 a8fd0f104f1068ea 0000000008f40000 9000000100595a80␍␊
[09:22:50:847] [    4.269244]         0000000000000001 fffffffffffffffe 9000000100cba6f0 ffffffffffffffff␍␊
[09:22:50:856] [    4.277332]         0000000000000002 0000000000000003 0000000008f40000 90000000031a1000␍␊
[09:22:50:863] [    4.285421]         90000000031a1000 9000000002755220 0000000000000000 0000000000000000␍␊
[09:22:50:873] [    4.293508]         9000000002717a58 0000000000000000 0000000000000001 900000000a82c0f8␍␊
[09:22:50:880] [    4.301595]         9000000003490b48 9000000002755220 900000000024448c 00007ffff21aa2b3␍␊
[09:22:50:889] [    4.309684]         00000000000002b0 000000000000000c 0000000000000000 0000000000071c1d␍␊
[09:22:50:897] [    4.317773]         ...␍␊
[09:22:50:906] [    4.320327] Call Trace:␍␊
[09:22:50:906] [    4.320329] [<900000000024448c>] show_stack+0x3c/0x150␍␊
[09:22:50:906] [    4.328115] [<900000000023ff88>] dump_stack_lvl+0x5c/0x88␍␊
[09:22:50:914] [    4.333607] [<9000000000220c8c>] panic+0x13c/0x358␍␊
[09:22:50:923] [    4.338489] [<900000000029ff3c>] put_cred_rcu+0x134/0x138␍␊
[09:22:50:923] [    4.343976] [<9000000000331ff8>] rcu_do_batch+0x190/0x600␍␊
[09:22:50:930] [    4.347152] ata3: SATA link down (SStatus 0 SControl 300)␍␊
[09:22:50:939] [    4.354941] [<9000000000337ae8>] rcu_core+0x178/0x3c0␍␊
[09:22:50:939] [    4.360077] [<9000000000271ecc>] handle_softirqs+0x12c/0x3b0␍␊
[09:22:50:946] [    4.365815] [<90000000002722c8>] __irq_exit_rcu+0x120/0x158␍␊
[09:22:50:955] [    4.371465] [<9000000001787494>] do_vint+0x7c/0xd0␍␊
[09:22:50:955] [    4.376338] [<90000000002420cc>] __arch_cpu_idle+0xc/0x10␍␊
[09:22:50:962] [    4.381814] [<9000000001789c38>] arch_cpu_idle+0x8/0x30␍␊
[09:22:50:969] [    4.387117] [<9000000001789de0>] default_idle_call+0x20/0x130␍␊
[09:22:50:979] [    4.392938] [<90000000002da2f4>] do_idle+0xb4/0x130␍␊
[09:22:50:979] [    4.397892] [<90000000002da5c0>] cpu_startup_entry+0x38/0x40␍␊
[09:22:50:988] [    4.403624] [<9000000000252970>] start_secondary+0xa8/0xb8␍␊
[09:22:50:988] [    4.409184] [<900000000178a15c>] smpboot_entry+0x64/0x6c␍␊
[09:22:50:995] [    4.414571] ␍␊
[09:22:50:995] [    4.416157] ------------[ cut here ]------------␍␊
[09:22:51:003] [    4.420850] WARNING: CPU: 2 PID: 0 at kernel/smp.c:786 smp_call_function_many_cond+0x670/0x6e8␍␊
[09:22:51:013] [    4.429526] Modules linked in:␍␊
[09:22:51:013] [    4.432666] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 6.6.101-loong64-desktop-hwe deepin-community#25.01.00.31  ␍␊
[09:22:51:020] [    4.441511] Hardware name: Loongson Loongson-3A6000-HV-7A2000-1w-V0.1-EVB/Loongson-3A6000-HV-7A2000-1w-EVB-V1.21, BIOS Loongson-UDK2018-V4.0.05756-prestab␍␊
[09:22:51:033] [    4.455479] pc 9000000000373620 ra 90000000003736e0 tp 9000000100474000 sp 9000000100263ce0␍␊
[09:22:51:041] [    4.463892] a0 90000000033a49b0 a1 90000000002523d8 a2 0000000000000000 a3 0000000000000000␍␊
[09:22:51:051] [    4.472306] a4 0000000000000000 a5 90000001002639c0 a6 0000000000000001 a7 0000000000000001␍␊
[09:22:51:060] [    4.480719] t0 90000000033a49b0 t1 0000000000000100 t2 0000000000000001 t3 0000000000000103␍␊
[09:22:51:068] [    4.489132] t4 00000000000000ff t5 9000000100cba6e0 t6 ffffffffffffffff t7 0000000000000002␍␊
[09:22:51:077] [    4.497545] t8 0000000000000003 u0 9000000002755220 s9 90000000031a1000 s0 90000000044c17e8␍␊
[09:22:51:087] [    4.505958] s1 0000000000000000 s2 90000000002523d8 s3 90000000033a49b0 s4 9000000002717a58␍␊
[09:22:51:095] [    4.514372] s5 90000000033a5000 s6 0000000000000002 s7 0000000000000002 s8 0000000000000000␍␊
[09:22:51:104] [    4.522788]    ra: 90000000003736e0 smp_call_function+0x38/0x88␍␊
[09:22:51:112] [    4.528784]   ERA: 9000000000373620 smp_call_function_many_cond+0x670/0x6e8␍␊
[09:22:51:122] [    4.535818]  CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE)␍␊
[09:22:51:122] [    4.542078]  PRMD: 00000008 (PPLV0 -PIE +PWE)␍␊
[09:22:51:130] [    4.546520]  EUEN: 00000000 (-FPE -SXE -ASXE -BTE)␍␊
[09:22:51:130] [    4.551395]  ECFG: 00071c1d (LIE=0,2-4,10-12 VS=7)␍␊
[09:22:51:139] [    4.556269] ESTAT: 000c1800 [BRK] (IS=11-12 ECode=12 EsubCode=0)␍␊
[09:22:51:147] [    4.562355]  PRID: 0014d000 (Loongson-64bit, Loongson-3A6000-HV)␍␊
[09:22:51:147] [    4.568439] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 6.6.101-loong64-desktop-hwe deepin-community#25.01.00.31  ␍␊
[09:22:51:156] [    4.577293] Hardware name: Loongson Loongson-3A6000-HV-7A2000-1w-V0.1-EVB/Loongson-3A6000-HV-7A2000-1w-EVB-V1.21, BIOS Loongson-UDK2018-V4.0.05756-prestab␍␊
[09:22:51:169] [    4.591283] Stack : 90000000044c1c48 9000000002755220 900000000023ff8c 9000000100474000␍␊
[09:22:51:184] [    4.599368]         9000000100263950 0000000000000000 9000000100263958 9000000002755220␍␊
[09:22:51:193] [    4.607453]         9000000008a319e0 9000000008a319d8 90000001002638a0 0000000000000001␍␊
[09:22:51:193] [    4.615538]         0000000000000001 a8fd0f104f1068ea 0000000008f40000 9000000100595a80␍␊
[09:22:51:210] [    4.623625]         0000000000000001 fffffffffffffffe 9000000100cba650 ffffffffffffffff␍␊
[09:22:51:210] [    4.631712]         0000000000000002 0000000000000003 0000000008f40000 90000000031a1000␍␊
[09:22:51:219] [    4.639801]         90000000031a1000 9000000002755220 0000000000000000 0000000000000009␍␊
[09:22:51:230] [    4.647889]         9000000000373620 0000000000000312 0000000000000002 0000000000000002␍␊
[09:22:51:239] [    4.651201] ata4: SATA link down (SStatus 0 SControl 300)␍␊
[09:22:51:239] [    4.661469]         0000000000000000 9000000002755220 900000000024448c 00007ffff21aa2b3␍␊
[09:22:51:256] [    4.669562]         00000000000002b0 0000000000000008 0000000000000000 0000000000071c1d␍␊
[09:22:51:256] [    4.677654]         ...␍␊
[09:22:51:263] [    4.680213] Call Trace:␍␊
[09:22:51:263] [    4.680214] [<900000000024448c>] show_stack+0x3c/0x150␍␊
[09:22:51:272] [    4.688001] [<900000000023ff88>] dump_stack_lvl+0x5c/0x88␍␊
[09:22:51:272] [    4.693492] [<9000000000268220>] __warn+0x88/0x188␍␊
[09:22:51:280] [    4.698376] [<9000000001752a3c>] report_bug+0x1d4/0x2e0␍␊
[09:22:51:289] [    4.703690] [<9000000001788220>] do_bp+0x1c8/0x408␍␊
[09:22:51:289] [    4.708570] ␍␊
[09:22:51:289] [    4.710159] ---[ end trace 0000000000000000 ]---␍␊
[09:22:51:296] [    4.714867] Rebooting in 30 seconds..␍␊

Fixes: a7369f4 ("HAOC: CREDP: protect commit_creds() from ROP attack.")
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
@sourcery-ai
Copy link

sourcery-ai bot commented Aug 7, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Move assignment of task credentials outside of the CONFIG_CREDP guard so that p->cred and p->real_cred are always initialized, preventing boot panic when CONFIG_CREDP is disabled.

File-Level Changes

Change Details Files
Unconditional initialization of task credentials
  • Unwrap p->cred and p->real_cred assignment from CONFIG_CREDP conditional
  • Add an else block to set credentials when CONFIG_CREDP is not defined
kernel/cred.c

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@Avenger-285714 Avenger-285714 merged commit 45c9ef7 into deepin-community:linux-6.6.y Aug 7, 2025
10 of 11 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a kernel boot panic that occurs when CONFIG_CREDP is disabled. The panic was happening in put_cred_rcu() with a credential usage count of -5, indicating an uninitialized or corrupted credential structure during the boot process.

  • Adds initialization of p->cred and p->real_cred when CONFIG_CREDP is not enabled
  • Prevents kernel panic during boot by ensuring credential fields are properly set
  • Maintains consistency with the existing credential initialization pattern

iee_init_copied_cred(p, get_cred(new));
else
p->cred = p->real_cred = get_cred(new);
#else
Copy link

Copilot AI Aug 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The #else block lacks a comment explaining the condition it handles. Consider adding a comment like '/* CONFIG_CREDP is not enabled */' to improve code readability and match the documentation style of the surrounding code.

Suggested change
#else
#else /* CONFIG_CREDP is not enabled */

Copilot uses AI. Check for mistakes.
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @opsiff - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants