FP exceptions are enabled. fix the kernel emulation of mfmsr and mtmsr
to use the correct opcodes for these instructions. ignore PSL_FE
(the FP enable bit) in the MSR that a user program tries to set,
since it will naturally be set for FP-using processes but
we can't let the user process manage that bit.
Introduce new API for debuggers to allow/prevent execution of the specified
thread.
New ptrace(2) operations:
PT_RESUME Allow execution of a specified thread, change its state
from suspended to continued. The addr argument is unused.
The data argument specifies the LWP ID.
This call is equivalent to _lwp_continue(2) called by a
traced process. This call does not change the general
process state from stopped to continued.
PT_SUSPEND Prevent execution of a specified thread, change its state
from continued to suspended. The addr argument is unused.
The data argument specifies the requested LWP ID.
This call is equivalent to _lwp_suspend(2) called by a
traced process. This call does not change the general
process state from continued to stopped.
This interface is modeled after FreeBSD, however with NetBSD specific arguments
passed to ptrace(2) -- FreeBSD passes only thread id, NetBSD passes process and
thread id.
Extend PT_LWPINFO operation in ptrace(2) to report suspended threads. In the
ptrace_lwpinfo structure in pl_event next to PL_EVENT_NONE and PL_EVENT_SIGNAL
add new value PL_EVENT_SUSPENDED.
Add new errno(2) value EDEADLK that might be returned by ptrace(2). It prevents
dead-locking in a scenario of resuming a process or thread that is prevented
from execution. This fixes bug that old API was vulnerable to this scenario.
Kernel bump delayed till introduction of PT_GETDBREGS/PT_SETDBREGS soon.
Add new ATF tests:
- resume1
Verify that a thread can be suspended by a debugger and later
resumed by the debugger
- suspend1
Verify that a thread can be suspended by a debugger and later
resumed by a tracee
- suspend2
Verify that the while the only thread within a process is
suspended, the whole process cannot be unstopped
Sponsored by <The NetBSD Foundation>
Add new interface to add ability to get/set signal mask of a tracee.
It has been inspired by Linux PTRACE_GETSIGMASK and PTRACE_SETSIGMASK, but
adapted for NetBSD API.
This interface is used for checkpointing software to set/restore context
of a process including signal mask like criu or just to track this property
in reverse-execution software like Record and Replay Framework (rr).
Add new ATF tests for this interface
====================================
getsigmask1:
Verify that plain PT_SET_SIGMASK can be called
getsigmask2:
Verify that PT_SET_SIGMASK reports correct mask from tracee
setsigmask1:
Verify that plain PT_SET_SIGMASK can be called with empty mask
setsigmask2:
Verify that sigmask is preserved between PT_GET_SIGMASK and
PT_SET_SIGMASK
setsigmask3:
Verify that sigmask is preserved between PT_GET_SIGMASK, process
resumed and PT_SET_SIGMASK
setsigmask4:
Verify that new sigmask is visible in tracee
Kernel ABI bump delayed as there are more interfaces to come in ptrace(2).
Sponsored by <The NetBSD Foundation>
do checking, rather just scrolls the scrolling region so we shall
follow suit. SUSv2 says what is happens when scrl is called with the
cursor outside the scrolling is undefined so we should match ncurses.
This fixes PR#51819 without forcing tin to use terminfo directly.
all later users of y first assign another value.
using ifdefs to make potential future code syncs easier, as is done
elsewhere.
suggested by coverity, CID 1300929, 1300930.
values into p,q sane. Get rid of redundant assignment. Indent
for legibility. NFC.
This doesn't create a functional difference, as all callers
test number >= 0x40000000 anyway.
To see this, note the following:
- consistently, hx is the high bits of x, lx is the low bits,
x is the float.
- & 0x7fffffff zeroes the sign bit, as does fabs.
A case where it isn't easy to see that there's no functional
change is y1, which does:
ix = hx & 0x7fffffff (zero signbit of high bits of x)
y = fabs(x) (this has a zeroed signbit but otherwise same as x)
ix >= 0x40000000
pone(y); qone(y)
qone(x) (also pone) do:
ix = hx & 0x7fffffff
ix in qone and in the calling function are the same number,
and the comparison applies for both, and ix < 0x40000000 isn't
possible.
(Also, no explosions seem to happen when I feed it random numbers)
accept4 is a syscall in Linux, FreeBSD and OpenBSD. It is used in
LLVM, zeromq, and probably others. paccept is a superset of it.
adding it to libc ensures it is used by programs and prevents the
need to define the same wrapper in every program.
libpthread_dbg(3) is a remnant library from the M:N thread model
(pre-NetBSD-5.0) API to introspect threads within a process and for use
of debuggers.
Currently in the 1:1 model it's not used in GDB neither in LLDB and it's
not either planned to be used. It's current function to read pthread_t
structures is realizable within a regular debugger capable to
instrospect objects within a tracee (GDB, LLDB...).
Remaining users of this API can still use this library from
pkgsrc/devel/libpthread_dbg.
Sponsored by <The NetBSD Foundation>
The original exect(2) from BSD4.2 was enabling bit for tracing
(single-step mode) and calling execve(2). The purpose of it was to generate
a signal for a tracer once the application will change its image to a new
program.
This approach no longer works as:
- exect(2) traces (single-steps) libc and it requires hundreds or
thousands steps before entering a new image
- it's vax and x86 specific code
- this functionality has been moved to the kernel - once a process is
traced it will generate SIGTRAP with si_code TRAP_EXEC and route it to
its debugger
- the side effects and unportability make this interface unusable
- there are no known users of this interface
- it apparently never worked better since day0 of NetBSD ("day0 bug")
Users are requested to move to other execve(2) variants. Calling current
execve(2) as it is the most similar behavior to this one from BSD4.2.
Discussed several times on mailing lists and in PR/51700.
Add warning to exect(3) telling about marking this function obsolete.
This function is prepared to be removed in next libc major bump.
Sponsored by <The NetBSD Foundation>
introducing since release of software to be recognised. This should hopefully
allow the builds to progress a littles further on systems such as the POWER8
which features a little endian 64-bit PowerPC CPU identified as ppc64le.
PTRACE_VFORK - report vfork(2)-like operations and trace child
PTRACE_VFORK_DONE - report unblocking the parent after vfork(2)-like call
Note that PTRACE_VFORK is currently unimplemented and returns ENOTSUP.
Sponsored by <The NetBSD Foundation>