xref: /openbsd-src/regress/sys/kern/syscall_segment/main/syscall_main.c (revision 03f38e3c140c3945ca5364dfcc63527564b909a2)
1*03f38e3cSderaadt /*	$OpenBSD: syscall_main.c,v 1.1 2019/12/02 23:04:49 deraadt Exp $	*/
2*03f38e3cSderaadt 
3*03f38e3cSderaadt #include <stdlib.h>
4*03f38e3cSderaadt #include <unistd.h>
5*03f38e3cSderaadt #include "../gadgetsyscall.h"
6*03f38e3cSderaadt 
7*03f38e3cSderaadt int
main(int argc,char * argv[])8*03f38e3cSderaadt main(int argc, char *argv[])
9*03f38e3cSderaadt {
10*03f38e3cSderaadt 	/* get my pid doing using the libc path,
11*03f38e3cSderaadt 	 * then try again with some inline asm
12*03f38e3cSderaadt 	 * if we are not killed, and get the same
13*03f38e3cSderaadt 	 * answer, then the test fails
14*03f38e3cSderaadt 	 */
15*03f38e3cSderaadt 	pid_t pid = getpid();
16*03f38e3cSderaadt 	pid_t pid2 = gadget_getpid();
17*03f38e3cSderaadt 	if (pid == pid2)
18*03f38e3cSderaadt 		return 1;
19*03f38e3cSderaadt 
20*03f38e3cSderaadt 	return 0;
21*03f38e3cSderaadt }
22