summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_fork.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r298829pfg2016-05-141-1/+1
| | | | sys/compat/linux*: minor spelling fixes.
* MFC r296501:dchagin2016-03-271-0/+12
| | | | | | 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.
* MFC r288994 (by bdrewery):dchagin2016-01-091-28/+5
| | | | | | | | | | | | | 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.
* MFC r287395 (by trasz):dchagin2016-01-091-1/+21
| | | | | Fixes a panic triggered by threaded Linux applications when running with RACCT/RCTL enabled.
* MFC r283474:dchagin2016-01-091-4/+1
| | | | | | | | | | | | | | | | | | | 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
* MFC r283456:dchagin2016-01-091-4/+4
| | | | Improve ktr(9) records in thread managment code.
* MFC r283450:dchagin2016-01-091-1/+0
| | | | | td_sigmask of a newly created thread copied from td. Remove excess initialization of td_sigmask.
* MFC r283422:dchagin2016-01-091-0/+61
| | | | | | | | | 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.
* MFC r283383:dchagin2016-01-091-70/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* To facillitate Linuxulator merging temporarilly revert r288994 (by bdrewery).dchagin2016-01-091-5/+27
|
* MFC r283370:dchagin2016-01-091-0/+14
| | | | | | | | 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).
* MFC r288994:bdrewery2015-10-211-27/+5
| | | | | Remove redundant RFFPWAIT/vfork(2) handling in Linux fork(2) and clone(2) wrappers.
* Reduce duplication between i386/linux/linux.h and amd64/linux32/linux.hjhb2013-01-291-0/+1
| | | | | | | by moving bits that are MI out into headers in compat/linux. Reviewed by: Chagin Dmitry dmitry | gmail MFC after: 2 weeks
* - >500 static DTrace probes for the linuxulatornetchild2012-05-051-0/+10
| | | | | | | | | | | | | | | | | | - 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).
* Add experimental support for process descriptorsjonathan2011-08-181-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Do not clobber %rdx.dchagin2011-02-201-1/+0
| | | | | 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.
* Slightly rewrite linux_fork:dchagin2011-02-121-13/+6
| | | | | | 1) Remove bogus error checking. 2) A new process exit from kernel through fork_trampoline(), so remove bogus check.
* Remove bogus include <machine/frame.h>dchagin2011-02-121-2/+0
|
* Move linux_clone(), linux_fork(), linux_vfork() to a MI path.dchagin2011-02-121-0/+297
OpenPOWER on IntegriCloud