Skip to content

[PW_SID:1088433] [v2] riscv: Fix register corruption from uninitialized cregs on error#1852

Closed
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__fixesfrom
pw1088433
Closed

[PW_SID:1088433] [v2] riscv: Fix register corruption from uninitialized cregs on error#1852
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__fixesfrom
pw1088433

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

PR for series 1088433 applied to workflow__riscv__fixes

Name: [v2] riscv: Fix register corruption from uninitialized cregs on error
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1088433
Version: 2

compat_riscv_gpr_set() calls cregs_to_regs() unconditionally, even when
user_regset_copyin() fails. Since cregs is an uninitialized stack
variable, a copyin failure causes uninitialized stack data to be written
into the target task's pt_regs, corrupting its register state and
potentially leaking kernel stack contents.

compat_restore_sigcontext() has the same issue: it calls cregs_to_regs()
even when __copy_from_user() fails, leading to the same corruption of
the signal-returning task's register state on error.

Only call cregs_to_regs() when the user copy succeeds.

Fixes: 4608c15 ("riscv: compat: ptrace: Add compat_arch_ptrace implement")
Fixes: 7383ee0 ("riscv: compat: signal: Add rt_frame implementation")
Signed-off-by: Michael Neuling <mikey@neuling.org>
Assisted-by: Cursor:claude-4.6-opus-high-thinking
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] riscv: Fix register corruption from uninitialized cregs on error"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 140.79 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] riscv: Fix register corruption from uninitialized cregs on error"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1134.54 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] riscv: Fix register corruption from uninitialized cregs on error"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1696.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] riscv: Fix register corruption from uninitialized cregs on error"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 26.05 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] riscv: Fix register corruption from uninitialized cregs on error"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 28.15 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] riscv: Fix register corruption from uninitialized cregs on error"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.01 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] riscv: Fix register corruption from uninitialized cregs on error"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 85.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] riscv: Fix register corruption from uninitialized cregs on error"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] riscv: Fix register corruption from uninitialized cregs on error"
kdoc
Desc: Detects for kdoc errors
Duration: 0.89 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] riscv: Fix register corruption from uninitialized cregs on error"
module-param
Desc: Detect module_param changes
Duration: 0.27 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] riscv: Fix register corruption from uninitialized cregs on error"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.32 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v2] riscv: Fix register corruption from uninitialized cregs on error"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot linux-riscv-bot deleted the pw1088433 branch May 2, 2026 04:05
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