History log of /freebsd-10-stable/sys/compat/linux/linux_fork.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 299705 13-May-2016 pfg

MFC r298829
sys/compat/linux*: minor spelling fixes.


# 297305 27-Mar-2016 dchagin

MFC r296501:

Link the newly created process to the corresponding parent as
if CLONE_PARENT is set, then the parent of the new process will be
the same as that of the calling process.


# 293608 09-Jan-2016 dchagin

MFC r288994 (by bdrewery):

Remove redundant RFFPWAIT/vfork(2) handling in Linux fork(2) and clone(2) wrappers.

r161611 added some of the code from sys_vfork() directly into the Linux
module wrappers since they use RFSTOPPED. In r232240, the RFFPWAIT handling
was moved to syscallret(), thus this code in the Linux module is no longer
needed as it will be called later.

This also allows the Linux wrappers to benefit from the fix in r275616 for
threads not getting suspended if their vforked child is stopped while they
wait on them.


# 293607 09-Jan-2016 dchagin

MFC r287395 (by trasz):

Fixes a panic triggered by threaded Linux applications when running
with RACCT/RCTL enabled.


# 293575 09-Jan-2016 dchagin

MFC r283474:

Rework signal code to allow using it by other modules, like linprocfs:

1. Linux sigset always 64 bit on all platforms. In order to move Linux
sigset code to the linux_common module define it as 64 bit int. Move
Linux sigset manipulation routines to the MI path.

2. Move Linux signal number definitions to the MI path. In general, they
are the same on all platforms except for a few signals.

3. Map Linux RT signals to the FreeBSD RT signals and hide signal conversion
tables to avoid conversion errors.

4. Emulate Linux SIGPWR signal via FreeBSD SIGRTMIN signal which is outside
of allowed on Linux signal numbers.

PR: 197216


# 293560 09-Jan-2016 dchagin

MFC r283456:

Improve ktr(9) records in thread managment code.


# 293554 09-Jan-2016 dchagin

MFC r283450:

td_sigmask of a newly created thread copied from td.
Remove excess initialization of td_sigmask.


# 293528 09-Jan-2016 dchagin

MFC r283422:

Refund the proc emuldata struct for future use. For now move flags from
thread emuldata to proc emuldata as it was originally intended.

As we can have both 64 & 32 bit Linuxulator running any eventhandler
can be called twice for us. To prevent this move eventhandlers code
from linux_emul.c to the linux_common.ko module.


# 293493 09-Jan-2016 dchagin

MFC r283383:

Switch linuxulator to use the native 1:1 threads.

The reasons:
1. Get rid of the stubs/quirks with process dethreading,
process reparent when the process group leader exits and close
to this problems on wait(), waitpid(), etc.
2. Reuse our kernel code instead of writing excessive thread
managment routines in Linuxulator.

Implementation details:

1. The thread is created via kern_thr_new() in the clone() call with
the CLONE_THREAD parameter. Thus, everything else is a process.
2. The test that the process has a threads is done via P_HADTHREADS
bit p_flag of struct proc.
3. Per thread emulator state data structure is now located in the
struct thread and freed in the thread_dtor() hook.
Mandatory holdig of the p_mtx required when referencing emuldata
from the other threads.
4. PID mangling has changed. Now Linux pid is the native tid
and Linux tgid is the native pid, with the exception of the first
thread in the process where tid and pid are one and the same.

Ugliness:

In case when the Linux thread is the initial thread in the thread
group thread id is equal to the process id. Glibc depends on this
magic (assert in pthread_getattr_np.c). So for system calls that
take thread id as a parameter we should use the special method
to reference struct thread.


# 293492 09-Jan-2016 dchagin

To facillitate Linuxulator merging temporarilly revert r288994 (by bdrewery).


# 293478 09-Jan-2016 dchagin

MFC r283370:

In preparation for switching linuxulator to the use the native 1:1
threads introduce linux_exit() stub instead of sys_exit() call
(which terminates process).
In the new linuxulator exit() system call terminates the calling
thread (not a whole process).


# 289672 20-Oct-2015 bdrewery

MFC r288994:

Remove redundant RFFPWAIT/vfork(2) handling in Linux fork(2) and clone(2)
wrappers.


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 246085 29-Jan-2013 jhb

Reduce duplication between i386/linux/linux.h and amd64/linux32/linux.h
by moving bits that are MI out into headers in compat/linux.

Reviewed by: Chagin Dmitry dmitry | gmail
MFC after: 2 weeks


# 235063 05-May-2012 netchild

- >500 static DTrace probes for the linuxulator
- DTrace scripts to check for errors, performance, ...
they serve mostly as examples of what you can do with the static probe;s
with moderate load the scripts may be overwhelmed, excessive lock-tracing
may influence program behavior (see the last design decission)

Design decissions:
- use "linuxulator" as the provider for the native bitsize; add the
bitsize for the non-native emulation (e.g. "linuxuator32" on amd64)
- Add probes only for locks which are acquired in one function and released
in another function. Locks which are aquired and released in the same
function should be easy to pair in the code, inter-function
locking is more easy to verify in DTrace.
- Probes for locks should be fired after locking and before releasing to
prevent races (to provide data/function stability in DTrace, see the
man-page of "dtrace -v ..." and the corresponding DTrace docs).


# 224987 18-Aug-2011 jonathan

Add experimental support for process descriptors

A "process descriptor" file descriptor is used to manage processes
without using the PID namespace. This is required for Capsicum's
Capability Mode, where the PID namespace is unavailable.

New system calls pdfork(2) and pdkill(2) offer the functional equivalents
of fork(2) and kill(2). pdgetpid(2) allows querying the PID of the remote
process for debugging purposes. The currently-unimplemented pdwait(2) will,
in the future, allow querying rusage/exit status. In the interim, poll(2)
may be used to check (and wait for) process termination.

When a process is referenced by a process descriptor, it does not issue
SIGCHLD to the parent, making it suitable for use in libraries---a common
scenario when using library compartmentalisation from within large
applications (such as web browsers). Some observers may note a similarity
to Mach task ports; process descriptors provide a subset of this behaviour,
but in a UNIX style.

This feature is enabled by "options PROCDESC", but as with several other
Capsicum kernel features, is not enabled by default in GENERIC 9.0.

Reviewed by: jhb, kib
Approved by: re (kib), mentor (rwatson)
Sponsored by: Google Inc


# 218879 20-Feb-2011 dchagin

Do not clobber %rdx.
Before calling vfork() syscall the linux user-space stores the current PID
in the %rdx and restore it when the parent process will leave the kernel.


# 218618 12-Feb-2011 dchagin

Slightly rewrite linux_fork:

1) Remove bogus error checking.
2) A new process exit from kernel through fork_trampoline(),
so remove bogus check.


# 218617 12-Feb-2011 dchagin

Remove bogus include <machine/frame.h>


# 218616 12-Feb-2011 dchagin

Move linux_clone(), linux_fork(), linux_vfork() to a MI path.