Skip to contentSkip to conversation

x86: xsave.h needs user.h

PATCH New Dave Hansen 2 participants 5 messages Nov 11, 2014 – Nov 16, 2014 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 x86: xsave.h needs user.h

From: Dave Hansen <[email protected]>

xsave.h uses USER_XSTATE_FX_SW_WORDS, but does not include user.h.

Add the include.

---

 b/arch/x86/include/asm/xsave.h |    1 +
 1 file changed, 1 insertion(+)
arch/x86/include/asm/xsave.h renamed from arch/x86/include/asm/xsave.h~x86-xsave.h-needs-user.h +1 -0
diff -puN arch/x86/include/asm/xsave.h~x86-xsave.h-needs-user.h arch/x86/include/asm/xsave.h
@@ -3,6 +3,7 @@
 
 #include <linux/types.h>
 #include <asm/processor.h>
+#include <asm/user.h>
 
 #define XSTATE_CPUID		0x0000000d
 

_

#1 lore raw

PATCH 2/2 x86: require exact match for "noxsave" command line option

From: Dave Hansen <[email protected]>

We have some very similarly named command-line options:

arch/x86/kernel/cpu/common.c:__setup("noxsave", x86_xsave_setup); arch/x86/kernel/cpu/common.c:__setup("noxsaveopt", x86_xsaveopt_setup); arch/x86/kernel/cpu/common.c:__setup("noxsaves", x86_xsaves_setup);

__setup() is designed to match options that take arguments, like "foo=bar" where you would have:

	__setup("foo", x86_foo_func...);

The problem is that "noxsave" actually _matches_ "noxsaves" in the same way that "foo" matches "foo=bar". If you boot an old kernel that does not know about "noxsaves" with "noxsaves" on the command line, it will interpret the argument as "noxsave", which is not what you want at all.

This makes the "noxsave" handler only return success when it finds an *exact* match.

We should try and get this patch in to as many old kernels as possible.

---

 b/arch/x86/kernel/cpu/common.c |    2 ++
 1 file changed, 2 insertions(+)
arch/x86/kernel/cpu/common.c renamed from arch/x86/kernel/cpu/common.c~mpx-xsave-setup-exact +2 -0
diff -puN arch/x86/kernel/cpu/common.c~mpx-xsave-setup-exact arch/x86/kernel/cpu/common.c
@@ -146,6 +146,8 @@ EXPORT_PER_CPU_SYMBOL_GPL(gdt_page);
 
 static int __init x86_xsave_setup(char *s)
 {
+	if (strlen(s))
+		return 0;
 	setup_clear_cpu_cap(X86_FEATURE_XSAVE);
 	setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT);
 	setup_clear_cpu_cap(X86_FEATURE_XSAVES);

_

#2 lore raw

[tip:x86/urgent] x86: Require exact match for 'noxsave' command line option

x86: Require exact match for 'noxsave' command line option
Commit-ID:  2cd3949f702692cf4c5d05b463f19cd706a92dd3
Gitweb:     http://git.kernel.org/tip/2cd3949f702692cf4c5d05b463f19cd706a92dd3
Author:     Dave Hansen <[email protected]>
AuthorDate: Tue, 11 Nov 2014 14:01:33 -0800
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Sun, 16 Nov 2014 12:13:16 +0100

x86: Require exact match for 'noxsave' command line option

We have some very similarly named command-line options:

arch/x86/kernel/cpu/common.c:__setup("noxsave", x86_xsave_setup); arch/x86/kernel/cpu/common.c:__setup("noxsaveopt", x86_xsaveopt_setup); arch/x86/kernel/cpu/common.c:__setup("noxsaves", x86_xsaves_setup);

__setup() is designed to match options that take arguments, like "foo=bar" where you would have:

	__setup("foo", x86_foo_func...);

The problem is that "noxsave" actually _matches_ "noxsaves" in the same way that "foo" matches "foo=bar". If you boot an old kernel that does not know about "noxsaves" with "noxsaves" on the command line, it will interpret the argument as "noxsave", which is not what you want at all.

