Last change
on this file was 2036, checked in by bird, 20 years ago |
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
588 bytes
|
Line | |
---|
1 | /* Test module for making nonexecutable stacks executable
|
---|
2 | on load of a DSO that requires executable stacks. */
|
---|
3 |
|
---|
4 | #include <stdbool.h>
|
---|
5 | #include <stdio.h>
|
---|
6 | #include <stdlib.h>
|
---|
7 |
|
---|
8 | void callme (void (*callback) (void));
|
---|
9 |
|
---|
10 | /* This is a function that makes use of executable stack by
|
---|
11 | using a local function trampoline. */
|
---|
12 | void
|
---|
13 | tryme (void)
|
---|
14 | {
|
---|
15 | bool ok = false;
|
---|
16 | void callback (void) { ok = true; }
|
---|
17 |
|
---|
18 | callme (&callback);
|
---|
19 |
|
---|
20 | if (ok)
|
---|
21 | printf ("DSO called ok (local %p, trampoline %p)\n", &ok, &callback);
|
---|
22 | else
|
---|
23 | abort ();
|
---|
24 | }
|
---|
25 |
|
---|
26 | void
|
---|
27 | callme (void (*callback) (void))
|
---|
28 | {
|
---|
29 | (*callback) ();
|
---|
30 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.