diff options
author | Rich Felker <dalias@aerifal.cx> | 2013-09-16 11:52:39 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2013-09-16 11:52:39 -0400 |
commit | cffb9e1ee2a5e8925845f0c9b79cb6c80487302c (patch) | |
tree | 06f35ba78ab45c5b209398aa0b0ef036d487fa6b | |
parent | 90710df5ccd405743d570dcb255fc28d952ba651 (diff) | |
download | musl-cffb9e1ee2a5e8925845f0c9b79cb6c80487302c.tar.gz musl-cffb9e1ee2a5e8925845f0c9b79cb6c80487302c.tar.bz2 musl-cffb9e1ee2a5e8925845f0c9b79cb6c80487302c.tar.xz musl-cffb9e1ee2a5e8925845f0c9b79cb6c80487302c.zip |
fix clobbering of caller's stack in mips __clone function
this was resulting in crashes in posix_spawn on mips, and would have
affected applications calling clone too. since the prototype for
__clone has it as a variadic function, it may not assume that 16($sp)
is writable for use in making the syscall. instead, it needs to
allocate additional stack space, and then adjust the stack pointer
back in both of the code paths for the parent process/thread.
-rw-r--r-- | src/thread/mips/clone.s | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/thread/mips/clone.s b/src/thread/mips/clone.s index 6c2e7908..37dddf57 100644 --- a/src/thread/mips/clone.s +++ b/src/thread/mips/clone.s @@ -12,15 +12,18 @@ __clone: lw $6, 16($sp) lw $7, 20($sp) lw $9, 24($sp) + subu $sp, $sp, 16 sw $9, 16($sp) li $2, 4120 syscall beq $7, $0, 1f nop + addu $sp, $sp, 16 jr $ra subu $2, $0, $2 1: beq $2, $0, 1f nop + addu $sp, $sp, 16 jr $ra nop 1: lw $25, 0($sp) |