Commit e800eb39 authored by Andy Lutomirski's avatar Andy Lutomirski Committed by Ingo Molnar

selftests/x86/vm86: Fix entry_from_vm86 test on 64-bit kernels

The test failed due to an oversight on my part when run on a
64-bit kernel.  vm86 isn't expected to work at all, and I
mistakenly failed one part of the test because no signal was
delivered.
Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/502c8bef877b33fe4943885ded6125dfcc7892db.1438205722.git.luto@kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent a5b9e5a2
...@@ -105,7 +105,8 @@ extern unsigned char vmcode[], end_vmcode[]; ...@@ -105,7 +105,8 @@ extern unsigned char vmcode[], end_vmcode[];
extern unsigned char vmcode_bound[], vmcode_sysenter[], vmcode_syscall[], extern unsigned char vmcode_bound[], vmcode_sysenter[], vmcode_syscall[],
vmcode_sti[], vmcode_int3[], vmcode_int80[]; vmcode_sti[], vmcode_int3[], vmcode_int80[];
static void do_test(struct vm86plus_struct *v86, unsigned long eip, /* Returns false if the test was skipped. */
static bool do_test(struct vm86plus_struct *v86, unsigned long eip,
unsigned int rettype, unsigned int retarg, unsigned int rettype, unsigned int retarg,
const char *text) const char *text)
{ {
...@@ -117,7 +118,7 @@ static void do_test(struct vm86plus_struct *v86, unsigned long eip, ...@@ -117,7 +118,7 @@ static void do_test(struct vm86plus_struct *v86, unsigned long eip,
if (ret == -1 && errno == ENOSYS) { if (ret == -1 && errno == ENOSYS) {
printf("[SKIP]\tvm86 not supported\n"); printf("[SKIP]\tvm86 not supported\n");
return; return false;
} }
if (VM86_TYPE(ret) == VM86_INTx) { if (VM86_TYPE(ret) == VM86_INTx) {
...@@ -154,6 +155,8 @@ static void do_test(struct vm86plus_struct *v86, unsigned long eip, ...@@ -154,6 +155,8 @@ static void do_test(struct vm86plus_struct *v86, unsigned long eip,
printf("[FAIL]\tIncorrect return reason\n"); printf("[FAIL]\tIncorrect return reason\n");
nerrs++; nerrs++;
} }
return true;
} }
int main(void) int main(void)
...@@ -219,8 +222,8 @@ int main(void) ...@@ -219,8 +222,8 @@ int main(void)
v86.regs.ss = 0; v86.regs.ss = 0;
sethandler(SIGSEGV, sighandler, 0); sethandler(SIGSEGV, sighandler, 0);
got_signal = 0; got_signal = 0;
do_test(&v86, 0, VM86_SIGNAL, 0, "Execute null pointer"); if (do_test(&v86, 0, VM86_SIGNAL, 0, "Execute null pointer") &&
if (!got_signal) { !got_signal) {
printf("[FAIL]\tDid not receive SIGSEGV\n"); printf("[FAIL]\tDid not receive SIGSEGV\n");
nerrs++; nerrs++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment