Skip to content

Commit 226f1f7

Browse files
amlutoKAGA-KOKO
authored andcommitted
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>
1 parent ababae4 commit 226f1f7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tools/testing/selftests/x86/entry_from_vm86.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,5 +230,9 @@ int main(void)
230230
}
231231
clearhandler(SIGSEGV);
232232

233+
/* Make sure nothing explodes if we fork. */
234+
if (fork() > 0)
235+
return 0;
236+
233237
return (nerrs == 0 ? 0 : 1);
234238
}

0 commit comments

Comments
 (0)