History log of /freebsd-13.1/sys/compat/linux/linux_fork.c (Results 1 – 25 of 37)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: release/12.4.0, release/13.1.0, release/12.3.0
# df674da4 01-Jul-2021 Konstantin Belousov <[email protected]>

cloudabi and linux ABIs: do not call umtx_thread_cleanup() from thr_exit syscall

(cherry picked from commit 747a6b7ace3dd9401289bde8c4e7fc91b8dc18dc)


Revision tags: release/13.0.0
# f9d59088 18-Mar-2021 John Baldwin <[email protected]>

Rename linux_set_upcall_kse() to linux_set_upcall().

This matches the rename of cpu_set_upcall_kse() in
5c2cf818454375536fda522ba83cf67c50929e6b.

Sponsored by: DARPA

(cherry picked from commit 3b5

Rename linux_set_upcall_kse() to linux_set_upcall().

This matches the rename of cpu_set_upcall_kse() in
5c2cf818454375536fda522ba83cf67c50929e6b.

Sponsored by: DARPA

(cherry picked from commit 3b57ddb029daf225a8385dade491019269da82e8)

show more ...


# f8f74aaa 17-Nov-2020 Conrad Meyer <[email protected]>

linux(4) clone(2): Correctly handle CLONE_FS and CLONE_FILES

The two flags are distinct and it is impossible to correctly handle clone(2)
without the assistance of fork1(). This change depends on t

linux(4) clone(2): Correctly handle CLONE_FS and CLONE_FILES

The two flags are distinct and it is impossible to correctly handle clone(2)
without the assistance of fork1(). This change depends on the pwddesc split
introduced in r367777.

I've added a fork_req flag, FR2_SHARE_PATHS, which indicates that p_pd
should be treated the opposite way p_fd is (based on RFFDG flag). This is a
little ugly, but the benefit is that existing RFFDG API is preserved.
Holding FR2_SHARE_PATHS disabled, RFFDG indicates both p_fd and p_pd are
copied, while !RFFDG indicates both should be cloned.

In Chrome, clone(2) is used with CLONE_FS, without CLONE_FILES, and expects
independent fd tables.

The previous conflation of CLONE_FS and CLONE_FILES was introduced in
r163371 (2006).

Discussed with: markj, trasz (earlier version)
Differential Revision: https://reviews.freebsd.org/D27016

show more ...


Revision tags: release/12.2.0
# 1a180032 01-Sep-2020 Mateusz Guzik <[email protected]>

compat: clean up empty lines in .c and .h files


# d9565182 17-Aug-2020 Mark Johnston <[email protected]>

Remove "emulation" of clone(CLONE_PARENT | CLONE_THREAD).

On Linux this is supposed to result in EINVAL.

Reported by: syzkaller
MFC after: 1 week
Sponsored by: The FreeBSD Foundation


Revision tags: release/11.4.0
# 61a74c5c 15-Dec-2019 Jeff Roberson <[email protected]>

schedlock 1/4

Eliminate recursion from most thread_lock consumers. Return from
sched_add() without the thread_lock held. This eliminates unnecessary
atomics and lock word loads as well as reducing

schedlock 1/4

Eliminate recursion from most thread_lock consumers. Return from
sched_add() without the thread_lock held. This eliminates unnecessary
atomics and lock word loads as well as reducing the hold time for
scheduler locks. This will eventually allow for lockless remote adds.

Discussed with: kib
Reviewed by: jhb
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D22626

show more ...


Revision tags: release/12.1.0, release/11.3.0
# c5156c77 13-May-2019 Dmitry Chagin <[email protected]>

Linuxulator depends on a fundamental kernel settings such as SMP. Many
of them listed in opt_global.h which is not generated while building
modules outside of a kernel and such modules never match re

Linuxulator depends on a fundamental kernel settings such as SMP. Many
of them listed in opt_global.h which is not generated while building
modules outside of a kernel and such modules never match real cofigured
kernel.

So, we should prevent our users from building obviously defective modules.

Therefore, remove the root cause of the building of modules outside of a
kernel - the possibility of building modules with DEBUG or KTR flags.
And remove all of DEBUG printfs as it is incomplete and in threaded
programms not informative, also a half of system call does not have DEBUG
printf. For debuging Linux programms we have dtrace, ktr and ktrace ability.

PR: 222861
Reviewed by: trasz
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20178

show more ...


# 803fff90 24-Mar-2019 Dmitry Chagin <[email protected]>

Whitespace cleanup (annoying).

MFC after: 1 month


Revision tags: release/12.0.0
# 2c054ce9 16-Nov-2018 Mateusz Guzik <[email protected]>

proc: always store parent pid in p_oppid

Doing so removes the dependency on proctree lock from sysctl process list
export which further reduces contention during poudriere -j 128 runs.

Reviewed by:

proc: always store parent pid in p_oppid

Doing so removes the dependency on proctree lock from sysctl process list
export which further reduces contention during poudriere -j 128 runs.

Reviewed by: kib (previous version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17825

show more ...


Revision tags: release/11.2.0
# 31665c1a 21-Jun-2018 Konstantin Belousov <[email protected]>

linux_clone_thread: mark new thread as TDB_BORN.

So that the ptrace code will catch it and report it to attached
debugger. Enables debugging of threaded Linux binaries with FreeBSD
debugger.

Submi

linux_clone_thread: mark new thread as TDB_BORN.

So that the ptrace code will catch it and report it to attached
debugger. Enables debugging of threaded Linux binaries with FreeBSD
debugger.

Submitted by: Yanko Yankulov <[email protected]>
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D15880

show more ...


# 931e2a1a 15-Jun-2018 Ed Maste <[email protected]>

linuxulator: do not include legacy syscalls on arm64

Existing linuxulator platforms (i386, amd64) support legacy syscalls,
such as non-*at ones like open, but arm64 and other new platforms do
not.

linuxulator: do not include legacy syscalls on arm64

Existing linuxulator platforms (i386, amd64) support legacy syscalls,
such as non-*at ones like open, but arm64 and other new platforms do
not.

Wrap these in #ifdef LINUX_LEGACY_SYSCALLS, #defined in the MD linux.h
files. We may need finer grained control in the future but this is
sufficient for now.

Reviewed by: andrew
Sponsored by: Turing Robotic Industries
Differential Revision: https://reviews.freebsd.org/D15237

show more ...


# 132f90c6 05-Feb-2018 Ed Maste <[email protected]>

Linuxolator whitespace cleanup

A version of each of the MD files by necessity exists for each CPU
architecture supported by the Linuxolator. Clean these up so that new
architectures do not inherit

Linuxolator whitespace cleanup

A version of each of the MD files by necessity exists for each CPU
architecture supported by the Linuxolator. Clean these up so that new
architectures do not inherit whitespace issues.

Clean up shared Linuxolator files while here.

Sponsored by: Turing Robotic Industries Inc.

show more ...


# 7f2d13d6 27-Nov-2017 Pedro F. Giffuni <[email protected]>

sys/compat: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - er

sys/compat: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

show more ...


Revision tags: release/10.4.0, release/11.1.0, release/11.0.1, release/11.0.0
# 5c2cf818 16-Jun-2016 Konstantin Belousov <[email protected]>

Update comments for the MD functions managing contexts for new
threads, to make it less confusing and using modern kernel terms.

Rename the functions to reflect current use of the functions, instead

Update comments for the MD functions managing contexts for new
threads, to make it less confusing and using modern kernel terms.

Rename the functions to reflect current use of the functions, instead
of the historic KSE conventions:
cpu_set_fork_handler -> cpu_fork_kthread_handler (for kthreads)
cpu_set_upcall -> cpu_copy_thread (for forks)
cpu_set_upcall_kse -> cpu_set_upcall (for new threads creation)

Reviewed by: jhb (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Approved by: re (hrs)
Differential revision: https://reviews.freebsd.org/D6731

show more ...


# 2a339d9e 17-May-2016 Konstantin Belousov <[email protected]>

Add implementation of robust mutexes, hopefully close enough to the
intention of the POSIX IEEE Std 1003.1TM-2008/Cor 1-2013.

A robust mutex is guaranteed to be cleared by the system upon either
thr

Add implementation of robust mutexes, hopefully close enough to the
intention of the POSIX IEEE Std 1003.1TM-2008/Cor 1-2013.

A robust mutex is guaranteed to be cleared by the system upon either
thread or process owner termination while the mutex is held. The next
mutex locker is then notified about inconsistent mutex state and can
execute (or abandon) corrective actions.

The patch mostly consists of small changes here and there, adding
neccessary checks for the inconsistent and abandoned conditions into
existing paths. Additionally, the thread exit handler was extended to
iterate over the userspace-maintained list of owned robust mutexes,
unlocking and marking as terminated each of them.

The list of owned robust mutexes cannot be maintained atomically
synchronous with the mutex lock state (it is possible in kernel, but
is too expensive). Instead, for the duration of lock or unlock
operation, the current mutex is remembered in a special slot that is
also checked by the kernel at thread termination.

Kernel must be aware about the per-thread location of the heads of
robust mutex lists and the current active mutex slot. When a thread
touches a robust mutex for the first time, a new umtx op syscall is
issued which informs about location of lists heads.

The umtx sleep queues for PP and PI mutexes are split between
non-robust and robust.

Somewhat unrelated changes in the patch:
1. Style.
2. The fix for proper tdfind() call use in umtxq_sleep_pi() for shared
pi mutexes.
3. Removal of the userspace struct pthread_mutex m_owner field.
4. The sysctl kern.ipc.umtx_vnode_persistent is added, which controls
the lifetime of the shared mutex associated with a vnode' page.

Reviewed by: jilles (previous version, supposedly the objection was fixed)
Discussed with: brooks, Martin Simmons <[email protected]> (some aspects)
Tested by: pho
Sponsored by: The FreeBSD Foundation

show more ...


# 1ce4275d 30-Apr-2016 Pedro F. Giffuni <[email protected]>

sys/compat/linux*: spelling fixes.

Mostly on comments but there are some user-visible messages as well.

MFC after: 2 weeks


Revision tags: release/10.3.0
# 9f4e66af 08-Mar-2016 Dmitry Chagin <[email protected]>

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 after: 1 week


# 33fd9b9a 04-Feb-2016 Mateusz Guzik <[email protected]>

fork: pass arguments to fork1 in a dedicated structure

Suggested by: kib


# a7306730 07-Oct-2015 Bryan Drewery <[email protected]>

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.

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.

Reviewed by: jhb, kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D3828

show more ...


# 089d3293 02-Sep-2015 Edward Tomasz Napierala <[email protected]>

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

Reviewed by: ngie@, ed@
Tested by: Larry Rosenman <[email protected]>
MFC after: 1 month
Sponsored by: The F

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

Reviewed by: ngie@, ed@
Tested by: Larry Rosenman <[email protected]>
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3470

show more ...


Revision tags: release/10.2.0
# 367a13f9 31-Jul-2015 Ed Schouten <[email protected]>

Limit rights on process descriptors.

On CloudABI, the rights bits returned by cap_rights_get() match up with
the operations that you can actually perform on the file descriptor.

Limiting the rights

Limit rights on process descriptors.

On CloudABI, the rights bits returned by cap_rights_get() match up with
the operations that you can actually perform on the file descriptor.

Limiting the rights is good, because it makes it easier to get uniform
behaviour across different operating systems. If process descriptors on
FreeBSD would suddenly gain support for any new file operation, this
wouldn't become exposed to CloudABI processes without first extending
the rights.

Extend fork1() to gain a 'struct filecaps' argument that allows you to
construct process descriptors with custom rights. Use this in
cloudabi_sys_proc_fork() to limit the rights to just fstat() and
pdwait().

Obtained from: https://github.com/NuxiNL/freebsd

show more ...


# b4490c6e 18-Jul-2015 Konstantin Belousov <[email protected]>

The si_status field of the siginfo_t, provided by the waitid(2) and
SIGCHLD signal, should keep full 32 bits of the status passed to the
_exit(2).

Split the combined p_xstat of the struct proc into

The si_status field of the siginfo_t, provided by the waitid(2) and
SIGCHLD signal, should keep full 32 bits of the status passed to the
_exit(2).

Split the combined p_xstat of the struct proc into the separate exit
status p_xexit for normal process exit, and signalled termination
information p_xsig. Kernel-visible macro KW_EXITCODE() reconstructs
old p_xstat from p_xexit and p_xsig. p_xexit contains complete status
and copied out into si_status.

Requested by: Joerg Schilling
Reviewed by: jilles (previous version), pho
Tested by: pho
Sponsored by: The FreeBSD Foundation

show more ...


# 6871c7c3 10-Jun-2015 Mateusz Guzik <[email protected]>

linux: make sure to grab all cow structs when creating a thread

This is a fixup for r284214.

Reported and tested by: Ivan Klymenko <fidaj ukr.net>


# 4ab7403b 24-May-2015 Dmitry Chagin <[email protected]>

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 b

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

show more ...


# 7d96520b 24-May-2015 Dmitry Chagin <[email protected]>

Improve ktr(9) records in thread managment code.

Differential Revision: https://reviews.freebsd.org/D1464
Reviewed by: trasz


12