Browse Source

spawn: allow file actions on no-mmu targets

This allows using posix_spawn to safely implement programs like a shell
on a no-mmu system. Only libc knows enough about how things are actually
working in a multi-threaded program to safely break the rules from POSIX
about what is forbidden to do after calling vfork.

Since we are libc, we know the exact semantics of vfork: that it is in
fact safe to call into execute_file_actions and let it perform the few
syscalls needed to perform file actions as they will not trash any global
state.

Fixes: 0dcf66744 ("librt: add posix_spawn support")
Signed-off-by: Charles Mirabile <cmirabil@redhat.com>
Charles Mirabile 4 weeks ago
parent
commit
3cbabab39c
1 changed files with 1 additions and 1 deletions
  1. 1 1
      librt/spawn.c

+ 1 - 1
librt/spawn.c

@@ -120,7 +120,7 @@ __spawni(pid_t *pid, const char *file,
 	short int flags = attrp ? attrp->__flags : 0;
 
 	pid_t new_pid;
-	if (is_vfork_safe(flags) && !fa)
+	if (is_vfork_safe(flags))
 		new_pid = vfork();
 	else {
 #ifdef __ARCH_USE_MMU__