Opened 12 months ago
Last modified 6 weeks ago
#18665 reopened enhancement
execve called from non main thread result in error.
Reported by: | Anarchos | Owned by: | nobody |
---|---|---|---|
Priority: | low | Milestone: | Unscheduled |
Component: | System/Kernel | Version: | R1/Development |
Keywords: | team execve exec_team | Cc: | |
Blocked By: | Blocking: | ||
Platform: | All |
Description
I encounter this one while using the ocaml package manager to install some package:
strace -a ~/.opam/4.14.2+trunk/bin/dune exec -p lwt src/unix/config/discover.exe -- --save --use-libev true
==> [ 82079] exec = 0x8000000f Operation not allowed (22 us) Error: execve(./_build/default/src/unix/config/discover.exe): Operation not allowed
It seems exec_team() is called from non main thread.
I tried to submit a patch to that effect https://review.haiku-os.org/c/haiku/+/7105, but after discussion with waddlesplash, the best solution would be to change the main thread , and not steal its id. This is way before my head.
Change History (5)
comment:1 by , 12 months ago
comment:3 by , 3 months ago
Resolution: | → no change required |
---|---|
Status: | new → closed |
comment:4 by , 6 weeks ago
Resolution: | no change required |
---|---|
Status: | closed → reopened |
Wether this is really needed or not by an application, POSIX does not disallow to call execve from a thread, so we should implement it
comment:5 by , 6 weeks ago
Source code involved : https://github.com/haiku/haiku/blob/master/src/system/kernel/team.cpp#L1988
Linux does the following: the main (leader) thread is terminated, and the non-main thread assumes its identity: https://elixir.bootlin.com/linux/v6.6/source/fs/exec.c#L1081