i#7644: Allow specifying a default syscall trace in template file #7645
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allows the user to specify a default system call trace in the syscall template file.
The default trace is used to inject instances of syscalls that otherwise do not have any template specified in the syscall template file. This is for cases where the user wants to generate a trace with all syscalls injected, and not just the ones that we have a trace for. This default template only needs to contain an indirect branch (sysret or eret) at a minimum. We let the user specify such a trace by setting the enclosing syscall_trace_start and syscall_trace_end markers to dynamorio::drmemtrace::DEFAULT_SYSCALL_TRACE_TEMPLATE_NUM in the syscall template file.
Adjusts invariant checks that were found to fail after such injection for all syscalls was enabled: specifically the check for pc-equality of the prior syscall-trace-end branch-target marker vs the next pc, in the case when the regular pc continuity checks were disabled because the next kernel_event was the first thing in its signal context (the prior syscall-trace-end branch-target was erroneously being compared to the post-kernel-event instr pc in this case). This case existed also before this PR, but was revealed only now when we tried injecting that syscall and there was a non-zero syscall-trace-end branch-target to verify.
Also updates the mock syscall trace template file to include a default trace, and ensures the existing tests using this file pass.
Updates the scheduler unit tests to include a single-instr default syscall trace, and verify that it is used for syscalls that do not have a specified trace.
Issue: #7644