You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

30 lines
588 B

/* Test module for making nonexecutable stacks executable
on load of a DSO that requires executable stacks. */
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
void callme (void (*callback) (void));
/* This is a function that makes use of executable stack by
using a local function trampoline. */
void
tryme (void)
{
bool ok = false;
void callback (void) { ok = true; }
callme (&callback);
if (ok)
printf ("DSO called ok (local %p, trampoline %p)\n", &ok, &callback);
else
abort ();
}
void
callme (void (*callback) (void))
{
(*callback) ();
}