]>
Commit | Line | Data |
---|---|---|
9e1c2c07 GKH |
1 | From 4105c69703cdeba76f384b901712c9397b04e9c2 Mon Sep 17 00:00:00 2001 |
2 | From: Dominik Brodowski <linux@dominikbrodowski.net> | |
3 | Date: Tue, 13 Feb 2018 09:13:21 +0100 | |
4 | Subject: selftests/x86: Do not rely on "int $0x80" in single_step_syscall.c | |
5 | ||
6 | From: Dominik Brodowski <linux@dominikbrodowski.net> | |
7 | ||
8 | commit 4105c69703cdeba76f384b901712c9397b04e9c2 upstream. | |
9 | ||
10 | On 64-bit builds, we should not rely on "int $0x80" working (it only does if | |
11 | CONFIG_IA32_EMULATION=y is enabled). To keep the "Set TF and check int80" | |
12 | test running on 64-bit installs with CONFIG_IA32_EMULATION=y enabled, build | |
13 | this test only if we can also build 32-bit binaries (which should be a | |
14 | good approximation for that). | |
15 | ||
16 | Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net> | |
17 | Cc: Andy Lutomirski <luto@kernel.org> | |
18 | Cc: Dmitry Safonov <dsafonov@virtuozzo.com> | |
19 | Cc: Linus Torvalds <torvalds@linux-foundation.org> | |
20 | Cc: Peter Zijlstra <peterz@infradead.org> | |
21 | Cc: Thomas Gleixner <tglx@linutronix.de> | |
22 | Cc: linux-kselftest@vger.kernel.org | |
23 | Cc: shuah@kernel.org | |
24 | Link: http://lkml.kernel.org/r/20180211111013.16888-5-linux@dominikbrodowski.net | |
25 | Signed-off-by: Ingo Molnar <mingo@kernel.org> | |
26 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
27 | ||
28 | --- | |
29 | tools/testing/selftests/x86/Makefile | 2 ++ | |
30 | tools/testing/selftests/x86/single_step_syscall.c | 5 ++++- | |
31 | 2 files changed, 6 insertions(+), 1 deletion(-) | |
32 | ||
33 | --- a/tools/testing/selftests/x86/Makefile | |
34 | +++ b/tools/testing/selftests/x86/Makefile | |
35 | @@ -30,11 +30,13 @@ CAN_BUILD_X86_64 := $(shell ./check_cc.s | |
36 | ifeq ($(CAN_BUILD_I386),1) | |
37 | all: all_32 | |
38 | TEST_PROGS += $(BINARIES_32) | |
39 | +EXTRA_CFLAGS += -DCAN_BUILD_32 | |
40 | endif | |
41 | ||
42 | ifeq ($(CAN_BUILD_X86_64),1) | |
43 | all: all_64 | |
44 | TEST_PROGS += $(BINARIES_64) | |
45 | +EXTRA_CFLAGS += -DCAN_BUILD_64 | |
46 | endif | |
47 | ||
48 | all_32: $(BINARIES_32) | |
49 | --- a/tools/testing/selftests/x86/single_step_syscall.c | |
50 | +++ b/tools/testing/selftests/x86/single_step_syscall.c | |
51 | @@ -119,7 +119,9 @@ static void check_result(void) | |
52 | ||
53 | int main() | |
54 | { | |
55 | +#ifdef CAN_BUILD_32 | |
56 | int tmp; | |
57 | +#endif | |
58 | ||
59 | sethandler(SIGTRAP, sigtrap, 0); | |
60 | ||
61 | @@ -139,12 +141,13 @@ int main() | |
62 | : : "c" (post_nop) : "r11"); | |
63 | check_result(); | |
64 | #endif | |
65 | - | |
66 | +#ifdef CAN_BUILD_32 | |
67 | printf("[RUN]\tSet TF and check int80\n"); | |
68 | set_eflags(get_eflags() | X86_EFLAGS_TF); | |
69 | asm volatile ("int $0x80" : "=a" (tmp) : "a" (SYS_getpid) | |
70 | : INT80_CLOBBERS); | |
71 | check_result(); | |
72 | +#endif | |
73 | ||
74 | /* | |
75 | * This test is particularly interesting if fast syscalls use |