Issue 182813
Summary [Flang Runtime] Implement Runtime Trampoline Pool for W^X Compliance
Labels flang
Assignees
Reporter Saieiei
    Currently, Flang supports pointers to internal procedures by utilizing LLVM's trampoline intrinsics `(llvm.init.trampoline`), which generate **stack-based trampolines**. This approach requires an **executable stack** (`-Wl,-z,execstack`), raising **security concerns** by violating W^X (Write XOR Execute) memory protection principles.

I would like to implement the **Runtime Trampoline Pool** approach described in the `InternalProcedureTrampolines` [documentation ](https://flang.llvm.org/docs/InternalProcedureTrampolines.html)(https://flang.llvm.org/docs/InternalProcedureTrampolines.html). Instead of stack trampolines, the runtime will manage a pool where trampoline code lives in a **separate RX (read+execute) region** using prebuilt templates, and the per-instance trampoline data lives in a **separate RW (read+write) region** (callee address + static chain/context).

This functionality will be exposed via simple r**untime APIs** like `InitTrampoline()`, `AdjustTrampoline()`, and `FreeTrampoline()`. This approach keeps W^X/NX intact, avoids execstack/linker friction, and does not require any procedure-pointer ABI change, as procedure pointers will remain raw callable addresses.

Could you please assign this issue to me?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to