2003-09-24 09:56:08 +08:00
|
|
|
/* Test program for executable stacks in an executable itself. */
|
|
|
|
|
|
|
|
#include <dlfcn.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <error.h>
|
|
|
|
|
|
|
|
#include "tst-execstack-mod.c" /* This defines the `tryme' test function. */
|
|
|
|
|
|
|
|
static void deeper (void (*f) (void));
|
|
|
|
|
|
|
|
static int
|
|
|
|
do_test (void)
|
|
|
|
{
|
|
|
|
tryme ();
|
|
|
|
|
|
|
|
/* Test that growing the stack region gets new executable pages too. */
|
|
|
|
deeper (&tryme);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
deeper (void (*f) (void))
|
|
|
|
{
|
|
|
|
char stack[1100 * 1024];
|
2021-10-20 21:38:50 +08:00
|
|
|
explicit_bzero (stack, sizeof stack);
|
2003-09-24 09:56:08 +08:00
|
|
|
(*f) ();
|
|
|
|
memfrob (stack, sizeof stack);
|
|
|
|
}
|
|
|
|
|
2017-04-05 21:34:39 +08:00
|
|
|
#include <support/test-driver.c>
|