[PATCH urgent 1/2] selftests/x86: Add a fork() to entry_from_vm86 to catch fork bugs

From: Andy Lutomirski
Date: Sat Oct 31 2015 - 01:42:58 EST


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@xxxxxxxxxx>
---
tools/testing/selftests/x86/entry_from_vm86.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/x86/entry_from_vm86.c b/tools/testing/selftests/x86/entry_from_vm86.c
index 9a43a59a9bb4..13b2965472e3 100644
--- a/tools/testing/selftests/x86/entry_from_vm86.c
+++ b/tools/testing/selftests/x86/entry_from_vm86.c
@@ -229,5 +229,9 @@ int main(void)
}
clearhandler(SIGSEGV);

+ /* Make sure nothing explodes if we fork. */
+ if (fork() > 0)
+ return 0;
+
return (nerrs == 0 ? 0 : 1);
}
--
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/