* [PATCH v2 1/2] x86/vdso: Replace deprecated simple_strtoul() with kstrtouint()
2026-10-05 16:33 [PATCH v2 0/2] x86/vdso: Replace deprecated simple_strtoul() with kstrtouint() Habil Eren Türker
@ 2026-10-05 16:33 ` Habil Eren Türker
2026-10-05 16:33 ` [PATCH v2 2/2] x86/vdso: Replace deprecated simple_strtoul() with kstrtouint() in vdso_setup Habil Eren Türker
2026-10-05 17:07 ` [PATCH v2 0/2] x86/vdso: Replace deprecated simple_strtoul() with kstrtouint() Thorsten Blum
2 siblings, 0 replies; 6+ messages in thread
From: Habil Eren Türker @ 2026-10-05 16:33 UTC (permalink / raw)
To: luto, tglx, mingo, bp, dave.hansen, x86
Cc: hpa, linux-kernel, Habil Eren Türker
The simple_strtoul() function is deprecated because it explicitly ignores
overflows. Replace it with the proper variant, kstrtouint(),
in vdso32_setup().
It was detected while running a static analysis on the use of
simple_strtoul() in the kernel.
Signed-off-by: Habil Eren Türker <habilerenturker@hotmail.com>
---
arch/x86/entry/vdso/vdso32-setup.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/arch/x86/entry/vdso/vdso32-setup.c b/arch/x86/entry/vdso/vdso32-setup.c
index 8894013ee..126c0398d 100644
--- a/arch/x86/entry/vdso/vdso32-setup.c
+++ b/arch/x86/entry/vdso/vdso32-setup.c
@@ -30,13 +30,20 @@ unsigned int __read_mostly vdso32_enabled = VDSO_DEFAULT;
static int __init vdso32_setup(char *s)
{
- vdso32_enabled = simple_strtoul(s, NULL, 0);
+ unsigned int val;
- if (vdso32_enabled > 1) {
+ if (unlikely(kstrtouint(s, 0, &val))) {
+ vdso32_enabled = 0;
+ return 1;
+ }
+
+ if (val > 1) {
pr_warn("vdso32 values other than 0 and 1 are no longer allowed; vdso disabled\n");
vdso32_enabled = 0;
+ return 1;
}
+ vdso32_enabled = val;
return 1;
}
--
2.47.3
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v2 2/2] x86/vdso: Replace deprecated simple_strtoul() with kstrtouint() in vdso_setup
2026-10-05 16:33 [PATCH v2 0/2] x86/vdso: Replace deprecated simple_strtoul() with kstrtouint() Habil Eren Türker
2026-10-05 16:33 ` [PATCH v2 1/2] " Habil Eren Türker
@ 2026-10-05 16:33 ` Habil Eren Türker
2026-10-05 17:07 ` [PATCH v2 0/2] x86/vdso: Replace deprecated simple_strtoul() with kstrtouint() Thorsten Blum
2 siblings, 0 replies; 6+ messages in thread
From: Habil Eren Türker @ 2026-10-05 16:33 UTC (permalink / raw)
To: luto, tglx, mingo, bp, dave.hansen, x86
Cc: hpa, linux-kernel, Habil Eren Türker
The simple_strtoul() function is deprecated because it explicitly ignores
overflows. Replace it with the proper variant, kstrtouint(),
in vdso_setup(). Also add pr_warn().
It was detected while running a static analysis on the use of
simple_strtoul() in the kernel.
Signed-off-by: Habil Eren Türker <habilerenturker@hotmail.com>
---
arch/x86/entry/vdso/vma.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c
index 18dfd80a8..62d96a537 100644
--- a/arch/x86/entry/vdso/vma.c
+++ b/arch/x86/entry/vdso/vma.c
@@ -299,7 +299,20 @@ 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);
+ unsigned int val;
+
+ if (unlikely(kstrtouint(s, 0, &val))) {
+ vdso64_enabled = 0;
+ return 1;
+ }
+
+ if (val > 1) {
+ pr_warn("vdso64 values other than 0 and 1 are no longer allowed; vdso disabled\n");
+ vdso64_enabled = 0;
+ return 1;
+ }
+
+ vdso64_enabled = val;
return 1;
}
__setup("vdso=", vdso_setup);
--
2.47.3
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2 0/2] x86/vdso: Replace deprecated simple_strtoul() with kstrtouint()
2026-10-05 16:33 [PATCH v2 0/2] x86/vdso: Replace deprecated simple_strtoul() with kstrtouint() Habil Eren Türker
2026-10-05 16:33 ` [PATCH v2 1/2] " Habil Eren Türker
2026-10-05 16:33 ` [PATCH v2 2/2] x86/vdso: Replace deprecated simple_strtoul() with kstrtouint() in vdso_setup Habil Eren Türker
@ 2026-10-05 17:07 ` Thorsten Blum
2026-10-06 20:12 ` Habil Eren Türker
2 siblings, 1 reply; 6+ messages in thread
From: Thorsten Blum @ 2026-10-05 17:07 UTC (permalink / raw)
To: Habil Eren Türker
Cc: luto, tglx, mingo, bp, dave.hansen, x86, hpa, linux-kernel
On Mon, Oct 05, 2026 at 04:33:37PM +0000, Habil Eren Türker wrote:
> This patch series replaces the deprecated simple_strtoul() function
> with the safer kstrtouint() variant in the x86 vdso setup code.
>
> The simple_strtoul() function is deprecated as it silently ignores
> overflows. Proper bounds and lineer error checking are introduced.
>
> Changes in v2:
> - Fixed the logical short-circuit operator bug in parsing error paths
> where invalid inputs could trigger deceptive warning logs.
> - Refactored error handling into a linear flow with unlikely() macros
> to avoid branch misprediction.
>
> Habil Eren Türker (2):
> x86/vdso: Replace deprecated simple_strtoul() with kstrtouint()
> x86/vdso: Replace deprecated simple_strtoul() with kstrtouint() in
> vdso_setup
>
> arch/x86/entry/vdso/vdso32-setup.c | 11 +++++++++--
> arch/x86/entry/vdso/vma.c | 15 ++++++++++++++-
> 2 files changed, 23 insertions(+), 3 deletions(-)
I submitted a very similar series a while ago [1], but haven't received
feedback yet (besides a Reviewed-by from Randy on the documentation
change).
Dave, did you have a chance to take a look at my series yet?
Thanks,
Thorsten
[1] https://lore.kernel.org/lkml/20260831101657.2947-5-blum@kernel.org/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] x86/vdso: Replace deprecated simple_strtoul() with kstrtouint()
2026-10-05 17:07 ` [PATCH v2 0/2] x86/vdso: Replace deprecated simple_strtoul() with kstrtouint() Thorsten Blum
@ 2026-10-06 20:12 ` Habil Eren Türker
2026-10-07 8:26 ` Thorsten Blum
0 siblings, 1 reply; 6+ messages in thread
From: Habil Eren Türker @ 2026-10-06 20:12 UTC (permalink / raw)
To: Thorsten Blum
Cc: Dave Hansen, Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86,
H . Peter Anvin, Andy Lutomirski, linux-kernel,
Habil Eren Türker
> I submitted a very similar series a while ago [1], but haven't received
> feedback yet (besides a Reviewed-by from Randy on the documentation
> change).
Hi Thorsten,
You are right, and thank you for pointing this out. My series is essentially
a duplicate of yours. Your series came first.
I will withdraw my v2 series and let yours be the one to land.
In the meantime, I took the time to review and test your series on top
of v7.3-rc5. Both the code and the runtime behaviour look correct to me:
Code review:
- kstrtouint() preserves the original semantics of simple_strtoul()
while adding proper overflow checking.
- Error paths are consistent with the existing vdso_setup() logic.
- The documentation removal for vdso32=2 is accurate.
Runtime testing:
- x86_64 QEMU/q35 guest, TCG acceleration, qemu64 CPU model
- KASAN profile (KASAN + KFENCE + DEBUG_OBJECTS)
- memory suite at 256M/512M/1G, 3 iterations per case
- All cases pass, no KASAN/KCSAN/lockdep findings, CRIT_ERRORS=0
Reviewed-by: Habil Eren Türker <habilerenturker@hotmail.com>
Tested-by: Habil Eren Türker <habilerenturker@hotmail.com>
Sorry for the duplicate noise.
Regards,
Türker
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2 0/2] x86/vdso: Replace deprecated simple_strtoul() with kstrtouint()
2026-10-06 20:12 ` Habil Eren Türker
@ 2026-10-07 8:26 ` Thorsten Blum
0 siblings, 0 replies; 6+ messages in thread
From: Thorsten Blum @ 2026-10-07 8:26 UTC (permalink / raw)
To: Habil Eren Türker
Cc: Dave Hansen, Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86,
H . Peter Anvin, Andy Lutomirski, linux-kernel
On Tue, Oct 06, 2026 at 08:12:59PM +0000, Habil Eren Türker wrote:
> > I submitted a very similar series a while ago [1], but haven't received
> > feedback yet (besides a Reviewed-by from Randy on the documentation
> > change).
>
> Hi Thorsten,
>
> You are right, and thank you for pointing this out. My series is essentially
> a duplicate of yours. Your series came first.
>
> I will withdraw my v2 series and let yours be the one to land.
>
> In the meantime, I took the time to review and test your series on top
> of v7.3-rc5. Both the code and the runtime behaviour look correct to me:
>
> Code review:
> - kstrtouint() preserves the original semantics of simple_strtoul()
> while adding proper overflow checking.
> - Error paths are consistent with the existing vdso_setup() logic.
> - The documentation removal for vdso32=2 is accurate.
>
> Runtime testing:
> - x86_64 QEMU/q35 guest, TCG acceleration, qemu64 CPU model
> - KASAN profile (KASAN + KFENCE + DEBUG_OBJECTS)
> - memory suite at 256M/512M/1G, 3 iterations per case
> - All cases pass, no KASAN/KCSAN/lockdep findings, CRIT_ERRORS=0
>
> Reviewed-by: Habil Eren Türker <habilerenturker@hotmail.com>
> Tested-by: Habil Eren Türker <habilerenturker@hotmail.com>
Thank you for reviewing and testing my series, but I believe you must
add your Reviewed-by: and Tested-by: to my series [1], not as a reply to
your own series.
> Sorry for the duplicate noise.
No worries.
Thanks,
Thorsten
[1] https://lore.kernel.org/lkml/20260831101657.2947-5-blum@kernel.org/
^ permalink raw reply [flat|nested] 6+ messages in thread