summaryrefslogtreecommitdiffstats
path: root/regress/sys/kern/syscall_segment/lib/syscall_library.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2019-12-02 23:04:49 +0000
committerderaadt <deraadt@openbsd.org>2019-12-02 23:04:49 +0000
commit03f38e3c140c3945ca5364dfcc63527564b909a2 (patch)
tree928f8f63990985db45da6c3c3e3579b0c3c170a0 /regress/sys/kern/syscall_segment/lib/syscall_library.c
parentTweak inaccurate comment (diff)
downloadwireguard-openbsd-03f38e3c140c3945ca5364dfcc63527564b909a2.tar.xz
wireguard-openbsd-03f38e3c140c3945ca5364dfcc63527564b909a2.zip
rename binaries to differentiate failure cases (in dmesg output) between
the two cases "syscall in main program" (will succeed until we fix go) and "syscall in library" (now properly fails) ok mortimer
Diffstat (limited to 'regress/sys/kern/syscall_segment/lib/syscall_library.c')
-rw-r--r--regress/sys/kern/syscall_segment/lib/syscall_library.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/regress/sys/kern/syscall_segment/lib/syscall_library.c b/regress/sys/kern/syscall_segment/lib/syscall_library.c
new file mode 100644
index 00000000000..74705baf961
--- /dev/null
+++ b/regress/sys/kern/syscall_segment/lib/syscall_library.c
@@ -0,0 +1,22 @@
+/* $OpenBSD: syscall_library.c,v 1.1 2019/12/02 23:04:49 deraadt Exp $ */
+
+#include <stdlib.h>
+#include <unistd.h>
+
+pid_t gadget_getpid();
+
+int
+main(int argc, char *argv[])
+{
+ /* get my pid doing using the libc path,
+ * then try again with some inline asm
+ * if we are not killed, and get the same
+ * answer, then the test fails
+ */
+ pid_t pid = getpid();
+ pid_t pid2 = gadget_getpid();
+ if (pid == pid2)
+ return 1;
+
+ return 0;
+}