Back to index

glibc  2.9
tst-execstack-prog.c
Go to the documentation of this file.
00001 /* Test program for executable stacks in an executable itself.  */
00002 
00003 #include <dlfcn.h>
00004 #include <stdio.h>
00005 #include <string.h>
00006 #include <unistd.h>
00007 #include <error.h>
00008 
00009 #include "tst-execstack-mod.c"     /* This defines the `tryme' test function.  */
00010 
00011 static void deeper (void (*f) (void));
00012 
00013 static int
00014 do_test (void)
00015 {
00016   tryme ();
00017 
00018   /* Test that growing the stack region gets new executable pages too.  */
00019   deeper (&tryme);
00020 
00021   return 0;
00022 }
00023 
00024 static void
00025 deeper (void (*f) (void))
00026 {
00027   char stack[1100 * 1024];
00028   memfrob (stack, sizeof stack);
00029   (*f) ();
00030   memfrob (stack, sizeof stack);
00031 }
00032 
00033 
00034 #define TEST_FUNCTION do_test ()
00035 #include "../test-skeleton.c"