Skip to content

[AUTOMATED] Propagate no-return through protected x86 ELF import slots - #2149

Open
phix33 wants to merge 1 commit into
Noelo-Lab:mainfrom
phix33:fix/got-call-noreturn-propagation
Open

phix33 wants to merge 1 commit into
Noelo-Lab:mainfrom
phix33:fix/got-call-noreturn-propagation

Conversation

@phix33

@phix33 phix33 commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Reproduce

When a hidden wrapper calls exit through the GOT, Kuna can follow the caller past the end of its function.

cat > die.c <<'SRC'
void exit(int) __attribute__((noreturn));
int seen;
__attribute__((noinline, visibility("hidden"))) void die(void) { exit(1); }
int f(int x) { if (x) die(); seen = x; return x + 1; }
SRC
gcc -O2 -fPIC -fno-plt -c die.c
gcc -shared -nostdlib -o die.so die.o
kuna decompile die.so f
  die();
  halt_missing(); // warn: Function flow reaches unmapped memory: r0x0000103c flows to r0x00001041

Fix

  • Follow an x86 call or tail jump through a protected ELF import slot when the operand identifies that slot. An overridable definition keeps its name and its caller's continuation.
  • End a SysV AMD64 error call when a single reaching definition proves a nonzero 32-bit status. Apply the fact to that call site so the caller retains its return type.

Tests

The wrapper now ends at die(). Tests cover GOT and PLT calls, writable slots, an interposed function that returns, zero and clobbered status values, the i386 stack ABI, and a returning ARM callback.

Model: openai/gpt-6.2-astra

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant