Blame elf/tst-execstack-needed.c
|
Packit Service |
82fcde |
/* Test program for making nonexecutable stacks executable
|
|
Packit Service |
82fcde |
on DT_NEEDED load of a DSO that requires executable stacks. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#include <dlfcn.h>
|
|
Packit Service |
82fcde |
#include <stdio.h>
|
|
Packit Service |
82fcde |
#include <string.h>
|
|
Packit Service |
82fcde |
#include <unistd.h>
|
|
Packit Service |
82fcde |
#include <error.h>
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
extern void tryme (void); /* from tst-execstack-mod.so */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
static void deeper (void (*f) (void));
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
static int
|
|
Packit Service |
82fcde |
do_test (void)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
tryme ();
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Test that growing the stack region gets new executable pages too. */
|
|
Packit Service |
82fcde |
deeper (&tryme);
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
return 0;
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
static void
|
|
Packit Service |
82fcde |
deeper (void (*f) (void))
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
char stack[1100 * 1024];
|
|
Packit Service |
82fcde |
memfrob (stack, sizeof stack);
|
|
Packit Service |
82fcde |
(*f) ();
|
|
Packit Service |
82fcde |
memfrob (stack, sizeof stack);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#include <support/test-driver.c>
|