Blame elf/tst-execstack-prog.c
|
Packit |
6c4009 |
/* Test program for executable stacks in an executable itself. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <dlfcn.h>
|
|
Packit |
6c4009 |
#include <stdio.h>
|
|
Packit |
6c4009 |
#include <string.h>
|
|
Packit |
6c4009 |
#include <unistd.h>
|
|
Packit |
6c4009 |
#include <error.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include "tst-execstack-mod.c" /* This defines the `tryme' test function. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
static void deeper (void (*f) (void));
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
static int
|
|
Packit |
6c4009 |
do_test (void)
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
tryme ();
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Test that growing the stack region gets new executable pages too. */
|
|
Packit |
6c4009 |
deeper (&tryme);
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
return 0;
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
static void
|
|
Packit |
6c4009 |
deeper (void (*f) (void))
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
char stack[1100 * 1024];
|
|
Packit |
6c4009 |
memfrob (stack, sizeof stack);
|
|
Packit |
6c4009 |
(*f) ();
|
|
Packit |
6c4009 |
memfrob (stack, sizeof stack);
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <support/test-driver.c>
|