Skip to content

Commit

Permalink
Relax pre-syscall-trace-is-syscall check when no encodings available.
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinav92003 committed Apr 10, 2024
1 parent 6c1f2c8 commit 02e1b8b
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
44 changes: 44 additions & 0 deletions clients/drcachesim/tests/invariant_checker_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3384,6 +3384,50 @@ check_kernel_syscall_trace(void)
if (!run_checker(memrefs, false))
res = false;
}
{
std::vector<memref_with_IR_t> memref_instr_vec = {
{ gen_marker(TID_A, TRACE_MARKER_TYPE_FILETYPE,
OFFLINE_FILE_TYPE_ENCODINGS |
OFFLINE_FILE_TYPE_SYSCALL_NUMBERS |
OFFLINE_FILE_TYPE_KERNEL_SYSCALLS),
nullptr },
{ gen_marker(TID_A, TRACE_MARKER_TYPE_CACHE_LINE_SIZE, 64), nullptr },
{ gen_marker(TID_A, TRACE_MARKER_TYPE_PAGE_SIZE, 4096), nullptr },
{ gen_marker(TID_A, TRACE_MARKER_TYPE_SYSCALL, 42), nullptr },
{ gen_marker(TID_A, TRACE_MARKER_TYPE_SYSCALL_TRACE_START, 42), nullptr },
{ gen_instr(TID_A), move1 },
{ gen_marker(TID_A, TRACE_MARKER_TYPE_SYSCALL_TRACE_END, 42), nullptr },
{ gen_exit(TID_A), nullptr }
};
auto memrefs = add_encodings_to_memrefs(ilist2, memref_instr_vec, BASE_ADDR);
if (!run_checker(
memrefs, true,
{ "prev_instr at syscall trace start is not a syscall",
/*tid=*/TID_A,
/*ref_ordinal=*/5, /*last_timestamp=*/0,
/*instrs_since_last_timestamp=*/0 },
"Failed to catch missing syscall instr before syscall trace"))
res = false;
}
{
std::vector<memref_t> memrefs = {
gen_marker(TID_A, TRACE_MARKER_TYPE_FILETYPE,
OFFLINE_FILE_TYPE_SYSCALL_NUMBERS |
OFFLINE_FILE_TYPE_KERNEL_SYSCALLS),
gen_marker(TID_A, TRACE_MARKER_TYPE_CACHE_LINE_SIZE, 64),
gen_marker(TID_A, TRACE_MARKER_TYPE_PAGE_SIZE, 4096),
// Since the file type does not indicate presence of encodings, we do
// not need this instr to be a system call.
gen_instr(TID_A),
gen_marker(TID_A, TRACE_MARKER_TYPE_SYSCALL, 42),
gen_marker(TID_A, TRACE_MARKER_TYPE_SYSCALL_TRACE_START, 42),
gen_instr(TID_A),
gen_marker(TID_A, TRACE_MARKER_TYPE_SYSCALL_TRACE_END, 42),
gen_exit(TID_A),
};
if (!run_checker(memrefs, false))
return false;
}
{
std::vector<memref_with_IR_t> memref_instr_vec = {
{ gen_marker(TID_A, TRACE_MARKER_TYPE_FILETYPE,
Expand Down
4 changes: 3 additions & 1 deletion clients/drcachesim/tools/invariant_checker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,9 @@ invariant_checker_t::parallel_shard_memref(void *shard_data, const memref_t &mem
shard->last_syscall_marker_value_ ==
static_cast<int>(memref.marker.marker_value),
"Mismatching syscall num in trace start and syscall marker");
report_if_false(shard, shard->prev_instr_.decoding.is_syscall,
report_if_false(shard,
!TESTANY(OFFLINE_FILE_TYPE_ENCODINGS, shard->file_type_) ||
shard->prev_instr_.decoding.is_syscall,
"prev_instr at syscall trace start is not a syscall");
}
shard->pre_syscall_trace_instr_ = shard->prev_instr_;
Expand Down

0 comments on commit 02e1b8b

Please sign in to comment.