1 /* 2 * Author: Jeff Moyer 3 * 4 * Description: Pass a non-writable context pointer to io_setup to see if 5 * the kernel deals with it correctly. In the past, the reference counting 6 * in this particular error path was off and this operation would cause an 7 * oops. 8 * 9 * This is a destructive test. 10 */ 11 #include <stdio.h> 12 #include <stdlib.h> 13 #include <sys/mman.h> 14 #include <libgen.h> 15 #include <libaio.h> 16 17 int 18 main(int __attribute__((unused)) argc, char **argv) 19 { 20 void *addr; 21 22 addr = mmap(NULL, 4096, PROT_READ, MAP_SHARED|MAP_ANONYMOUS, 0, 0); 23 if (!addr) { 24 perror("mmap"); 25 exit(1); 26 } 27 io_setup(1, addr /* un-writable pointer */); 28 29 printf("%s: Success!\n", basename(argv[0])); 30 return 0; 31 } 32