summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/x86
diff options
context:
space:
mode:
authorAndy Lutomirski <luto@kernel.org>2015-10-30 22:42:45 -0700
committerThomas Gleixner <tglx@linutronix.de>2015-10-31 09:50:25 +0100
commit226f1f729ce277720fab60c91dd1b12574cfe66c (patch)
tree3f23c6e7248eae34da54f03d94d1c3258888f3a8 /tools/testing/selftests/x86
parentababae44108b0e94b58eef6cb5bd830bd040a47f (diff)
selftests/x86: Add a fork() to entry_from_vm86 to catch fork bugs
Mere possession of vm86 state is strange. Make sure that nothing gets corrupted if we fork after calling vm86(). Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: Brian Gerst <brgerst@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Stas Sergeev <stsp@list.ru> Link: http://lkml.kernel.org/r/08f83295460a80e41dc5e3e81ec40d6844d316f5.1446270067.git.luto@kernel.org Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'tools/testing/selftests/x86')
-rw-r--r--tools/testing/selftests/x86/entry_from_vm86.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/testing/selftests/x86/entry_from_vm86.c b/tools/testing/selftests/x86/entry_from_vm86.c
index 421c607a8856..d075ea0e5ca1 100644
--- a/tools/testing/selftests/x86/entry_from_vm86.c
+++ b/tools/testing/selftests/x86/entry_from_vm86.c
@@ -230,5 +230,9 @@ int main(void)
}
clearhandler(SIGSEGV);
+ /* Make sure nothing explodes if we fork. */
+ if (fork() > 0)
+ return 0;
+
return (nerrs == 0 ? 0 : 1);
}