You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cmd/asm: don't allow writes outside of a function's stack frame #79062
#include "textflag.h"
TEXT ·clobber(SB),NOSPLIT,$8-0
MOVQ $42, 8(SP)
RET
What did you see happen?
It compiles.
What did you expect to see?
I think it shouldn't compile. The function declares an 8 byte stack frame, and that stack write is outside of the declared stack frame. Such a write was the cause of #77250. In that issue, an assembly function overwrote the frame pointer saved at the top of the stack frame, leading to an execution tracer crash when the function returned. The assembler seems to accept any value for the offset of the SP virtual register. I think the same thing might apply to the FP pseudo-register: the function declares the amount of space for arguments and any read outside of that space is probably a bug.
I’d like to investigate implementing this as a vet check, following the triage suggestion. I’ll first look into how SP/FP operands and frame sizes are represented across architectures, and check for potential false positives in existing assembly. Please let me know if there is a preferred analyzer or scope.
Activity
gabyhelp commentedon Apr 30, 2026
Related Issues
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
dmitshur commentedon May 6, 2026
CC @golang/compiler.
From triage, we think this probably cannot be made to fail to compile, but instead can be a vet check.
123kaze commentedon Jul 21, 2026
I’d like to investigate implementing this as a vet check, following the triage suggestion. I’ll first look into how SP/FP operands and frame sizes are represented across architectures, and check for potential false positives in existing assembly. Please let me know if there is a preferred analyzer or scope.