History log of /openbsd-src/sys/kern/sys_process.c (Results 1 – 25 of 105)
Revision Date Author Comments
# 0a766465 15-Dec-2024 mvs <mvs@openbsd.org>

Unlock KERN_GLOBAL_PTRACE. `global_ptrace' is atomically accessed
boolean integer. Only ptrace_ctrl() loads it once outside sysctl(2)
layer.

ok mpi


# 4fda2ec5 27-Nov-2024 jsg <jsg@openbsd.org>

remove unneeded fpu.h include to unbreak the build on archs without it
already indirectly included by reg.h on amd64
ok sthen@


# deef986e 27-Nov-2024 anton <anton@openbsd.org>

Add ptrace commands used to read/write the XSAVE area of a traced
process. Intended to give debuggers access to xmm/ymm registers.

Inspired by FreeBSD which exposes a similar set of ptrace commands.

Add ptrace commands used to read/write the XSAVE area of a traced
process. Intended to give debuggers access to xmm/ymm registers.

Inspired by FreeBSD which exposes a similar set of ptrace commands.

ok kettenis@

show more ...


# e2eb29b0 08-Oct-2024 claudio <claudio@openbsd.org>

Replace ps_oppid (old parent pid) with ps_opptr (a pointer to the old parent process struct).

This simplifies some code and removes the no need to call prfind in
process_untrace().
OK mpi@


# 56128702 08-Oct-2024 claudio <claudio@openbsd.org>

Adjust lock requirements for ps_pptr, ps_ppid and ps_oppid.

ps_pptr, ps_ppid and ps_oppid require the KERNEL_LOCK and the process mutex
to be modified. At the same time either KERNEL_LOCK or process

Adjust lock requirements for ps_pptr, ps_ppid and ps_oppid.

ps_pptr, ps_ppid and ps_oppid require the KERNEL_LOCK and the process mutex
to be modified. At the same time either KERNEL_LOCK or process mutex needs
to be taken to read the values.

This is needed to further unlock ptsignal().
OK kettenis@, mvs@

show more ...


# 67526adf 01-Oct-2024 claudio <claudio@openbsd.org>

Adjust ptrace interface to properly suport single threaded continue.

Introduce P_TRACESINGLE flag to instruct the trapped thread to not
wakeup the other threads (via single_thread_clear). This must

Adjust ptrace interface to properly suport single threaded continue.

Introduce P_TRACESINGLE flag to instruct the trapped thread to not
wakeup the other threads (via single_thread_clear). This must be done
like this since ptrace must wake just the single thread to ensure it
runs first and gets the ps_xsig value from ptrace.

Modern gdb depends on this for multi-threaded processes, when a breakpoint
is hit gdb fixes up the trapping instruction and then single steps over
it with only that thread. After that single step gdb continues with all
threads. If all threads are run like now it is possible that one of the
other threads hits a breakpoint before the single step is done which results
in an assertion in gdb (because that is not expected).
OK mpi@

show more ...


# 51c8e26b 30-Sep-2024 claudio <claudio@openbsd.org>

Use ps_ppid instead of ps_pptr->ps_pid in all places.
OK mpi@


# a09e9584 03-Jun-2024 claudio <claudio@openbsd.org>

Remove the now unsued s argument to SCHED_LOCK and SCHED_UNLOCK.

The SPL level is not tacked by the mutex and we no longer need to track
this in the callers.
OK miod@ mlarkin@ tb@ jca@


# fc8189af 02-Apr-2024 deraadt <deraadt@openbsd.org>

remove useless whitespace; from Jia Tan


# e1edc428 30-Mar-2024 mpi <mpi@openbsd.org>

Prevent a recursion inside wakeup(9) when scheduler tracepoints are enabled.

Tracepoints like "sched:enqueue" and "sched:unsleep" were called from inside
the loop iterating over sleeping threads as

Prevent a recursion inside wakeup(9) when scheduler tracepoints are enabled.

Tracepoints like "sched:enqueue" and "sched:unsleep" were called from inside
the loop iterating over sleeping threads as part of wakeup_proc(). When such
tracepoints were enabled they could result in another wakeup(9) possibly
corrupting the sleepqueue.

Rewrite wakeup(9) in two stages, first dequeue threads from the sleepqueue then
call setrunnable() and possible tracepoints for each of them.

This requires moving unsleep() outside of setrunnable() because it messes with
the sleepqueue.

ok claudio@

show more ...


# 98b1b78a 21-Nov-2023 bluhm <bluhm@openbsd.org>

Fix kernel build without option PTRACE, but with dt(4).

Since revision 1.26 dt_ioctl_get_auxbase() is calling process_domem().
Build the latter function into kernel if pseudo device dt is enabled.

Fix kernel build without option PTRACE, but with dt(4).

Since revision 1.26 dt_ioctl_get_auxbase() is calling process_domem().
Build the latter function into kernel if pseudo device dt is enabled.

from Matthias Pitzl; OK claudio@

show more ...


# 4171e492 10-Jun-2023 kettenis <kettenis@openbsd.org>

Implement support for pointer authentication (PAC) in userland. With PAC
it is possible to "sign" pointers with a hidden key. The signature is
placed in unused bits of the pointer and can be checke

Implement support for pointer authentication (PAC) in userland. With PAC
it is possible to "sign" pointers with a hidden key. The signature is
placed in unused bits of the pointer and can be checked later. This can
be used to provide "tail CFI" that is similar to what retguard provides.

Debuggers need to be aware of the fact that pointers can be signed. For
this purpose a new PT_PACMASK ptrace(2) request is introduced that returns
as mask that indicates the bits used for the signature. Separate masks
are provided for code and data pointers even though the masks are identical
in the current implementation. These masks are also written into a special
note section in the core dump.

ok patrick@

show more ...


# 50cf6b9c 24-Jan-2023 deraadt <deraadt@openbsd.org>

ptrace reads/writes memory using uvm_io, which generates an temporary
alias mapping using uvm_map_extract. With xonly now operational, this
alias mapping is created with minprot, which for text will

ptrace reads/writes memory using uvm_io, which generates an temporary
alias mapping using uvm_map_extract. With xonly now operational, this
alias mapping is created with minprot, which for text will be xonly, and
the kernel cannot read it (unless the architecture has implied read for
exec from kernel pov).
Pass UVM_IO_FIXPROT to create the alias with maxprot instead.
ok kettenis

show more ...


# c835f76b 02-Jan-2023 guenther <guenther@openbsd.org>

Add tfind_user(), for getting a proc* given a user-space TID and
the process* that it should be part of. Use that in clock_get{time,res}(),
thrkill(), and ptrace().

ok jca@ miod@ mpi@ mvs@


# bcc2e3d7 21-Dec-2022 claudio <claudio@openbsd.org>

The location of the aux info vector is now cached in ps_auxinfo of struct
process. Use this information to access the vector.
OK mpi@ mbuhl@ deraadt@


# 2b46a8cb 05-Dec-2022 deraadt <deraadt@openbsd.org>

zap a pile of dangling tabs


# b702d795 07-Dec-2021 guenther <guenther@openbsd.org>

Continue to delete emulation support: since we're Just ELF, the size
of the auxinfo is fixed: provide ELF_AUX_WORDS in <sys/exec_elf.h>
as a replacement for emul->e_arglen

ok millert@


# 0fbe85fc 10-May-2021 mpi <mpi@openbsd.org>

Revert previous, it introduced a regression with breakpoints in gdb.


# d461369c 06-May-2021 mpi <mpi@openbsd.org>

Refactor routines to stop/unstop processes and save the corresponding signal.

- Move the "hack" involving P_SINTR to avoid grabbing the SCHED_LOCK()
recursively closer to where it is necessary, in p

Refactor routines to stop/unstop processes and save the corresponding signal.

- Move the "hack" involving P_SINTR to avoid grabbing the SCHED_LOCK()
recursively closer to where it is necessary, in proc_stop()

- Introduce proc_unstop(), the symmetric routine to proc_stop(), which
manipulates `ps_xsig' and use it whenever a SSTOPed thread needs to be
awaken.