This makes the "noxsave" handler only return success when it finds an *exact* match.

[ tglx: We really need to make __setup() more robust. ]

---
 arch/x86/kernel/cpu/common.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/kernel/cpu/common.c +2 -0
index 4b4f78c..cfa9b5b 100644
@@ -146,6 +146,8 @@ EXPORT_PER_CPU_SYMBOL_GPL(gdt_page);
 
 static int __init x86_xsave_setup(char *s)
 {
+	if (strlen(s))
+		return 0;
 	setup_clear_cpu_cap(X86_FEATURE_XSAVE);
 	setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT);
 	setup_clear_cpu_cap(X86_FEATURE_XSAVES);
#3 lore raw

[tip:x86/fpu] x86: Require exact match for "noxsave" command line option

In reply to Dave Hansen
x86: Require exact match for "noxsave" command line option
Commit-ID:  f9017963878933fc1d8fff85a9365a0d29104565
Gitweb:     http://git.kernel.org/tip/f9017963878933fc1d8fff85a9365a0d29104565
Author:     Dave Hansen <[email protected]>
AuthorDate: Tue, 11 Nov 2014 14:01:33 -0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Sun, 16 Nov 2014 11:30:40 +0100

x86: Require exact match for "noxsave" command line option

We have some very similarly named command-line options:

  arch/x86/kernel/cpu/common.c:__setup("noxsave", x86_xsave_setup);
  arch/x86/kernel/cpu/common.c:__setup("noxsaveopt", x86_xsaveopt_setup);
  arch/x86/kernel/cpu/common.c:__setup("noxsaves", x86_xsaves_setup);

__setup() is designed to match options that take arguments, like "foo=bar" where you would have:

	__setup("foo", x86_foo_func...);

The problem is that "noxsave" actually _matches_ "noxsaves" in the same way that "foo" matches "foo=bar". If you boot an old kernel that does not know about "noxsaves" with "noxsaves" on the command line, it will interpret the argument as "noxsave", which is not what you want at all.

This makes the "noxsave" handler only return success when it finds an *exact* match.

We should try and get this patch in to as many old kernels as possible.

---
 arch/x86/kernel/cpu/common.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/kernel/cpu/common.c +2 -0
index 4b4f78c..cfa9b5b 100644
@@ -146,6 +146,8 @@ EXPORT_PER_CPU_SYMBOL_GPL(gdt_page);
 
 static int __init x86_xsave_setup(char *s)
 {
+	if (strlen(s))
+		return 0;
 	setup_clear_cpu_cap(X86_FEATURE_XSAVE);
 	setup_clear_cpu_cap(X86_FEATURE_XSAVEOPT);
 	setup_clear_cpu_cap(X86_FEATURE_XSAVES);
#4 lore raw

[tip:x86/fpu] x86: Add #include user.h to xsave.h

In reply to Dave Hansen
x86: Add #include user.h to xsave.h
Commit-ID:  b48cbd27b38ed3aef56a02dca2a4853fa5dabb1f
Gitweb:     http://git.kernel.org/tip/b48cbd27b38ed3aef56a02dca2a4853fa5dabb1f
Author:     Dave Hansen <[email protected]>
AuthorDate: Tue, 11 Nov 2014 14:01:31 -0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Sun, 16 Nov 2014 11:30:39 +0100

x86: Add #include user.h to xsave.h

xsave.h uses USER_XSTATE_FX_SW_WORDS, but does not include user.h.

Add the include.

---
 arch/x86/include/asm/xsave.h | 1 +
 1 file changed, 1 insertion(+)
arch/x86/include/asm/xsave.h +1 -0
index 7e7a79a..047797a 100644
@@ -3,6 +3,7 @@
 
 #include <linux/types.h>
 #include <asm/processor.h>
+#include <asm/user.h>
 
 #define XSTATE_CPUID		0x0000000d