-
Notifications
You must be signed in to change notification settings - Fork 1
runtime/tracer: passthrough unexpected signals by default #488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
063b46d
to
bb6f17c
Compare
5c8ecfc
to
6b5aa0e
Compare
08a547e
to
c1a26d3
Compare
6b5aa0e
to
e346f66
Compare
c1a26d3
to
80f3d9c
Compare
e346f66
to
dd7993a
Compare
80f3d9c
to
8db716a
Compare
dd7993a
to
f9e812b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See inline comments.
if (exit_status != test_info->exit_code || | ||
// Sometimes the signal doesn't show up with `WIFSIGNALED`, so we check the exit status as well. | ||
(exit_status > 128 && exit_status - 128 == test_info->signal)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems wrong. The first half checks if the exit status is not what's expected (which is a problem). We or this against the exit status indicating we received the expected signal (which is not a problem).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -817,7 +836,7 @@ bool track_memory_map(pid_t pid, int *exit_status_out, enum trace_mode mode) { | |||
case WAIT_SIGNALED: { | |||
fprintf(stderr, "process received fatal signal (syscall entry)\n"); | |||
enum control_flow cf = handle_process_exit(&maps, waited_pid); | |||
return false; | |||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making this return true
without setting *exit_status_out
violates the doc comment for track_memory_map
. This needs changes in wait_for_next_trap
, which currently only writes through its copy of the exit_status_out
pointer when returning WAIT_EXITED
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed things to always return the wait
status, which can then be inspected more thoroughly with all of the W*
macros.
8db716a
to
8fd3e24
Compare
7adfbaf
to
44b5f63
Compare
44b5f63
to
adfaf96
Compare
ca1f7be
to
f177818
Compare
This allows signals like `SIGABRT` to work in tests, so now `assert`s work correctly, like in the `post_condition` test. Since post condition functions can be arbitrary and the user can handle things any way, we don't want to impose an unnecessary restriction on what fatal signals they may raise.
When the test child process dies from a fatal signal, it seems to sometimes trigger `WIFSIGNALED`, but sometimes just shows up in the `WEXITSTATUS` as `128 + signal`. Thus, this handles both cases.
Now `STRINGIFY(EXIT_SUCCESS)` is "EXIT_SUCCESS" not "0" for example. The other expanding version is now called `EXPAND_AND_STRINGIFY`.
f177818
to
84f8c8a
Compare
This allows signals like
SIGABRT
to work in tests, so nowassert
s work correctly, like in thepost_condition
test. Since post condition functions can be arbitrary and the user can handle things any way, we don't want to impose an unnecessary restriction on what fatal signals they may raise.