Skip to content

[PW_SID:990141] [v8] riscv: hwprobe: Fix stale vDSO data for late-initialized keys at boot - #754

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

[PW_SID:990141] [v8] riscv: hwprobe: Fix stale vDSO data for late-initialized keys at boot#754
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__fixesfrom
pw990141

Conversation

@linux-riscv-bot

Copy link
Copy Markdown

PR for series 990141 applied to workflow__riscv__fixes

Name: [v8] riscv: hwprobe: Fix stale vDSO data for late-initialized keys at boot
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=990141
Version: 8

The hwprobe vDSO data for some keys, like MISALIGNED_VECTOR_PERF,
is determined by an asynchronous kthread. This can create a race
condition where the kthread finishes after the vDSO data has
already been populated, causing userspace to read stale values.

To fix this race, a new 'ready' flag is added to the vDSO data,
initialized to 'false' during arch_initcall_sync. This flag is
checked by both the vDSO's user-space code and the riscv_hwprobe
syscall. The syscall serves as a one-time gate, using a completion
to wait for any pending probes before populating the data and
setting the flag to 'true', thus ensuring userspace reads fresh
values on its first request.

Reported-by: Tsukasa OI <research_trasio@irq.a4lg.com>
Closes: https://lore.kernel.org/linux-riscv/760d637b-b13b-4518-b6bf-883d55d44e7f@irq.a4lg.com/
Fixes: e7c9d66 ("RISC-V: Report vector unaligned access speed hwprobe")
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
Cc: Olof Johansson <olof@lixom.net>
Cc: stable@vger.kernel.org
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Co-developed-by: Palmer Dabbelt <palmer@dabbelt.com>
Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
Signed-off-by: Jingwei Wang <wangjingwei@iscas.ac.cn>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v8] riscv: hwprobe: Fix stale vDSO data for late-initialized keys at boot"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 106.03 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v8] riscv: hwprobe: Fix stale vDSO data for late-initialized keys at boot"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1191.09 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v8] riscv: hwprobe: Fix stale vDSO data for late-initialized keys at boot"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1693.77 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v8] riscv: hwprobe: Fix stale vDSO data for late-initialized keys at boot"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 20.95 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v8] riscv: hwprobe: Fix stale vDSO data for late-initialized keys at boot"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 22.55 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v8] riscv: hwprobe: Fix stale vDSO data for late-initialized keys at boot"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 2.60 seconds
Result: WARNING
Output:

CHECK: Alignment should match open parenthesis
#205: FILE: arch/riscv/kernel/unaligned_access_speed.c:479:
+		if (IS_ERR(kthread_run(vec_check_unaligned_access_speed_all_cpus,
+			   NULL, "vec_check_unaligned_access_speed_all_cpus"))) {

CHECK: Unnecessary parentheses around 'flags != 0'
#221: FILE: arch/riscv/kernel/vdso/hwprobe.c:30:
+	if ((flags != 0) || (!all_cpus && !avd->homogeneous_cpus) || unlikely(!avd->ready))

total: 0 errors, 0 warnings, 2 checks, 157 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit ad3705be6b45 ("riscv: hwprobe: Fix stale vDSO data for late-initialized keys at boot") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 2 checks, 157 lines checked
CHECK: Alignment should match open parenthesis
CHECK: Unnecessary parentheses around 'flags != 0'


@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v8] riscv: hwprobe: Fix stale vDSO data for late-initialized keys at boot"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 74.85 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v8] riscv: hwprobe: Fix stale vDSO data for late-initialized keys at boot"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v8] riscv: hwprobe: Fix stale vDSO data for late-initialized keys at boot"
kdoc
Desc: Detects for kdoc errors
Duration: 0.92 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v8] riscv: hwprobe: Fix stale vDSO data for late-initialized keys at boot"
module-param
Desc: Detect module_param changes
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v8] riscv: hwprobe: Fix stale vDSO data for late-initialized keys at boot"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.27 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "[v8] riscv: hwprobe: Fix stale vDSO data for late-initialized keys at boot"
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 pw990141 branch August 19, 2025 01:04
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