[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251218180412.422164-1-thorsten.blum@linux.dev>
Date: Thu, 18 Dec 2025 19:04:12 +0100
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>
Cc: Thorsten Blum <thorsten.blum@...ux.dev>,
linux-kernel@...r.kernel.org
Subject: [PATCH] x86/vdso: Replace simple_strtoul with kstrtouint in vdso{32}_setup
Replace simple_strtoul() with the recommended kstrtouint() for parsing
the 'vdso=' and 'vdso32=' boot parameters. Unlike simple_strtoul(),
which returns an unsigned long, kstrtouint() converts the string
directly to an unsigned integer.
Check the return value of kstrtouint() and reject invalid values. This
adds error handling while preserving existing behavior for valid values,
and removes use of the deprecated simple_strtoul() helper.
Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
---
arch/x86/entry/vdso/vdso32-setup.c | 4 +---
arch/x86/entry/vdso/vma.c | 3 +--
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/x86/entry/vdso/vdso32-setup.c b/arch/x86/entry/vdso/vdso32-setup.c
index 8894013eea1d..9556633c8f93 100644
--- a/arch/x86/entry/vdso/vdso32-setup.c
+++ b/arch/x86/entry/vdso/vdso32-setup.c
@@ -30,9 +30,7 @@ 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) {
+ if (kstrtouint(s, 0, &vdso32_enabled) || vdso32_enabled > 1) {
pr_warn("vdso32 values other than 0 and 1 are no longer allowed; vdso disabled\n");
vdso32_enabled = 0;
}
diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c
index afe105b2f907..468e0464be36 100644
--- a/arch/x86/entry/vdso/vma.c
+++ b/arch/x86/entry/vdso/vma.c
@@ -278,8 +278,7 @@ bool arch_syscall_is_vdso_sigreturn(struct pt_regs *regs)
#ifdef CONFIG_X86_64
static __init int vdso_setup(char *s)
{
- vdso64_enabled = simple_strtoul(s, NULL, 0);
- return 1;
+ return kstrtouint(s, 0, &vdso64_enabled) == 0;
}
__setup("vdso=", vdso_setup);
#endif /* CONFIG_X86_64 */
--
Thorsten Blum <thorsten.blum@...ux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
Powered by blists - more mailing lists