News for hackers. Stuff that matters.
Re:We found a bug in Go's ARM64 compiler by rcxdude on Wednesday October 08, 2025 @01:20PM (#45518439)
Did you compile with optimisations? I think GCC will do a bunch of activity on the stack with -O0, but it'll generally coalesce everything into one push/pop per function with optimisations (not because of any rule, but just because it's faster). alloca and other dynamic stack allocation may break this, but normal variables should in pretty much all just get turned into one block on the stack (with appropriate re-use of space if variable lifetimes don't overlap)
Re:We found a bug in Go's ARM64 compiler by Neywiny on Wednesday October 08, 2025 @03:36PM (#45519780)
Yes
Re:We found a bug in Go's ARM64 compiler by ori_b on Wednesday October 08, 2025 @07:42PM (#45521888)
It will generate code to touch each page of the stack, because otherwise a very large stack allocation controlled by users (eg, in the case of a variable sized array) can be turned into a pointer to any location in memory by an attacker. Faulting in each page of the stack turns that into a crash.

There was a userspace thread library I came across a long time ago that used variable length arrays to switch between thread stacks; the scheduler would allocate an array of the right size to bump the stack pointer to the different thread's stack.

Re:We found a bug in Go's ARM64 compiler by saagarjha on Wednesday October 08, 2025 @10:40PM (#45522932)
Wow, that’s horrible.
Re:We found a bug in Go's ARM64 compiler by i80and on Thursday October 09, 2025 @12:10PM (#45529681)
The engineers were so preoccupied with whether or not they could that they didn't stop to think if they should