Skip to content

Conversation

abhinav92003
Copy link
Contributor

@abhinav92003 abhinav92003 commented Sep 22, 2025

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

Allows the user to specify a default system call trace in the syscall template file. This trace will be used to inject syscall instances for syscalls that otherwise do not have any template specified in the syscall template file. This is to help with 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 the indirect branch (sysret or eret).

Adjusts invariant checks that were found to fail after such injection for all syscalls was enabled: specifically to check for pc continuity with the prior syscall-final branch target marker, even when the regular pc continuity checks were disabled. This cases existed before this PR, but was not seen because we didn't try to inject that particular syscall before.

Also updates the mock syscall trace template file to include a default trace, and ensures the existing tests using this file pass.

Issue: #7644
@derekbruening
Copy link
Contributor

Going to defer to @ivankyluk to load balance

@derekbruening derekbruening removed their request for review September 22, 2025 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants