mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] selftests/x86: Fix entry_from_vm86 test on 64-bit kernels
@ 2015-07-29 21:35 Andy Lutomirski
  2015-07-31 14:02 ` [tip:x86/asm] selftests/x86/vm86: " tip-bot for Andy Lutomirski
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Lutomirski @ 2015-07-29 21:35 UTC (permalink / raw)
  To: x86, linux-kernel; +Cc: Andy Lutomirski, Brian Gerst

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.

Cc: Brian Gerst <brgerst@gmail.com>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
 tools/testing/selftests/x86/entry_from_vm86.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/x86/entry_from_vm86.c b/tools/testing/selftests/x86/entry_from_vm86.c
index f004b2a09916..9a43a59a9bb4 100644
--- a/tools/testing/selftests/x86/entry_from_vm86.c
+++ b/tools/testing/selftests/x86/entry_from_vm86.c
@@ -105,7 +105,8 @@ extern unsigned char vmcode[], end_vmcode[];
 extern unsigned char vmcode_bound[], vmcode_sysenter[], vmcode_syscall[],
 	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,
 		    const char *text)
 {
@@ -117,7 +118,7 @@ static void do_test(struct vm86plus_struct *v86, unsigned long eip,
 
 	if (ret == -1 && errno == ENOSYS) {
 		printf("[SKIP]\tvm86 not supported\n");
-		return;
+		return false;
 	}
 
 	if (VM86_TYPE(ret) == VM86_INTx) {
@@ -154,6 +155,8 @@ static void do_test(struct vm86plus_struct *v86, unsigned long eip,
 		printf("[FAIL]\tIncorrect return reason\n");
 		nerrs++;
 	}
+
+	return true;
 }
 
 int main(void)
@@ -219,8 +222,8 @@ int main(void)
 	v86.regs.ss = 0;
 	sethandler(SIGSEGV, sighandler, 0);
 	got_signal = 0;
-	do_test(&v86, 0, VM86_SIGNAL, 0, "Execute null pointer");
-	if (!got_signal) {
+	if (do_test(&v86, 0, VM86_SIGNAL, 0, "Execute null pointer") &&
+	    !got_signal) {
 		printf("[FAIL]\tDid not receive SIGSEGV\n");
 		nerrs++;
 	}
-- 
2.4.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-31 14:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-29 21:35 [PATCH] selftests/x86: Fix entry_from_vm86 test on 64-bit kernels Andy Lutomirski
2015-07-31 14:02 ` [tip:x86/asm] selftests/x86/vm86: " tip-bot for Andy Lutomirski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome