summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2020-12-14 13:29:34 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2020-12-14 13:29:34 -0800
commit9c70f046787505127f2f8bb60ad24bb3c8bfc61a (patch)
tree46a6df4909b071db9a067309e726841ba7823505 /tools/testing
parentae1c1a8fd9c3f504b390df26b4af8ef6bfde005e (diff)
parentf77f420d34754b8d08ac6ebf094ff7193023196a (diff)
Merge tag 'x86_misc_for_v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull misc x86 updates from Borislav Petkov: "The main part of this branch is the ongoing fight against windmills in an attempt to have userspace tools not poke at naked MSRs. This round deals with MSR_IA32_ENERGY_PERF_BIAS and removes direct poking into it by our in-tree tools in favor of the proper "energy_perf_bias" sysfs interface which we already have. In addition, the msr.ko write filtering's error message points to a new summary page which contains the info we collected from helpful reporters about which userspace tools write MSRs: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/about along with the current status of their conversion. The rest is the usual small fixes and improvements" * tag 'x86_misc_for_v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/msr: Add a pointer to an URL which contains further details x86/pci: Fix the function type for check_reserved_t selftests/x86: Add missing .note.GNU-stack sections selftests/x86/fsgsbase: Fix GS == 1, 2, and 3 tests x86/msr: Downgrade unrecognized MSR message x86/msr: Do not allow writes to MSR_IA32_ENERGY_PERF_BIAS tools/power/x86_energy_perf_policy: Read energy_perf_bias from sysfs tools/power/turbostat: Read energy_perf_bias from sysfs tools/power/cpupower: Read energy_perf_bias from sysfs MAINTAINERS: Cleanup SGI-related entries
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/x86/fsgsbase.c12
-rw-r--r--tools/testing/selftests/x86/raw_syscall_helper_32.S2
-rw-r--r--tools/testing/selftests/x86/thunks.S2
3 files changed, 14 insertions, 2 deletions
diff --git a/tools/testing/selftests/x86/fsgsbase.c b/tools/testing/selftests/x86/fsgsbase.c
index 7161cfc2e60b..8c780cce941d 100644
--- a/tools/testing/selftests/x86/fsgsbase.c
+++ b/tools/testing/selftests/x86/fsgsbase.c
@@ -392,8 +392,8 @@ static void set_gs_and_switch_to(unsigned long local,
local = read_base(GS);
/*
- * Signal delivery seems to mess up weird selectors. Put it
- * back.
+ * Signal delivery is quite likely to change a selector
+ * of 1, 2, or 3 back to 0 due to IRET being defective.
*/
asm volatile ("mov %0, %%gs" : : "rm" (force_sel));
} else {
@@ -411,6 +411,14 @@ static void set_gs_and_switch_to(unsigned long local,
if (base == local && sel_pre_sched == sel_post_sched) {
printf("[OK]\tGS/BASE remained 0x%hx/0x%lx\n",
sel_pre_sched, local);
+ } else if (base == local && sel_pre_sched >= 1 && sel_pre_sched <= 3 &&
+ sel_post_sched == 0) {
+ /*
+ * IRET is misdesigned and will squash selectors 1, 2, or 3
+ * to zero. Don't fail the test just because this happened.
+ */
+ printf("[OK]\tGS/BASE changed from 0x%hx/0x%lx to 0x%hx/0x%lx because IRET is defective\n",
+ sel_pre_sched, local, sel_post_sched, base);
} else {
nerrs++;
printf("[FAIL]\tGS/BASE changed from 0x%hx/0x%lx to 0x%hx/0x%lx\n",
diff --git a/tools/testing/selftests/x86/raw_syscall_helper_32.S b/tools/testing/selftests/x86/raw_syscall_helper_32.S
index 94410fa2b5ed..a10d36afdca0 100644
--- a/tools/testing/selftests/x86/raw_syscall_helper_32.S
+++ b/tools/testing/selftests/x86/raw_syscall_helper_32.S
@@ -45,3 +45,5 @@ int80_and_ret:
.type int80_and_ret, @function
.size int80_and_ret, .-int80_and_ret
+
+.section .note.GNU-stack,"",%progbits
diff --git a/tools/testing/selftests/x86/thunks.S b/tools/testing/selftests/x86/thunks.S
index 1bb5d62c16a4..a2d47d8344d4 100644
--- a/tools/testing/selftests/x86/thunks.S
+++ b/tools/testing/selftests/x86/thunks.S
@@ -57,3 +57,5 @@ call32_from_64:
ret
.size call32_from_64, .-call32_from_64
+
+.section .note.GNU-stack,"",%progbits