authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-08-09 03:49:05+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-08-09 17:53:03+02:00
logf0292b57033ce2063c51f01fcd24937b81eb3699
tree844951ae8b0876d55376127c24de0047446d7ad2
parent516040582da20208d2026996c0ca9cf4c1fc20be
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.Thread: remove mips o32 workaround in LinuxThreadImpl.freeAndExit()

Our minimum kernel version was released several years after this kernel bug was fixed. On top of that, it's a hacky workaround that depends on abicalls to work. Well past time to get rid of it.

1 files changed, 0 insertions(+), 5 deletions(-)

lib/std/Thread.zig-5
...@@ -1275,12 +1275,7 @@ const LinuxThreadImpl = struct {...@@ -1275,12 +1275,7 @@ const LinuxThreadImpl = struct {
1275 : [ptr] "{r5}" (@intFromPtr(self.mapped.ptr)),1275 : [ptr] "{r5}" (@intFromPtr(self.mapped.ptr)),
1276 [len] "{r6}" (self.mapped.len),1276 [len] "{r6}" (self.mapped.len),
1277 ),1277 ),
1278 // We set `sp` to the address of the current function as a workaround for a Linux
1279 // kernel bug that caused syscalls to return EFAULT if the stack pointer is invalid.
1280 // The bug was introduced in 46e12c07b3b9603c60fc1d421ff18618241cb081 and fixed in
1281 // 7928eb0370d1133d0d8cd2f5ddfca19c309079d5.
1282 .mips, .mipsel => asm volatile (1278 .mips, .mipsel => asm volatile (
1283 \\ move $sp, $t9
1284 \\ li $v0, 4091 # SYS_munmap1279 \\ li $v0, 4091 # SYS_munmap
1285 \\ syscall1280 \\ syscall
1286 \\ li $v0, 4001 # SYS_exit1281 \\ li $v0, 4001 # SYS_exit