diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2024-08-12 04:10:27 +0200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-08-12 16:07:46 -0700 |
| commit | 6d23850108b5d3278f5b1cad395ff8da4fdfebeb (patch) | |
| tree | 7aece37a9bf3c7f8828727e23d6ef6f645a355ea /lib/std/Thread.zig | |
| parent | f988cea825c4b21d0864e7125287b12566079c39 (diff) | |
| download | zig-6d23850108b5d3278f5b1cad395ff8da4fdfebeb.tar.gz zig-6d23850108b5d3278f5b1cad395ff8da4fdfebeb.zip | |
std.Thread: Explain apparently pointless mips instruction in freeAndExit().
https://git.musl-libc.org/cgit/musl/commit/?id=ce3688eca920aa77549323f84e21f33522397115
Diffstat (limited to 'lib/std/Thread.zig')
| -rw-r--r-- | lib/std/Thread.zig | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig index dadf50e5ad..8bd3cd7296 100644 --- a/lib/std/Thread.zig +++ b/lib/std/Thread.zig @@ -1130,6 +1130,10 @@ const LinuxThreadImpl = struct { [len] "r" (self.mapped.len), : "memory" ), + // We set `sp` to the address of the current function as a workaround for a Linux + // kernel bug that caused syscalls to return EFAULT if the stack pointer is invalid. + // The bug was introduced in 46e12c07b3b9603c60fc1d421ff18618241cb081 and fixed in + // 7928eb0370d1133d0d8cd2f5ddfca19c309079d5. .mips, .mipsel => asm volatile ( \\ move $sp, $25 \\ li $2, 4091 # SYS_munmap |
