lkml.org 
[lkml]   [2012]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
Subjectvfork() / clone() with pthreads / setuid
From
Hello Kernel experts,

From http://developers.sun.com/solaris/articles/subprocess/subprocess.html
, I am curious to know if the following is already addressed in linux
kernel for vfork() / clone() calls.

The vfork(2) system call was also adopted in the Solaris OS. Much
later, however, when multithreading (MT) became available and widely
used it was discovered that vfork() may introduce a new problem when
the application has multiple threads running: deadlock. The deadlock
can happen due to the dynamic linker ld.so.1 involvement in resolving
the necessary symbols. Particularly, if the child process calls an
external function (such as exec()), the dynamic linker may be invoked
to resolve the Procedure Linkage Table (PLT) entry, for which the
dynamic linker will acquire a mutex lock. This lock may already be
held by a different thread in the parent process. If this happens it
will create a deadlock between the parent and child processes, because
no thread in the parent can run until the child has called exec() or
exit(). As a result, both the parent and the child processes will
hang.


Also, is it allowed to call setuid() after a vfork() or a clone()
before doing execv() so that the executed command can be run as a
different user?


I realize this may not be the right forum for such queries, but looks
like this is not available anywhere.

Regards,
Kernel Rocks.


\
 
 \ /
  Last update: 2012-07-20 23:01    [W:2.060 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site