{
  "id": 4208889,
  "title": "Indirect Calling of Nested Functions on GCC Without Executable Stack",
  "url": "https://urgent.news/2026/08/29/indirect-calling-of-nested-functions-on-gcc-without-executable-stack",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-29T14:20:33.000Z",
  "source": {
    "name": "Hacker News",
    "slug": "hacker-news",
    "url": "https://uecker.codeberg.page/2026-08-29.html"
  },
  "original_language": "en",
  "account": "In discussions about calling nested functions in GCC and Clang, it was noted that older versions of GCC can be supported without requiring an executable stack. While enabling an executable stack is not ideal, a workaround exists. Traditionally, GCC supports taking the address of a nested function, as demonstrated in a toy example. By analyzing the trampoline code, it is possible to extract the code address and static chain, which can then be used with the __builtin_call_with_static_chain built-in function to call the local function directly. This method can be utilized as a fallback mechanism in older GCC versions.\n\nThe main drawbacks of this approach are the creation of a trampoline, the inability for the compiler to devirtualize the indirect call, and the fact that the stack remains marked as executable. However, the security concern of an executable stack can be addressed using patchelf --clear-execstack. Another idea proposes using the trampoline itself as a function descriptor, allowing the code of the trampoline to be interpreted at the call site using a simple interpreter. This technique could potentially be implemented in an experimental library like noplate, where a wide pointer is constructed from the code address and static chain.",
  "summary": null,
  "key_points": [
    "GCC older versions support calling nested functions without executable stack",
    "Extract code address and static chain from trampoline to call local function",
    "Address executable stack concern with patchelf --clear-execstack"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}