* [PATCH 0/3] mips{,64,n32}: Call exit on return from fn in __clone
@ 2018-08-15 17:46 Segev Finer
2018-08-15 17:46 ` [PATCH 1/3] mips: " Segev Finer
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Segev Finer @ 2018-08-15 17:46 UTC (permalink / raw)
To: musl
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.
I only tested MIPS O32.
Segev Finer (3):
mips: Call exit on return from fn in __clone
mips64: Call exit on return from fn in __clone
mipsn32: Call exit on return from fn in __clone
src/thread/mips/clone.s | 5 ++++-
src/thread/mips64/clone.s | 5 ++++-
src/thread/mipsn32/clone.s | 5 ++++-
3 files changed, 12 insertions(+), 3 deletions(-)
--
2.18.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] mips: Call exit on return from fn in __clone
2018-08-15 17:46 [PATCH 0/3] mips{,64,n32}: Call exit on return from fn in __clone Segev Finer
@ 2018-08-15 17:46 ` Segev Finer
2018-08-15 17:46 ` [PATCH 2/3] mips64: " Segev Finer
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Segev Finer @ 2018-08-15 17:46 UTC (permalink / raw)
To: musl
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.
---
src/thread/mips/clone.s | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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
--
2.18.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/3] mips64: Call exit on return from fn in __clone
2018-08-15 17:46 [PATCH 0/3] mips{,64,n32}: Call exit on return from fn in __clone Segev Finer
2018-08-15 17:46 ` [PATCH 1/3] mips: " Segev Finer
@ 2018-08-15 17:46 ` Segev Finer
2018-08-15 17:46 ` [PATCH 3/3] mipsn32: " Segev Finer
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Segev Finer @ 2018-08-15 17:46 UTC (permalink / raw)
To: musl
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.
---
src/thread/mips64/clone.s | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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
--
2.18.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/3] mipsn32: Call exit on return from fn in __clone
2018-08-15 17:46 [PATCH 0/3] mips{,64,n32}: Call exit on return from fn in __clone Segev Finer
2018-08-15 17:46 ` [PATCH 1/3] mips: " Segev Finer
2018-08-15 17:46 ` [PATCH 2/3] mips64: " Segev Finer
@ 2018-08-15 17:46 ` Segev Finer
2018-08-16 22:08 ` [PATCH 0/3] mips{,64,n32}: " Szabolcs Nagy
2018-08-16 23:11 ` Rich Felker
4 siblings, 0 replies; 6+ messages in thread
From: Segev Finer @ 2018-08-15 17:46 UTC (permalink / raw)
To: musl
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.
---
src/thread/mipsn32/clone.s | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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
--
2.18.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] mips{,64,n32}: Call exit on return from fn in __clone
2018-08-15 17:46 [PATCH 0/3] mips{,64,n32}: Call exit on return from fn in __clone Segev Finer
` (2 preceding siblings ...)
2018-08-15 17:46 ` [PATCH 3/3] mipsn32: " Segev Finer
@ 2018-08-16 22:08 ` Szabolcs Nagy
2018-08-16 23:11 ` Rich Felker
4 siblings, 0 replies; 6+ messages in thread
From: Szabolcs Nagy @ 2018-08-16 22:08 UTC (permalink / raw)
To: musl
* Segev Finer <segev208@gmail.com> [2018-08-15 20:46:17 +0300]:
> 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.
>
> I only tested MIPS O32.
>
sounds right to me, it affects users who call raw clone,
the child function used in pthread_create in musl does
not return so conforming posix code is not affected.
> Segev Finer (3):
> mips: Call exit on return from fn in __clone
> mips64: Call exit on return from fn in __clone
> mipsn32: Call exit on return from fn in __clone
>
> src/thread/mips/clone.s | 5 ++++-
> src/thread/mips64/clone.s | 5 ++++-
> src/thread/mipsn32/clone.s | 5 ++++-
> 3 files changed, 12 insertions(+), 3 deletions(-)
>
> --
> 2.18.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] mips{,64,n32}: Call exit on return from fn in __clone
2018-08-15 17:46 [PATCH 0/3] mips{,64,n32}: Call exit on return from fn in __clone Segev Finer
` (3 preceding siblings ...)
2018-08-16 22:08 ` [PATCH 0/3] mips{,64,n32}: " Szabolcs Nagy
@ 2018-08-16 23:11 ` Rich Felker
4 siblings, 0 replies; 6+ messages in thread
From: Rich Felker @ 2018-08-16 23:11 UTC (permalink / raw)
To: musl
On Wed, Aug 15, 2018 at 08:46:17PM +0300, Segev Finer wrote:
> 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.
>
> I only tested MIPS O32.
>
> Segev Finer (3):
> mips: Call exit on return from fn in __clone
> mips64: Call exit on return from fn in __clone
> mipsn32: Call exit on return from fn in __clone
>
> src/thread/mips/clone.s | 5 ++++-
> src/thread/mips64/clone.s | 5 ++++-
> src/thread/mipsn32/clone.s | 5 ++++-
> 3 files changed, 12 insertions(+), 3 deletions(-)
>
> --
> 2.18.0
These look fine, but I'm merging them into one commit. Thanks. Also
noting that the public interface fixed is clone() (vs __clone which is
internal).
Rich
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-08-16 23:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-15 17:46 [PATCH 0/3] mips{,64,n32}: Call exit on return from fn in __clone Segev Finer
2018-08-15 17:46 ` [PATCH 1/3] mips: " Segev Finer
2018-08-15 17:46 ` [PATCH 2/3] mips64: " Segev Finer
2018-08-15 17:46 ` [PATCH 3/3] mipsn32: " Segev Finer
2018-08-16 22:08 ` [PATCH 0/3] mips{,64,n32}: " Szabolcs Nagy
2018-08-16 23:11 ` Rich Felker
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).