(root)/
glibc-2.38/
elf/
tst-execstack-mod.c
       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  }