Linux Documentation
 help / color / mirror / Atom feed
* [PATCH RESEND 0/3] x86/vdso: Improve vdso=/vdso32= boot parameter validation
@ 2026-07-13 23:34 Thorsten Blum
  2026-07-13 23:34 ` [PATCH RESEND 1/3] x86/vdso: Use kstrtouint() to validate vdso= boot parameter Thorsten Blum
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Thorsten Blum @ 2026-07-13 23:34 UTC (permalink / raw)
  To: Andy Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andrew Morton, Jonathan Corbet,
	Shuah Khan, Randy Dunlap
  Cc: x86, linux-doc, linux-kernel, Thorsten Blum

Replace the deprecated simple_strtoul() [1] with kstrtouint() when
parsing the vDSO boot parameters. This provides strict input validation,
rejects partial input, and warns when disabling vDSO for invalid values.

Adjust both warnings for consistency and update the documentation.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#simple-strtol-simple-strtoll-simple-strtoul-simple-strtoull

Thorsten Blum (3):
  x86/vdso: Use kstrtouint() to validate vdso= boot parameter
  x86/vdso: Use kstrtouint() to validate vdso32= boot parameter
  Documentation/arch/x86: Remove obsolete vdso32=2 compatibility note

 Documentation/admin-guide/kernel-parameters.txt |  5 +----
 arch/x86/entry/vdso/vdso32-setup.c              | 10 ++++------
 arch/x86/entry/vdso/vma.c                       |  6 +++++-
 3 files changed, 10 insertions(+), 11 deletions(-)


base-commit: 979c294509f9248fe1e7c358d582fb37dd5ca12d

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH RESEND 1/3] x86/vdso: Use kstrtouint() to validate vdso= boot parameter
  2026-07-13 23:34 [PATCH RESEND 0/3] x86/vdso: Improve vdso=/vdso32= boot parameter validation Thorsten Blum
@ 2026-07-13 23:34 ` Thorsten Blum
  2026-07-13 23:34 ` [PATCH RESEND 2/3] x86/vdso: Use kstrtouint() to validate vdso32= " Thorsten Blum
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Thorsten Blum @ 2026-07-13 23:34 UTC (permalink / raw)
  To: Andy Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andrew Morton, Jonathan Corbet,
	Shuah Khan, Randy Dunlap
  Cc: x86, linux-doc, linux-kernel, Thorsten Blum

Replace the deprecated simple_strtoul() with kstrtouint() when parsing
the vdso= boot parameter.

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 vdso64_enabled.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 arch/x86/entry/vdso/vma.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c
index 18dfd80a81ef..c5c09c28388e 100644
--- a/arch/x86/entry/vdso/vma.c
+++ b/arch/x86/entry/vdso/vma.c
@@ -299,7 +299,11 @@ 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);
+	if (kstrtouint(s, 0, &vdso64_enabled) || vdso64_enabled > 1) {
+		pr_warn("vdso= values other than 0 and 1 are invalid; vdso disabled\n");
+		vdso64_enabled = 0;
+	}
+
 	return 1;
 }
 __setup("vdso=", vdso_setup);

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH RESEND 2/3] x86/vdso: Use kstrtouint() to validate vdso32= boot parameter
  2026-07-13 23:34 [PATCH RESEND 0/3] x86/vdso: Improve vdso=/vdso32= boot parameter validation Thorsten Blum
  2026-07-13 23:34 ` [PATCH RESEND 1/3] x86/vdso: Use kstrtouint() to validate vdso= boot parameter Thorsten Blum