- Manipulate `ps_xsig' only in proc_stop/unstop()

ok kettenis@

show more ...


# 193f316c 08-Feb-2021 mpi <mpi@openbsd.org>

Revert the convertion of per-process thread into a SMR_TAILQ.

We did not reach a consensus about using SMR to unlock single_thread_set()
so there's no point in keeping this change.


# b21c774f 07-Dec-2020 mpi <mpi@openbsd.org>

Convert the per-process thread list into a SMR_TAILQ.

Currently all iterations are done under KERNEL_LOCK() and therefor use
the *_LOCKED() variant.

From and ok claudio@


# 1df98543 19-Oct-2020 mpi <mpi@openbsd.org>

Serialize accesses to "struct vmspace" and document its refcounting.

The underlying vm_space lock is used as a substitute to the KERNEL_LOCK()
in uvm_grow() to make sure `vm_ssize' is not corrupted.

Serialize accesses to "struct vmspace" and document its refcounting.

The underlying vm_space lock is used as a substitute to the KERNEL_LOCK()
in uvm_grow() to make sure `vm_ssize' is not corrupted.

ok anton@, kettenis@

show more ...


# 8fb2af3a 16-Mar-2020 mpi <mpi@openbsd.org>

Keep track of traced child under a list of orphans while they are being
reparented to a debugger process.

Also re-parent exiting traced processes to their original parent, if it
is still alive, afte

Keep track of traced child under a list of orphans while they are being
reparented to a debugger process.

Also re-parent exiting traced processes to their original parent, if it
is still alive, after the debugger has seen the exit status.

Logic comes from FreeBSD pointed out by guenther@.

While here rename proc_reparent() into process_reparent() and get rid of
superfluous checks.

ok visa@

show more ...


# 381e34d2 11-Dec-2019 guenther <guenther@openbsd.org>

Replace p_xstat with ps_xexit and ps_xsig
Convert those to a consolidated status when needed in wait4(), kevent(),
and sysctl()
Pass exit code and signal separately to exit1()
(This also serves as p

Replace p_xstat with ps_xexit and ps_xsig
Convert those to a consolidated status when needed in wait4(), kevent(),
and sysctl()
Pass exit code and signal separately to exit1()
(This also serves as prep for adding waitid(2))

ok mpi@

show more ...


# 6ea2c94d 29-Nov-2019 mpi <mpi@openbsd.org>

Return EBUSY for successive PT_TRACE_ME calls.

Match FreeBSD and NetBSD.

ok bluhm@, deraadt@, kettenis@


12345