I know what an executable stack means and why they’re a bad idea and I’ve
heard of trampolines but I don’t actually know what they are or why they’re
necessary.


On Mon, Jan 12, 2026 at 15:39 Robert Henry via wsjt-devel <
[email protected]> wrote:

> gcc/gfortran will put executable "trampoline" code on the stack as a way
> to implement procedures passed as arguments ("funargs" in the lingo) to
> other procedures.
>
> Executable stacks are a *major* security breach, and should be avoided.
>
> In the wsjt Fortran code base there are 2 ways to avoid this, I think.
>
> (1) rewrite the fortran code involving dispatch through "callback"
> routines.  I think this is doable, and the infrastructure to support this
> style of object oriented programming could probably be removed too.
>
> (2) If using GNU compilers, compile everywhere with -ftrampoline-impl=heap
> -z noexecstack which will put trampolines on the heap (dynamic memory) and
> tell the linker to tell the operating system to not make the stack
> executable.
>
> I *think* that gcc on x86/x64 is the only pair of compilers and targets
> that still puts trampolines on the stack.  ARM, MacOsX and Windows probably
> use the heap all the time for trampolines.
> _______________________________________________
> wsjt-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wsjt-devel
>
_______________________________________________
wsjt-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wsjt-devel

Reply via email to