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>
- syslog_ss.c *_ss api functions (don't use stdio, time)
- syslog.c: *syslog* non _ss api functions (use stdio, time)
- xsyslog.c> common guts.
The motivation for this is not to drag in stdio/locale/floating point/time
for every binary, since syslog_ss() is used in __stack_check_fail() for SSP.
Store ripped off lines in the SCREEN structure so we can repaint then
when the terminal is resized.
Fix mvwin(3) so it can move windows in the ripped off area.
Explain:
- execve(2) handling and behavior, SIGTRAP & TRAP_EXEC
- reference PaX MPROTECT restrictions for debuggers
- software breakpoints handling and behavior, SIGTRAP & TRAP_BKPT
- single step behavior, SIGTRAP & TRAP_TRACE
- list predefined MI symbols for help debuggers in port specific headers
- explain that PT_TRACE_ME does not send a SIGSTOP signal
Sponsored by <The NetBSD Foundation>
PT_SET_SIGINFO - fake signal information emitted to tracee
PT_GET_SIGINFO - read signal information routed to tracee
Sponsored by <The NetBSD Foundation>
The PT_GET_PROCESS_STATE call in ptrace(2) has the following usage of addr
and data:
A pointer to this structure is passed in addr. The data
argument should be set to sizeof(struct ptrace_event).
Sponsored by <The NetBSD Foundation>
-0.0 > 0 is also false. no functional change.
while this is mostly a change to be consistent in style (the rest of the
comparisons aren't done with signbit), it is also a micro-optimization.
with our default compile flags, calls to copysign are libm calls (and a
whole function call!!). this generates more efficient code.
delicacy in order to maintain continuity around it.
we have an initial case to deal with a fairly common case: getting
a real number. Avoid dealing with the branch cut in this case by
checking if the real part is negative.
later, -0.0 < 0 is not met, so instead, test for a negative number
using signbit, so negative zero is also treated as a negative number.
Fixes last part of PR lib/51427: libm issues triggered by py-numpy
ok riastradh
The former allows the ncurses (and pdcurses) macros getsyx and setsyx
to be implemented, which is needed by a surprising number of applications.
The latter is needed for Python curses support so it doesn't have to dive
into ncurses window structure.
as a side effect, this fixes the evbarm64 build, which was failing due
to a declaration of psize_t physmem in systm.h, while psize_t is
kernel-only.
ok riastradh
rather than [0,61]. The standard has removed mention of double leap seconds.
The standard has give the following rationale in the time.h man page:
"The range [0,60] seconds allows for positive or negative leap seconds.
The formal definition of UTC does not permit double leap seconds, so all
mention of double leap seconds has been removed, and the range shortened
from the former [0,61] seconds seen in previous versions of POSIX."
Currently the PT_DUMPCORE call requires process to be stopped, therefore it
no longer need to warn about stoped tracee to generate consistent data.
Sponsored by <The NetBSD Foundation>
The thread_type is irrelevant as all local POSIX threads are in user-space.
Keep the thread_type member in td_thread_info_st to preserve ABI
compatibility.
Later the remnants from M:N will be refactored in one go with library ABI
version bump.
Sponsored by <The NetBSD Foundation>
td_thr_info - get information on a thread
Currently a subset of td_thread_info_t is documented. This version
describes thread_addr and thread_state.
Sponsored by <The NetBSD Foundation>
Scheduler Activation types were removed in NetBSD 5.0. Old type set is not
matching the new world POSIX threads library.
Only TD_STATE_RUNNING, TD_STATE_ZOMBIE are still applicable - keep it.
Keep TD_STATE_UNKNOWN as generic unrecognized type.
Add new TD_STATE_DEAD one. The TD_STATE_DEAD type is represented by number
6 in the POSIX threads library, but for the sake of compatibility with
older software using pthread_dbg - renumber it to 7, as six was reserved
for TD_STATE_SUSPENDED.
Old removed state types are marked as reserved and unused.
Sponsored by <The NetBSD Foundation>
* Prototypes for fuse_new(3), fuse_mount(3), and fuse_unmount(3) now
matches to the original fuse interface.
* Add fuse_daemonize(3): needs to have a different prototype,
otherwise we can't use puffs_daemon(3).
* Remove fuse_setup(3) and fuse_teardown(3). These obsolete functions
has already been removed from the original interface.
* fuse_main(3) now supports the following command-line options
compatible with the original fuse:
-h, --help print help message
-V, --version print library version (currently does nothing)
-d, -o debug enable debug output (PUFFS_FLAG_OPDUMP), implies -f
-f foreground mode
-s single threaded mode (always enabled for now)
-o fsname=NAME explicitly set the name of the file system
* fuse_main(3) now daemonizes the process by default. This is for the
compatibility with the original fuse.
The pt_magic field is not the first one in the pthread_t structure.
After this fix, this code is confirmed to work and function td_thr_info()
is functional.
Sponsored by <The NetBSD Foundation>
In puffs "create" and "open" are two separate operations with
atomicity achieved by locking the parent vnode. In fuse, on the other
hand, "create" is actually a create-and-open-atomically and the open
flags (O_RDWR, O_APPEND, ...) are passed via fi.flags. So the only way
to emulate the fuse semantics is to open the file with dummy flags and
then immediately close it.
You might think that we could simply use fuse->op.mknod all the time
but no, that's not possible because most file systems nowadays expect
op.mknod to be called only for non-regular files and many don't even
support it.
Either an out-of-band channel, or an in-band sentinel value, could
indicate an error, but an out-of-band sentinel value is a silly
proposition.
Noted by uwe@.
with the trailing newline, others don't so don't make any assumptions
about it when printing. Also print the correct event number (generated),
separate the event number from the event with a tab, and visually encode
the string (don't encode tabs and spaces though).
just ...
ptrdiff_t nitems_max = PTRDIFF_MAX - WORK_AROUND_QTBUG_53071;
ptrdiff_t amax = nitems_max < SIZE_MAX ? nitems_max : SIZE_MAX;
which is just fine if you think about it a little, Unfortunately,
in our zealous effort to never leave a ggc warning unused, and to
treat all of the warnings as fatal errors, that code falls foul of the
"you must not compare an unsigned value with a signed value" warning.
nitems_max is a (signed) largish positive integer (obviously, by
inspection). If it is less than SIZE_MAX then amax is just nitems_max.
In the unlikely case that size_t has less bits than ptrdiff_t so
SIZE_MAX is smaller, amax is limited to SIZE_MAX (which in that case
is known to fit in the ptrdiff_t and to remain positive).
To pacify gcc (and the way the build system uses it), casts are
required. Unfortunately the cast that was installed here was to
convert SIZE_MAX to a ptrdiff_t. Unfortunately when ptrdiff_t has
the same number of bits (or less) as size_t (ie: the common case)
but is signed, (ptrdiff_t)SIZE_MAX is just a fancy way of writing -1.
Rearrange the casting in a way that keeps the original intent
of the code for us (it is actyaly now incorrect if size_t has less
bits than a ptrdiff_t) and keeps gcc happy, all at the same time.
What a mess.
SIZE_MAX is the max value of a size_t (and is unsigned) so when converted
to a ptrdiff_t (int) becomes -1. That's not what the code was attempting
to achieve.
This will be reported upstream to the tzcode maintainers, and we'll see
what variation appears in tzcode2016j ...
Until then, the older code always worked for us, so it will do for now.
This should fix the broken i386 build.