https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128367

--- Comment #2 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
The bare ret is intentional; putting int3 after it breaks
-fsplit-stack.

__morestack never returns to that ret.  It resumes the function at
the instruction right after it, by computing return address + 1
(ret) or + 3 (ret $N, ia32): see "incq %r10  # to skip the ret
instruction" and "incq 8(%rsp)" in libgcc/config/i386/morestack.S.
That slot is the resume point, which is also why -fcf-protection
puts an ENDBR there (PR85388).

With int3 added after that ret, the testcase plus a recursive
driver that forces a stack split dies with SIGTRAP on the first
split; unchanged, it runs fine.

There is no SLS exposure either: what follows this ret is the
function's own continuation, which __morestack calls right
afterwards anyway.

I think this can be closed as INVALID.  A comment on
split_stack_return saying why it must stay a bare ret would help.

(Analysis and conclusion by Claude Opus 5.5.)

Reply via email to