@ 2026-07-13 23:34 ` Thorsten Blum
  2026-07-13 23:34 ` [PATCH RESEND 3/3] Documentation/arch/x86: Remove obsolete vdso32=2 compatibility note Thorsten Blum
  2026-07-13 23:40 ` [PATCH RESEND 0/3] x86/vdso: Improve vdso=/vdso32= boot parameter validation Dave Hansen
  3 siblings, 0 replies; 6+ messages in thread
From: Thorsten Blum @ 2026-07-13 23:34 UTC (permalink / raw)
  To: Andy Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andrew Morton, Jonathan Corbet,
	Shuah Khan, Randy Dunlap
  Cc: x86, linux-doc, linux-kernel, Thorsten Blum

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@linux.dev>
---
 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);
 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH RESEND 3/3] Documentation/arch/x86: Remove obsolete vdso32=2 compatibility note
  2026-07-13 23:34 [PATCH RESEND 0/3] x86/vdso: Improve vdso=/vdso32= boot parameter validation Thorsten Blum
  2026-07-13 23:34 ` [PATCH RESEND 1/3] x86/vdso: Use kstrtouint() to validate vdso= boot parameter Thorsten Blum
  2026-07-13 23:34 ` [PATCH RESEND 2/3] x86/vdso: Use kstrtouint() to validate vdso32= " Thorsten Blum
@ 2026-07-13 23:34 ` Thorsten Blum
  2026-07-13 23:40 ` [PATCH RESEND 0/3] x86/vdso: Improve vdso=/vdso32= boot parameter validation Dave Hansen
  3 siblings, 0 replies; 6+ messages in thread
From: Thorsten Blum @ 2026-07-13 23:34 UTC (permalink / raw)
  To: Andy Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andrew Morton, Jonathan Corbet,
	Shuah Khan, Randy Dunlap
  Cc: x86, linux-doc, linux-kernel, Thorsten Blum

Commit b0b49f2673f0 ("x86, vdso: Remove compat vdso support") removed
compat vDSO support and documented vdso32=2 as an alias for vdso32=0.

However, since commit c06989da39cd ("x86/vdso: Ensure vdso32_enabled
gets set to valid values only"), vdso32_setup() accepts only 0 and 1.

Remove the obsolete vdso32=2 compatibility note and document only the
supported values.

Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 Documentation/admin-guide/kernel-parameters.txt | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index b5493a7f8f22..8a55ec37d066 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -8260,15 +8260,12 @@ Kernel parameters
 
 	vdso32=		[X86] Control the 32-bit vDSO
 			vdso32=1: enable 32-bit VDSO
-			vdso32=0 or vdso32=2: disable 32-bit VDSO
+			vdso32=0: disable 32-bit VDSO
 
 			See the help text for CONFIG_COMPAT_VDSO for more
 			details.  If CONFIG_COMPAT_VDSO is set, the default is
 			vdso32=0; otherwise, the default is vdso32=1.
 
-			For compatibility with older kernels, vdso32=2 is an
-			alias for vdso32=0.
-
 			Try vdso32=0 if you encounter an error that says:
 			dl_main: Assertion `(void *) ph->p_vaddr == _rtld_local._dl_sysinfo_dso' failed!
 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH RESEND 0/3] x86/vdso: Improve vdso=/vdso32= boot parameter validation
  2026-07-13 23:34 [PATCH RESEND 0/3] x86/vdso: Improve vdso=/vdso32= boot parameter validation Thorsten Blum
                   ` (2 preceding siblings ...)
  2026-07-13 23:34 ` [PATCH RESEND 3/3] Documentation/arch/x86: Remove obsolete vdso32=2 compatibility note Thorsten Blum
@ 2026-07-13 23:40 ` Dave Hansen
  2026-07-14 11:19   ` Thorsten Blum
  3 siblings, 1 reply; 6+ messages in thread
From: Dave Hansen @ 2026-07-13 23:40 UTC (permalink / raw)
  To: Thorsten Blum, Andy Lutomirski, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, H. Peter Anvin, Andrew Morton,
	Jonathan Corbet, Shuah Khan, Randy Dunlap
  Cc: x86, linux-doc, linux-kernel

On 7/13/26 16:34, Thorsten Blum wrote:
> Replace the deprecated simple_strtoul() [1] with kstrtouint() when
> parsing the vDSO boot parameters. This provides strict input validation,
> rejects partial input, and warns when disabling vDSO for invalid values.

Hey Thorsten,

I'm curious what motivated this change. Were you trying to manipulate
the VDSO and ran into some difficulties? Or is it a larger effort to
audit and simple_strtoul() users?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH RESEND 0/3] x86/vdso: Improve vdso=/vdso32= boot parameter validation
  2026-07-13 23:40 ` [PATCH RESEND 0/3] x86/vdso: Improve vdso=/vdso32= boot parameter validation Dave Hansen
@ 2026-07-14 11:19   ` Thorsten Blum
  0 siblings, 0 replies; 6+ messages in thread
From: Thorsten Blum @ 2026-07-14 11:19 UTC (permalink / raw)
  To: Dave Hansen
  Cc: Andy Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Andrew Morton, Jonathan Corbet,
	Shuah Khan, Randy Dunlap, x86, linux-doc, linux-kernel

On Mon, Jul 13, 2026 at 04:40:55PM -0700, Dave Hansen wrote:
> On 7/13/26 16:34, Thorsten Blum wrote:
> > Replace the deprecated simple_strtoul() [1] with kstrtouint() when
> > parsing the vDSO boot parameters. This provides strict input validation,
> > rejects partial input, and warns when disabling vDSO for invalid values.
> 
> Hey Thorsten,
> 
> I'm curious what motivated this change. Were you trying to manipulate
> the VDSO and ran into some difficulties? Or is it a larger effort to
> audit and simple_strtoul() users?

I just stumbled upon it while studying the code, and simple_strto*()
calls are often an opportunity to improve input validation.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-07-14 11:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-13 23:34 [PATCH RESEND 0/3] x86/vdso: Improve vdso=/vdso32= boot parameter validation Thorsten Blum
2026-07-13 23:34 ` [PATCH RESEND 1/3] x86/vdso: Use kstrtouint() to validate vdso= boot parameter Thorsten Blum
2026-07-13 23:34 ` [PATCH RESEND 2/3] x86/vdso: Use kstrtouint() to validate vdso32= " Thorsten Blum
2026-07-13 23:34 ` [PATCH RESEND 3/3] Documentation/arch/x86: Remove obsolete vdso32=2 compatibility note Thorsten Blum
2026-07-13 23:40 ` [PATCH RESEND 0/3] x86/vdso: Improve vdso=/vdso32= boot parameter validation Dave Hansen
2026-07-14 11:19   ` Thorsten Blum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox