diff options
author | Segev Finer <segev208@gmail.com> | 2018-08-15 20:46:18 +0300 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2018-08-18 11:22:28 -0400 |
commit | 8b2b61e0001281be0dcd3dedc899bf187172fecb (patch) | |
tree | ba225d879658123fbb313b8a1bcca76b164cc54f /src | |
parent | 91e1e29d6dd92c5e707f05dcc9b2a376b0d8dfa1 (diff) | |
download | musl-8b2b61e0001281be0dcd3dedc899bf187172fecb.tar.gz musl-8b2b61e0001281be0dcd3dedc899bf187172fecb.tar.bz2 musl-8b2b61e0001281be0dcd3dedc899bf187172fecb.tar.xz musl-8b2b61e0001281be0dcd3dedc899bf187172fecb.zip |
mips archs: fix runaway execution if start fn passed to clone returns
Call SYS_exit on return from fn in __clone. This is the expected
behavior of this function. Without this the child task will crash on
return from fn, since it will return to nowhere.
Diffstat (limited to 'src')
-rw-r--r-- | src/thread/mips/clone.s | 5 | ||||
-rw-r--r-- | src/thread/mips64/clone.s | 5 | ||||
-rw-r--r-- | src/thread/mipsn32/clone.s | 5 |
3 files changed, 12 insertions, 3 deletions
diff --git a/src/thread/mips/clone.s b/src/thread/mips/clone.s index 37dddf57..30a0146b 100644 --- a/src/thread/mips/clone.s +++ b/src/thread/mips/clone.s @@ -28,5 +28,8 @@ __clone: nop 1: lw $25, 0($sp) lw $4, 4($sp) - jr $25 + jalr $25 nop + move $4, $2 + li $2, 4001 + syscall diff --git a/src/thread/mips64/clone.s b/src/thread/mips64/clone.s index 229d2677..1b71e07c 100644 --- a/src/thread/mips64/clone.s +++ b/src/thread/mips64/clone.s @@ -26,5 +26,8 @@ __clone: nop 1: ld $25, 0($sp) # function pointer ld $4, 8($sp) # argument pointer - jr $25 # call the user's function + jalr $25 # call the user's function nop + move $4, $2 + li $2, 5058 + syscall diff --git a/src/thread/mipsn32/clone.s b/src/thread/mipsn32/clone.s index 51035852..ebf5dbea 100644 --- a/src/thread/mipsn32/clone.s +++ b/src/thread/mipsn32/clone.s @@ -26,5 +26,8 @@ __clone: nop 1: lw $25, 0($sp) # function pointer lw $4, 4($sp) # argument pointer - jr $25 # call the user's function + jalr $25 # call the user's function nop + move $4, $2 + li $2, 6058 + syscall |