[PATCH 2/3] x86/vdso: use kstrtouint() to validate vdso32= boot parameter
From: Thorsten Blum
Date: Sun Jun 07 2026 - 11:20:20 EST
Replace the deprecated simple_strtoul() with kstrtouint() when parsing
the vdso32= boot parameter and its X86_32 vdso= alias.
simple_strtoul() accepts partial input and silently converts invalid
input to 0. Use kstrtouint() for strict input validation instead and
reject malformed input. Accept only 0 and 1; warn and disable vDSO
support otherwise.
kstrtouint() converts the input string directly to an unsigned int,
avoiding an implicit conversion when assigning to vdso32_enabled.
Update the vdso32= handler comment to reflect the supported values.
Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxx>
---
arch/x86/entry/vdso/vdso32-setup.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/arch/x86/entry/vdso/vdso32-setup.c b/arch/x86/entry/vdso/vdso32-setup.c
index 8894013eea1d..5f3e548ebf19 100644
--- a/arch/x86/entry/vdso/vdso32-setup.c
+++ b/arch/x86/entry/vdso/vdso32-setup.c
@@ -30,10 +30,8 @@ unsigned int __read_mostly vdso32_enabled = VDSO_DEFAULT;
static int __init vdso32_setup(char *s)
{
- vdso32_enabled = simple_strtoul(s, NULL, 0);
-
- if (vdso32_enabled > 1) {
- pr_warn("vdso32 values other than 0 and 1 are no longer allowed; vdso disabled\n");
+ if (kstrtouint(s, 0, &vdso32_enabled) || vdso32_enabled > 1) {
+ pr_warn("vdso32= values other than 0 and 1 are invalid; vdso disabled\n");
vdso32_enabled = 0;
}
@@ -41,9 +39,9 @@ static int __init vdso32_setup(char *s)
}
/*
- * For consistency, the argument vdso32=[012] affects the 32-bit vDSO
+ * For consistency, the argument vdso32=[01] affects the 32-bit vDSO
* behavior on both 64-bit and 32-bit kernels.
- * On 32-bit kernels, vdso=[012] means the same thing.
+ * On 32-bit kernels, vdso=[01] means the same thing.
*/
__setup("vdso32=", vdso32_setup);