Home | History | Annotate | Download | only in tests
      1 
      2 #include <stdio.h>
      3 #include <stdlib.h>
      4 #include <signal.h>
      5 #include "tests/sys_mman.h"
      6 
      7 void sig_hdlr ( int signo ) {
      8    printf ( "caught sig segv\n" ); exit(1);
      9 }
     10 
     11 int main ( void ) {
     12    char* badplace;
     13    printf ( "installing sig handler\n" );
     14    signal(SIGSEGV, sig_hdlr);
     15    printf ( "doing bad thing\n" );
     16    badplace = get_unmapped_page();
     17    *(int*)badplace = 0;
     18    printf ( "exited normally ?!\n" );
     19    return 0;
     20 }
     21 
     22