work around mips detached thread exit breakage due to kernel regression
authorRich Felker <dalias@aerifal.cx>
Sat, 20 Jun 2015 02:54:30 +0000 (02:54 +0000)
committerRich Felker <dalias@aerifal.cx>
Sat, 20 Jun 2015 02:54:30 +0000 (02:54 +0000)
linux kernel commit 46e12c07b3b9603c60fc1d421ff18618241cb081 caused
the mips syscall mechanism to fail with EFAULT when the userspace
stack pointer is invalid, breaking __unmapself used for detached
thread exit. the workaround is to set $sp to a known-valid, readable
address, and the simplest one to obtain is the address of the current
function, which is available (per o32 calling convention) in $25.

src/thread/mips/__unmapself.s

index 9aa03712bda91d3ff837742925bf9ad1f6d3fbf8..ba139dc8e7ba8d8672c1261c9391ca9da0f70524 100644 (file)
@@ -2,6 +2,7 @@
 .global __unmapself
 .type   __unmapself,@function
 __unmapself:
+       move $sp, $25
        li $2, 4091
        syscall
        li $4, 0