Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions src/RecordCommand.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ RecordCommand RecordCommand::singleton(
" <AAA>: Bitmask of bits to clear from EAX\n"
" -h, --chaos randomize scheduling decisions to try to \n"
" reproduce bugs\n"
" -n, --no-syscall-buffer disable the syscall buffer preload \n"
" library even if it would otherwise be used\n"
" -n, --no-syscall-buffer disable syscall buffering even if it would\n"
" otherwise be used\n"
" --no-preload disable the preload library; useful when\n"
" tracee uses a non-standard C ABI but may\n"
" cause replay issues. Implies -n.\n"
" --no-file-cloning disable file cloning for mmapped files\n"
" --no-read-cloning disable file-block cloning for syscallbuf\n"
" reads\n"
Expand Down Expand Up @@ -193,6 +196,9 @@ struct RecordFlags {
/* True if we should check files being mapped outside of the recording. */
bool check_outside_mmaps;

/* True if we should not add the preload library to LD_PRELOAD. */
bool no_preload = false;

RecordFlags()
: max_ticks(Scheduler::DEFAULT_MAX_TICKS),
ignore_sig(0),
Expand Down Expand Up @@ -282,6 +288,7 @@ static bool parse_record_arg(vector<string>& args, RecordFlags& flags) {
{ 18, "tsan", NO_PARAMETER },
{ 19, "intel-pt", NO_PARAMETER },
{ 20, "check-outside-mmaps", NO_PARAMETER },
{ 21, "no-preload", NO_PARAMETER },
{ 'c', "num-cpu-ticks", HAS_PARAMETER },
{ 'h', "chaos", NO_PARAMETER },
{ 'i', "ignore-signal", HAS_PARAMETER },
Expand Down Expand Up @@ -507,6 +514,9 @@ static bool parse_record_arg(vector<string>& args, RecordFlags& flags) {
case 20:
flags.check_outside_mmaps = true;
break;
case 21:
flags.no_preload = true;
break;
case 's':
flags.always_switch = true;
break;
Expand Down Expand Up @@ -696,11 +706,10 @@ static WaitStatus record(const vector<string>& args, const RecordFlags& flags) {

auto session = RecordSession::create(
args, flags.extra_env, flags.disable_cpuid_features,
flags.use_syscall_buffer, flags.syscallbuf_desched_sig,
flags.bind_cpu, flags.output_trace_dir,
flags.trace_id.get(),
flags.stap_sdt, flags.unmap_vdso, flags.asan, flags.tsan,
flags.intel_pt, flags.check_outside_mmaps);
flags.use_syscall_buffer, flags.syscallbuf_desched_sig, flags.bind_cpu,
flags.output_trace_dir, flags.trace_id.get(), flags.stap_sdt,
flags.unmap_vdso, flags.asan, flags.tsan, flags.intel_pt,
flags.check_outside_mmaps, flags.no_preload);
setup_session_from_flags(*session, flags);

static_session = session.get();
Expand Down
5 changes: 3 additions & 2 deletions src/RecordSession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2402,7 +2402,8 @@ static string lookup_by_path(const string& name) {
bool force_asan_active,
bool force_tsan_active,
bool intel_pt,
bool check_outside_mmaps) {
bool check_outside_mmaps,
bool no_preload) {
TraceeAttentionSet::initialize();

// The syscallbuf library interposes some critical
Expand Down Expand Up @@ -2450,7 +2451,7 @@ static string lookup_by_path(const string& name) {

// LD_PRELOAD the syscall interception lib
string syscall_buffer_lib_path = find_helper_library(SYSCALLBUF_LIB_FILENAME);
if (!syscall_buffer_lib_path.empty()) {
if (!no_preload && !syscall_buffer_lib_path.empty()) {
string ld_preload = "";
if (!exe_info.sanitizer_path.empty()) {
LOG(debug) << "Prepending " << exe_info.sanitizer_path << " to LD_PRELOAD";
Expand Down
3 changes: 2 additions & 1 deletion src/RecordSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ class RecordSession final : public Session {
bool force_asan_active = false,
bool force_tsan_active = false,
bool intel_pt = false,
bool check_outside_mmaps = false);
bool check_outside_mmaps = false,
bool no_preload = false);

~RecordSession() override;

Expand Down