Skip to content

Commit 191752d

Browse files
Dominik Brodowskigregkh
authored andcommitted
selftests/x86: Do not rely on "int $0x80" in single_step_syscall.c
commit 4105c69 upstream. On 64-bit builds, we should not rely on "int $0x80" working (it only does if CONFIG_IA32_EMULATION=y is enabled). To keep the "Set TF and check int80" test running on 64-bit installs with CONFIG_IA32_EMULATION=y enabled, build this test only if we can also build 32-bit binaries (which should be a good approximation for that). Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net> Cc: Andy Lutomirski <luto@kernel.org> Cc: Dmitry Safonov <dsafonov@virtuozzo.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kselftest@vger.kernel.org Cc: shuah@kernel.org Link: http://lkml.kernel.org/r/20180211111013.16888-5-linux@dominikbrodowski.net Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0472707 commit 191752d

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

tools/testing/selftests/x86/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ CAN_BUILD_X86_64 := $(shell ./check_cc.sh $(CC) trivial_64bit_program.c)
2626
ifeq ($(CAN_BUILD_I386),1)
2727
all: all_32
2828
TEST_PROGS += $(BINARIES_32)
29+
EXTRA_CFLAGS += -DCAN_BUILD_32
2930
endif
3031

3132
ifeq ($(CAN_BUILD_X86_64),1)
3233
all: all_64
3334
TEST_PROGS += $(BINARIES_64)
35+
EXTRA_CFLAGS += -DCAN_BUILD_64
3436
endif
3537

3638
all_32: $(BINARIES_32)

tools/testing/selftests/x86/single_step_syscall.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ static void check_result(void)
119119

120120
int main()
121121
{
122+
#ifdef CAN_BUILD_32
122123
int tmp;
124+
#endif
123125

124126
sethandler(SIGTRAP, sigtrap, 0);
125127

@@ -139,12 +141,13 @@ int main()
139141
: : "c" (post_nop) : "r11");
140142
check_result();
141143
#endif
142-
144+
#ifdef CAN_BUILD_32
143145
printf("[RUN]\tSet TF and check int80\n");
144146
set_eflags(get_eflags() | X86_EFLAGS_TF);
145147
asm volatile ("int $0x80" : "=a" (tmp) : "a" (SYS_getpid)
146148
: INT80_CLOBBERS);
147149
check_result();
150+
#endif
148151

149152
/*
150153
* This test is particularly interesting if fast syscalls use

0 commit comments

Comments
 (0)