[offload] Improve report printing for kernel recording (#204505)
This commit extends the record reporting mechanism:
- `LIBOMPTARGET_RECORD_REPORT_FILENAME` enables the reporting mechanism
and allows specifying the name of the output file.
- The report of recorded kernels are ordered in recording order. This is
really useful for tests that need to record and replay more than one
kernel.
Merge tag 'trace-ring-buffer-v7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull ring-buffer updates from Steven Rostedt
- Do not invalidate entire buffer for invalid sub-buffers
For the persistent ring buffer, if one sub-buffer is found to be
invalid, it invalidates the entire per CPU ring buffer. This can lose
a lot of valuable data if there's some corruption with the writes to
the buffer not syncing properly on a hard crash. Instead, if a
sub-buffer is found to be invalid, simply zero it out and mark it for
"missed events".
When the persistent ring buffer is read and a sub-buffer that was
cleared due to being invalid on boot up is discovered, the output
will show "[LOST EVENTS]" to let the user know that events were
missing at that location. Displaying the events from valid buffers
can still be useful.
[29 lines not shown]
linux: implement SO_PASSRIGHTS
We have a native version now, plumb it through to the Linuxolator.
Reviewed by: glebius, markj
Differential Revision: https://reviews.freebsd.org/D57427
tests: unix: pull a recvfd_payload_cmsg out of recvfd_payload
This is almost a trivial factoring, but it's still a bit of boilerplate
that we don't care to rewrite- the SO_PASSRIGHTS test will still receive
some data, so the iovec construction still saves us a few lines.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D57544
tests: unix: add SCM_RIGHTS tests for SO_PASSRIGHTS
We test both the standard case where we want to reject any SCM_RIGHTS
message, as well as the case where the kernel discards the unwanted file
upon receipt.
Reviewed by: glebius (previous version), markj
Differential Revision: https://reviews.freebsd.org/D57426
sockets: plumb SO_PASSRIGHTS into *sockopt(2)
This is a little different than the others in that it's not valid for
anything but unix(4) sockets. New cases were added that jump into the
more standard case out of a light preference for not taking advantage of
case FALLTHROUGH with the additional logic- it doesn't scale very well
for new cases added that might be slightly special, so we might as well
just add the labels up-front.
Reviewed by: glebius, markj
Differential Revision: https://reviews.freebsd.org/D57424
socket: remove tautological condition in so_unsplice()
so2rele was introduced in 1000cc4a0d3 and it was necessary there, but
the cleanup in a837d1fe49e0255 rendered it redundant if our own KASSERT
is to be believed: we've asserted that `so2->so_splice_back == sp` and
`sp` has been dereferenced above, so there's no condition left where
we shouldn't release the socket reference at the end. Indeed, the
change in so_splice() to NULL out sp->dst removes that possible state of
a partially constructed splice: if sp->dst is set, it has been ref'd.
Reviewed by: gallatin, markj
Differential Revision: https://reviews.freebsd.org/D57558
unix: implement basic SO_PASSRIGHTS functionality
With exception to sockopt functionality, implement the so_options flag
in unix(4) itself. The general argument for the flag is that SCM_RIGHTS
can be used maliciously for, e.g., a DoS that the receiving side can't
avoid if it is expecting other control messages.
This option gives the receiver a way to disable SCM_RIGHTS on the
sender-side, surfacing an EPERM to them instead. This seems to match
the semantics that Linux offers.
If an SCM_RIGHTS was already sent before we disabled SO_PASSRIGHTS, then
a subsequent recvmsg(2) will silently discard any in-flight files. This
has the downside of punting a file with the potential to hang over to
the deferred-close task, but perhaps usage of the option would
discourage folks from attempting to take advantage of that possibility
anyways.
Various manpages updated to describe the new behavior.
[10 lines not shown]
Merge tag 'trace-v7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull tracing updates from Steven Rostedt:
- Remove a redundant IS_ERR() check
trace_pipe_open() already checks for IS_ERR() and does it again in
the return path. Remove the return check.
- Export seq_buf_putmem_hex() to allow kunit tests against them
To add Kunit tests on seq_buf_putmem_hex(), it needs to be exported.
- Replace strcat() and strcpy() with seq_buf() logic
The code for synthetic events uses a series of strcat() and strcpy()
which can be error prone. Replace them with seq_buf() logic that does
all the necessary bound checking.
[91 lines not shown]
[orc-rt] Fix assertion, add fail-to-connect unit test. (#204720)
If a ControllerAccess object's connect method calls notifyDisconnected
then by the time we return to Connect we may have completed the detach,
in which case TargetState will be None, and CurrentState will be >=
Detached. This case was not covered by the assert after the return from
connect, leading to assertions when connect failed.
This commit relaxes the assertion to include the case above, and adds a
unit test to cover it.