Skip to content

Update the docs and add some more information - #4

Merged
andreasgal merged 2 commits into
rr-debugger:masterfrom
joneschrisg:update-docs
May 8, 2013
Merged

andreasgal merged 2 commits into
rr-debugger:masterfrom
joneschrisg:update-docs

Conversation

@joneschrisg

Copy link
Copy Markdown
Contributor

Mostly style/formatting cleanup. Added some information in a few places too.

andreasgal added a commit that referenced this pull request May 8, 2013
Update the docs and add some more information
@andreasgal
andreasgal merged commit 7f29164 into rr-debugger:master May 8, 2013
@bgirard bgirard mentioned this pull request Jul 24, 2015
@silkvine silkvine mentioned this pull request Aug 20, 2020
bernhardu added a commit to bernhardu/rr that referenced this pull request Jun 23, 2021
These two tests are stuck:
  nested_detach-no-syscallbuf
  nested_detach-32-no-syscallbuf

For some reason just the no-syscallbuf variants get stuck,
the regular ones succeed.

$ bin/rr record -n bin/rr record --nested=detach bin/simple

PID 1305400 uses 100% CPU, until timeout kills all.

1305387    └─ bin/rr record -n bin/rr record --nested=detach bin/simple  12
1305399       ├─ bin/rr record --nested=detach bin/simple   1
1305400       └─ bin/rr record --nested=detach bin/simple   1

$ gdb -q --pid 1305400
(gdb) add-symbol-file /usr/lib/x86_64-linux-gnu/libasan.so.6.0.0 0x7f818ad37a60
(gdb) add-symbol-file .../x86_64_asan/obj/bin/rr 0x564caa04e830
(gdb) add-symbol-file .../x86_64_asan/obj/lib/rr/librrpreload.so 0x7f818ad030d0
(gdb) stepi
0x00007f818ad50339      4150      int res = REAL(pthread_mutex_lock)(m);
1: x/i $pc
=> 0x7f818ad50339 <__interceptor_pthread_mutex_lock(void*)+25>: jmp    *0xf4311(%rip)        # 0x7f818ae44650
(gdb) bt
#0  0x00007f818ad50339 in __interceptor_pthread_mutex_lock (m=<optimized out>) at ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4150
rr-debugger#1  __interceptor_pthread_mutex_lock (m=<optimized out>) at ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4146
rr-debugger#2  0x0000564caa0e2ddc in rr::CompressedWriter::CompressedWriter (this=0x6110000002c0, filename=..., block_size=1048576, num_threads=1) at .../rr/src/CompressedWriter.cc:62
rr-debugger#3  0x0000564caa5a9453 in rr::TraceWriter::TraceWriter (this=0x619000003380, file_name=..., output_trace_dir=..., ticks_semantics_=rr::TICKS_RETIRED_CONDITIONAL_BRANCHES) at .../rr/src/TraceStream.cc:1307
rr-debugger#4  0x0000564caa2b9ed2 in rr::RecordSession::RecordSession (this=0x619000003280, exe_path=..., argv=..., envp=..., disable_cpuid_features=..., syscallbuf=rr::RecordSession::ENABLE_SYSCALL_BUF, syscallbuf_desched_sig=30, bind_cpu=rr::BIND_CPU, output_trace_dir=..., trace_id=0x0, use_audit=false, unmap_vdso=false) at .../rr/src/RecordSession.cc:2296
rr-debugger#5  0x0000564caa2b92ea in rr::RecordSession::create (argv=..., extra_env=..., disable_cpuid_features=..., syscallbuf=rr::RecordSession::ENABLE_SYSCALL_BUF, syscallbuf_desched_sig=30 '\036', bind_cpu=rr::BIND_CPU, output_trace_dir=..., trace_id=0x0, use_audit=false, unmap_vdso=false, force_asan_active=false) at .../rr/src/RecordSession.cc:2261
rr-debugger#6  0x0000564caa29cd01 in rr::record (args=..., flags=...) at .../rr/src/RecordCommand.cc:632
rr-debugger#7  0x0000564caa29e90f in rr::RecordCommand::run (this=0x564caa956fe0, args=...) at .../rr/src/RecordCommand.cc:791
rr-debugger#8  0x0000564caa614909 in main (argc=4, argv=0x7ffd2a91dbe8) at .../rr/src/main.cc:271
...
(gdb) stepi
pthread_mutex_lock (mutex=0x6110000002c8) at .../rr/src/preload/overrides.c:24
24        mutex->__data.__kind &= ~PTHREAD_MUTEX_PRIO_INHERIT_NP;
1: x/i $pc
=> 0x7f818ad08660 <pthread_mutex_lock>: mov    0x4ba9(%rip),%rax        # 0x7f818ad0d210
(gdb) bt
#0  pthread_mutex_lock (mutex=0x6110000002c8) at .../rr/src/preload/overrides.c:24
rr-debugger#1  0x0000564caa0e2ddc in rr::CompressedWriter::CompressedWriter (this=0x6110000002c0, filename=..., block_size=1048576, num_threads=1) at .../rr/src/CompressedWriter.cc:62
rr-debugger#2  0x0000564caa5a9453 in rr::TraceWriter::TraceWriter (this=0x619000003380, file_name=..., output_trace_dir=..., ticks_semantics_=rr::TICKS_RETIRED_CONDITIONAL_BRANCHES) at .../rr/src/TraceStream.cc:1307
...
(gdb) stepi
74        return __pthread_mutex_lock(mutex);
1: x/i $pc
=> 0x7f818ad08678 <pthread_mutex_lock+24>:      jmp    0x7f818ad03070
(gdb) bt
#0  pthread_mutex_lock (mutex=0x6110000002c8) at .../rr/src/preload/overrides.c:74
rr-debugger#1  0x0000564caa0e2ddc in rr::CompressedWriter::CompressedWriter (this=0x6110000002c0, filename=..., block_size=1048576, num_threads=1) at .../rr/src/CompressedWriter.cc:62
rr-debugger#2  0x0000564caa5a9453 in rr::TraceWriter::TraceWriter (this=0x619000003380, file_name=..., output_trace_dir=..., ticks_semantics_=rr::TICKS_RETIRED_CONDITIONAL_BRANCHES) at .../rr/src/TraceStream.cc:1307
...
(gdb) print environ
$1 = (char **) 0x0

$ cat /proc/1305400/environ | tr '\0' '\n' | grep LD_PRELOAD
LD_PRELOAD=libasan.so.6:.../x86_64_asan/obj/bin/../lib/rr/librrpreload.so:::
bernhardu added a commit to bernhardu/rr that referenced this pull request Jun 24, 2021
These two tests are stuck:
  nested_detach-no-syscallbuf
  nested_detach-32-no-syscallbuf

For some reason just the no-syscallbuf variants get stuck,
the regular ones succeed.

$ bin/rr record -n bin/rr record --nested=detach bin/simple

PID 1305400 uses 100% CPU, until timeout kills all.

1305387    └─ bin/rr record -n bin/rr record --nested=detach bin/simple  12
1305399       ├─ bin/rr record --nested=detach bin/simple   1
1305400       └─ bin/rr record --nested=detach bin/simple   1

$ gdb -q --pid 1305400
(gdb) add-symbol-file /usr/lib/x86_64-linux-gnu/libasan.so.6.0.0 0x7f818ad37a60
(gdb) add-symbol-file .../x86_64_asan/obj/bin/rr 0x564caa04e830
(gdb) add-symbol-file .../x86_64_asan/obj/lib/rr/librrpreload.so 0x7f818ad030d0
(gdb) stepi
0x00007f818ad50339      4150      int res = REAL(pthread_mutex_lock)(m);
1: x/i $pc
=> 0x7f818ad50339 <__interceptor_pthread_mutex_lock(void*)+25>: jmp    *0xf4311(%rip)        # 0x7f818ae44650
(gdb) bt
#0  0x00007f818ad50339 in __interceptor_pthread_mutex_lock (m=<optimized out>) at ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4150
rr-debugger#1  __interceptor_pthread_mutex_lock (m=<optimized out>) at ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4146
rr-debugger#2  0x0000564caa0e2ddc in rr::CompressedWriter::CompressedWriter (this=0x6110000002c0, filename=..., block_size=1048576, num_threads=1) at .../rr/src/CompressedWriter.cc:62
rr-debugger#3  0x0000564caa5a9453 in rr::TraceWriter::TraceWriter (this=0x619000003380, file_name=..., output_trace_dir=..., ticks_semantics_=rr::TICKS_RETIRED_CONDITIONAL_BRANCHES) at .../rr/src/TraceStream.cc:1307
rr-debugger#4  0x0000564caa2b9ed2 in rr::RecordSession::RecordSession (this=0x619000003280, exe_path=..., argv=..., envp=..., disable_cpuid_features=..., syscallbuf=rr::RecordSession::ENABLE_SYSCALL_BUF, syscallbuf_desched_sig=30, bind_cpu=rr::BIND_CPU, output_trace_dir=..., trace_id=0x0, use_audit=false, unmap_vdso=false) at .../rr/src/RecordSession.cc:2296
rr-debugger#5  0x0000564caa2b92ea in rr::RecordSession::create (argv=..., extra_env=..., disable_cpuid_features=..., syscallbuf=rr::RecordSession::ENABLE_SYSCALL_BUF, syscallbuf_desched_sig=30 '\036', bind_cpu=rr::BIND_CPU, output_trace_dir=..., trace_id=0x0, use_audit=false, unmap_vdso=false, force_asan_active=false) at .../rr/src/RecordSession.cc:2261
rr-debugger#6  0x0000564caa29cd01 in rr::record (args=..., flags=...) at .../rr/src/RecordCommand.cc:632
rr-debugger#7  0x0000564caa29e90f in rr::RecordCommand::run (this=0x564caa956fe0, args=...) at .../rr/src/RecordCommand.cc:791
rr-debugger#8  0x0000564caa614909 in main (argc=4, argv=0x7ffd2a91dbe8) at .../rr/src/main.cc:271
...
(gdb) stepi
pthread_mutex_lock (mutex=0x6110000002c8) at .../rr/src/preload/overrides.c:24
24        mutex->__data.__kind &= ~PTHREAD_MUTEX_PRIO_INHERIT_NP;
1: x/i $pc
=> 0x7f818ad08660 <pthread_mutex_lock>: mov    0x4ba9(%rip),%rax        # 0x7f818ad0d210
(gdb) bt
#0  pthread_mutex_lock (mutex=0x6110000002c8) at .../rr/src/preload/overrides.c:24
rr-debugger#1  0x0000564caa0e2ddc in rr::CompressedWriter::CompressedWriter (this=0x6110000002c0, filename=..., block_size=1048576, num_threads=1) at .../rr/src/CompressedWriter.cc:62
rr-debugger#2  0x0000564caa5a9453 in rr::TraceWriter::TraceWriter (this=0x619000003380, file_name=..., output_trace_dir=..., ticks_semantics_=rr::TICKS_RETIRED_CONDITIONAL_BRANCHES) at .../rr/src/TraceStream.cc:1307
...
(gdb) stepi
74        return __pthread_mutex_lock(mutex);
1: x/i $pc
=> 0x7f818ad08678 <pthread_mutex_lock+24>:      jmp    0x7f818ad03070
(gdb) bt
#0  pthread_mutex_lock (mutex=0x6110000002c8) at .../rr/src/preload/overrides.c:74
rr-debugger#1  0x0000564caa0e2ddc in rr::CompressedWriter::CompressedWriter (this=0x6110000002c0, filename=..., block_size=1048576, num_threads=1) at .../rr/src/CompressedWriter.cc:62
rr-debugger#2  0x0000564caa5a9453 in rr::TraceWriter::TraceWriter (this=0x619000003380, file_name=..., output_trace_dir=..., ticks_semantics_=rr::TICKS_RETIRED_CONDITIONAL_BRANCHES) at .../rr/src/TraceStream.cc:1307
...
(gdb) print environ
$1 = (char **) 0x0

$ cat /proc/1305400/environ | tr '\0' '\n' | grep LD_PRELOAD
LD_PRELOAD=libasan.so.6:.../x86_64_asan/obj/bin/../lib/rr/librrpreload.so:::
bernhardu added a commit to bernhardu/rr that referenced this pull request Jun 25, 2021
These two tests are stuck:
  nested_detach-no-syscallbuf
  nested_detach-32-no-syscallbuf

For some reason just the no-syscallbuf variants get stuck,
the regular ones succeed.

$ bin/rr record -n bin/rr record --nested=detach bin/simple

PID 1305400 uses 100% CPU, until timeout kills all.

1305387    └─ bin/rr record -n bin/rr record --nested=detach bin/simple  12
1305399       ├─ bin/rr record --nested=detach bin/simple   1
1305400       └─ bin/rr record --nested=detach bin/simple   1

$ gdb -q --pid 1305400
(gdb) add-symbol-file /usr/lib/x86_64-linux-gnu/libasan.so.6.0.0 0x7f818ad37a60
(gdb) add-symbol-file .../x86_64_asan/obj/bin/rr 0x564caa04e830
(gdb) add-symbol-file .../x86_64_asan/obj/lib/rr/librrpreload.so 0x7f818ad030d0
(gdb) stepi
0x00007f818ad50339      4150      int res = REAL(pthread_mutex_lock)(m);
1: x/i $pc
=> 0x7f818ad50339 <__interceptor_pthread_mutex_lock(void*)+25>: jmp    *0xf4311(%rip)        # 0x7f818ae44650
(gdb) bt
#0  0x00007f818ad50339 in __interceptor_pthread_mutex_lock (m=<optimized out>) at ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4150
rr-debugger#1  __interceptor_pthread_mutex_lock (m=<optimized out>) at ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4146
rr-debugger#2  0x0000564caa0e2ddc in rr::CompressedWriter::CompressedWriter (this=0x6110000002c0, filename=..., block_size=1048576, num_threads=1) at .../rr/src/CompressedWriter.cc:62
rr-debugger#3  0x0000564caa5a9453 in rr::TraceWriter::TraceWriter (this=0x619000003380, file_name=..., output_trace_dir=..., ticks_semantics_=rr::TICKS_RETIRED_CONDITIONAL_BRANCHES) at .../rr/src/TraceStream.cc:1307
rr-debugger#4  0x0000564caa2b9ed2 in rr::RecordSession::RecordSession (this=0x619000003280, exe_path=..., argv=..., envp=..., disable_cpuid_features=..., syscallbuf=rr::RecordSession::ENABLE_SYSCALL_BUF, syscallbuf_desched_sig=30, bind_cpu=rr::BIND_CPU, output_trace_dir=..., trace_id=0x0, use_audit=false, unmap_vdso=false) at .../rr/src/RecordSession.cc:2296
rr-debugger#5  0x0000564caa2b92ea in rr::RecordSession::create (argv=..., extra_env=..., disable_cpuid_features=..., syscallbuf=rr::RecordSession::ENABLE_SYSCALL_BUF, syscallbuf_desched_sig=30 '\036', bind_cpu=rr::BIND_CPU, output_trace_dir=..., trace_id=0x0, use_audit=false, unmap_vdso=false, force_asan_active=false) at .../rr/src/RecordSession.cc:2261
rr-debugger#6  0x0000564caa29cd01 in rr::record (args=..., flags=...) at .../rr/src/RecordCommand.cc:632
rr-debugger#7  0x0000564caa29e90f in rr::RecordCommand::run (this=0x564caa956fe0, args=...) at .../rr/src/RecordCommand.cc:791
rr-debugger#8  0x0000564caa614909 in main (argc=4, argv=0x7ffd2a91dbe8) at .../rr/src/main.cc:271
...
(gdb) stepi
pthread_mutex_lock (mutex=0x6110000002c8) at .../rr/src/preload/overrides.c:24
24        mutex->__data.__kind &= ~PTHREAD_MUTEX_PRIO_INHERIT_NP;
1: x/i $pc
=> 0x7f818ad08660 <pthread_mutex_lock>: mov    0x4ba9(%rip),%rax        # 0x7f818ad0d210
(gdb) bt
#0  pthread_mutex_lock (mutex=0x6110000002c8) at .../rr/src/preload/overrides.c:24
rr-debugger#1  0x0000564caa0e2ddc in rr::CompressedWriter::CompressedWriter (this=0x6110000002c0, filename=..., block_size=1048576, num_threads=1) at .../rr/src/CompressedWriter.cc:62
rr-debugger#2  0x0000564caa5a9453 in rr::TraceWriter::TraceWriter (this=0x619000003380, file_name=..., output_trace_dir=..., ticks_semantics_=rr::TICKS_RETIRED_CONDITIONAL_BRANCHES) at .../rr/src/TraceStream.cc:1307
...
(gdb) stepi
74        return __pthread_mutex_lock(mutex);
1: x/i $pc
=> 0x7f818ad08678 <pthread_mutex_lock+24>:      jmp    0x7f818ad03070
(gdb) bt
#0  pthread_mutex_lock (mutex=0x6110000002c8) at .../rr/src/preload/overrides.c:74
rr-debugger#1  0x0000564caa0e2ddc in rr::CompressedWriter::CompressedWriter (this=0x6110000002c0, filename=..., block_size=1048576, num_threads=1) at .../rr/src/CompressedWriter.cc:62
rr-debugger#2  0x0000564caa5a9453 in rr::TraceWriter::TraceWriter (this=0x619000003380, file_name=..., output_trace_dir=..., ticks_semantics_=rr::TICKS_RETIRED_CONDITIONAL_BRANCHES) at .../rr/src/TraceStream.cc:1307
...
(gdb) print environ
$1 = (char **) 0x0

$ cat /proc/1305400/environ | tr '\0' '\n' | grep LD_PRELOAD
LD_PRELOAD=libasan.so.6:.../x86_64_asan/obj/bin/../lib/rr/librrpreload.so:::
bernhardu added a commit to bernhardu/rr that referenced this pull request Jun 25, 2021
These two tests are stuck:
  nested_detach-no-syscallbuf
  nested_detach-32-no-syscallbuf

For some reason just the no-syscallbuf variants get stuck,
the regular ones succeed.

$ bin/rr record -n bin/rr record --nested=detach bin/simple

PID 1305400 uses 100% CPU, until timeout kills all.

1305387    └─ bin/rr record -n bin/rr record --nested=detach bin/simple  12
1305399       ├─ bin/rr record --nested=detach bin/simple   1
1305400       └─ bin/rr record --nested=detach bin/simple   1

$ gdb -q --pid 1305400
(gdb) add-symbol-file /usr/lib/x86_64-linux-gnu/libasan.so.6.0.0 0x7f818ad37a60
(gdb) add-symbol-file .../x86_64_asan/obj/bin/rr 0x564caa04e830
(gdb) add-symbol-file .../x86_64_asan/obj/lib/rr/librrpreload.so 0x7f818ad030d0
(gdb) stepi
0x00007f818ad50339      4150      int res = REAL(pthread_mutex_lock)(m);
1: x/i $pc
=> 0x7f818ad50339 <__interceptor_pthread_mutex_lock(void*)+25>: jmp    *0xf4311(%rip)        # 0x7f818ae44650
(gdb) bt
#0  0x00007f818ad50339 in __interceptor_pthread_mutex_lock (m=<optimized out>) at ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4150
rr-debugger#1  __interceptor_pthread_mutex_lock (m=<optimized out>) at ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4146
rr-debugger#2  0x0000564caa0e2ddc in rr::CompressedWriter::CompressedWriter (this=0x6110000002c0, filename=..., block_size=1048576, num_threads=1) at .../rr/src/CompressedWriter.cc:62
rr-debugger#3  0x0000564caa5a9453 in rr::TraceWriter::TraceWriter (this=0x619000003380, file_name=..., output_trace_dir=..., ticks_semantics_=rr::TICKS_RETIRED_CONDITIONAL_BRANCHES) at .../rr/src/TraceStream.cc:1307
rr-debugger#4  0x0000564caa2b9ed2 in rr::RecordSession::RecordSession (this=0x619000003280, exe_path=..., argv=..., envp=..., disable_cpuid_features=..., syscallbuf=rr::RecordSession::ENABLE_SYSCALL_BUF, syscallbuf_desched_sig=30, bind_cpu=rr::BIND_CPU, output_trace_dir=..., trace_id=0x0, use_audit=false, unmap_vdso=false) at .../rr/src/RecordSession.cc:2296
rr-debugger#5  0x0000564caa2b92ea in rr::RecordSession::create (argv=..., extra_env=..., disable_cpuid_features=..., syscallbuf=rr::RecordSession::ENABLE_SYSCALL_BUF, syscallbuf_desched_sig=30 '\036', bind_cpu=rr::BIND_CPU, output_trace_dir=..., trace_id=0x0, use_audit=false, unmap_vdso=false, force_asan_active=false) at .../rr/src/RecordSession.cc:2261
rr-debugger#6  0x0000564caa29cd01 in rr::record (args=..., flags=...) at .../rr/src/RecordCommand.cc:632
rr-debugger#7  0x0000564caa29e90f in rr::RecordCommand::run (this=0x564caa956fe0, args=...) at .../rr/src/RecordCommand.cc:791
rr-debugger#8  0x0000564caa614909 in main (argc=4, argv=0x7ffd2a91dbe8) at .../rr/src/main.cc:271
...
(gdb) stepi
pthread_mutex_lock (mutex=0x6110000002c8) at .../rr/src/preload/overrides.c:24
24        mutex->__data.__kind &= ~PTHREAD_MUTEX_PRIO_INHERIT_NP;
1: x/i $pc
=> 0x7f818ad08660 <pthread_mutex_lock>: mov    0x4ba9(%rip),%rax        # 0x7f818ad0d210
(gdb) bt
#0  pthread_mutex_lock (mutex=0x6110000002c8) at .../rr/src/preload/overrides.c:24
rr-debugger#1  0x0000564caa0e2ddc in rr::CompressedWriter::CompressedWriter (this=0x6110000002c0, filename=..., block_size=1048576, num_threads=1) at .../rr/src/CompressedWriter.cc:62
rr-debugger#2  0x0000564caa5a9453 in rr::TraceWriter::TraceWriter (this=0x619000003380, file_name=..., output_trace_dir=..., ticks_semantics_=rr::TICKS_RETIRED_CONDITIONAL_BRANCHES) at .../rr/src/TraceStream.cc:1307
...
(gdb) stepi
74        return __pthread_mutex_lock(mutex);
1: x/i $pc
=> 0x7f818ad08678 <pthread_mutex_lock+24>:      jmp    0x7f818ad03070
(gdb) bt
#0  pthread_mutex_lock (mutex=0x6110000002c8) at .../rr/src/preload/overrides.c:74
rr-debugger#1  0x0000564caa0e2ddc in rr::CompressedWriter::CompressedWriter (this=0x6110000002c0, filename=..., block_size=1048576, num_threads=1) at .../rr/src/CompressedWriter.cc:62
rr-debugger#2  0x0000564caa5a9453 in rr::TraceWriter::TraceWriter (this=0x619000003380, file_name=..., output_trace_dir=..., ticks_semantics_=rr::TICKS_RETIRED_CONDITIONAL_BRANCHES) at .../rr/src/TraceStream.cc:1307
...
(gdb) print environ
$1 = (char **) 0x0

$ cat /proc/1305400/environ | tr '\0' '\n' | grep LD_PRELOAD
LD_PRELOAD=libasan.so.6:.../x86_64_asan/obj/bin/../lib/rr/librrpreload.so:::
bernhardu added a commit to bernhardu/rr that referenced this pull request Jul 5, 2021
These two tests are stuck:
  nested_detach-no-syscallbuf
  nested_detach-32-no-syscallbuf

For some reason just the no-syscallbuf variants get stuck,
the regular ones succeed.

$ bin/rr record -n bin/rr record --nested=detach bin/simple

PID 1305400 uses 100% CPU, until timeout kills all.

1305387    └─ bin/rr record -n bin/rr record --nested=detach bin/simple  12
1305399       ├─ bin/rr record --nested=detach bin/simple   1
1305400       └─ bin/rr record --nested=detach bin/simple   1

$ gdb -q --pid 1305400
(gdb) add-symbol-file /usr/lib/x86_64-linux-gnu/libasan.so.6.0.0 0x7f818ad37a60
(gdb) add-symbol-file .../x86_64_asan/obj/bin/rr 0x564caa04e830
(gdb) add-symbol-file .../x86_64_asan/obj/lib/rr/librrpreload.so 0x7f818ad030d0
(gdb) stepi
0x00007f818ad50339      4150      int res = REAL(pthread_mutex_lock)(m);
1: x/i $pc
=> 0x7f818ad50339 <__interceptor_pthread_mutex_lock(void*)+25>: jmp    *0xf4311(%rip)        # 0x7f818ae44650
(gdb) bt
#0  0x00007f818ad50339 in __interceptor_pthread_mutex_lock (m=<optimized out>) at ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4150
rr-debugger#1  __interceptor_pthread_mutex_lock (m=<optimized out>) at ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4146
rr-debugger#2  0x0000564caa0e2ddc in rr::CompressedWriter::CompressedWriter (this=0x6110000002c0, filename=..., block_size=1048576, num_threads=1) at .../rr/src/CompressedWriter.cc:62
rr-debugger#3  0x0000564caa5a9453 in rr::TraceWriter::TraceWriter (this=0x619000003380, file_name=..., output_trace_dir=..., ticks_semantics_=rr::TICKS_RETIRED_CONDITIONAL_BRANCHES) at .../rr/src/TraceStream.cc:1307
rr-debugger#4  0x0000564caa2b9ed2 in rr::RecordSession::RecordSession (this=0x619000003280, exe_path=..., argv=..., envp=..., disable_cpuid_features=..., syscallbuf=rr::RecordSession::ENABLE_SYSCALL_BUF, syscallbuf_desched_sig=30, bind_cpu=rr::BIND_CPU, output_trace_dir=..., trace_id=0x0, use_audit=false, unmap_vdso=false) at .../rr/src/RecordSession.cc:2296
rr-debugger#5  0x0000564caa2b92ea in rr::RecordSession::create (argv=..., extra_env=..., disable_cpuid_features=..., syscallbuf=rr::RecordSession::ENABLE_SYSCALL_BUF, syscallbuf_desched_sig=30 '\036', bind_cpu=rr::BIND_CPU, output_trace_dir=..., trace_id=0x0, use_audit=false, unmap_vdso=false, force_asan_active=false) at .../rr/src/RecordSession.cc:2261
rr-debugger#6  0x0000564caa29cd01 in rr::record (args=..., flags=...) at .../rr/src/RecordCommand.cc:632
rr-debugger#7  0x0000564caa29e90f in rr::RecordCommand::run (this=0x564caa956fe0, args=...) at .../rr/src/RecordCommand.cc:791
rr-debugger#8  0x0000564caa614909 in main (argc=4, argv=0x7ffd2a91dbe8) at .../rr/src/main.cc:271
...
(gdb) stepi
pthread_mutex_lock (mutex=0x6110000002c8) at .../rr/src/preload/overrides.c:24
24        mutex->__data.__kind &= ~PTHREAD_MUTEX_PRIO_INHERIT_NP;
1: x/i $pc
=> 0x7f818ad08660 <pthread_mutex_lock>: mov    0x4ba9(%rip),%rax        # 0x7f818ad0d210
(gdb) bt
#0  pthread_mutex_lock (mutex=0x6110000002c8) at .../rr/src/preload/overrides.c:24
rr-debugger#1  0x0000564caa0e2ddc in rr::CompressedWriter::CompressedWriter (this=0x6110000002c0, filename=..., block_size=1048576, num_threads=1) at .../rr/src/CompressedWriter.cc:62
rr-debugger#2  0x0000564caa5a9453 in rr::TraceWriter::TraceWriter (this=0x619000003380, file_name=..., output_trace_dir=..., ticks_semantics_=rr::TICKS_RETIRED_CONDITIONAL_BRANCHES) at .../rr/src/TraceStream.cc:1307
...
(gdb) stepi
74        return __pthread_mutex_lock(mutex);
1: x/i $pc
=> 0x7f818ad08678 <pthread_mutex_lock+24>:      jmp    0x7f818ad03070
(gdb) bt
#0  pthread_mutex_lock (mutex=0x6110000002c8) at .../rr/src/preload/overrides.c:74
rr-debugger#1  0x0000564caa0e2ddc in rr::CompressedWriter::CompressedWriter (this=0x6110000002c0, filename=..., block_size=1048576, num_threads=1) at .../rr/src/CompressedWriter.cc:62
rr-debugger#2  0x0000564caa5a9453 in rr::TraceWriter::TraceWriter (this=0x619000003380, file_name=..., output_trace_dir=..., ticks_semantics_=rr::TICKS_RETIRED_CONDITIONAL_BRANCHES) at .../rr/src/TraceStream.cc:1307
...
(gdb) print environ
$1 = (char **) 0x0

$ cat /proc/1305400/environ | tr '\0' '\n' | grep LD_PRELOAD
LD_PRELOAD=libasan.so.6:.../x86_64_asan/obj/bin/../lib/rr/librrpreload.so:::
bernhardu added a commit to bernhardu/rr that referenced this pull request Apr 7, 2023
…aks=0.

==2156196==Running thread 2156188 was not suspended. False leaks are possible.

=================================================================
==2156193==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 10525163 byte(s) in 11 object(s) allocated from:
    #0 0x7f41d28b94c8 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:95
    rr-debugger#1 0x55c53c6587a4 in std::__new_allocator<unsigned char>::allocate(unsigned long, void const*) /usr/include/c++/12/bits/new_allocator.h:137
    rr-debugger#2 0x55c53c6587a4 in std::allocator_traits<std::allocator<unsigned char> >::allocate(std::allocator<unsigned char>&, unsigned long) /usr/include/c++/12/bits/alloc_traits.h:464
    rr-debugger#3 0x55c53c6587a4 in std::_Vector_base<unsigned char, std::allocator<unsigned char> >::_M_allocate(unsigned long) /usr/include/c++/12/bits/stl_vector.h:378
    rr-debugger#4 0x55c53c6587a4 in std::vector<unsigned char, std::allocator<unsigned char> >::_M_default_append(unsigned long) /usr/include/c++/12/bits/vector.tcc:650
    rr-debugger#5 0x55c53c69370b in std::vector<unsigned char, std::allocator<unsigned char> >::resize(unsigned long) /usr/include/c++/12/bits/stl_vector.h:1011
    rr-debugger#6 0x55c53c69370b in rr::CompressedWriter::compression_thread() /home/bernhard/data/entwicklung/2023/rr/2022-09-11/rr/src/CompressedWriter.cc:162
    rr-debugger#7 0x55c53c693908 in rr::CompressedWriter::compression_thread_callback(void*) /home/bernhard/data/entwicklung/2023/rr/2022-09-11/rr/src/CompressedWriter.cc:29
    rr-debugger#8 0x7f41d22a7fd3 in start_thread nptl/pthread_create.c:442

SUMMARY: AddressSanitizer: 10525163 byte(s) leaked in 11 allocation(s).
Keno added a commit to ChronitonAI/rr that referenced this pull request Oct 6, 2026
When rr removes a range from its model of an address space, it also
unmaps its local copies of the mappings in the range (rr maps syscall
buffers into its own address space too). The range passed to the
callback starts where the previous mapping ended, so it can start before
the mapping. Then the local address computed for the munmap was below
the mapping's local copy, and the size was too large, so rr unmapped
other memory of its own below that copy. 1be3973 limited the end of the
local munmap to the end of the mapping, but not its start.

This happens in replay: when a vfork child execs, its syscall buffer and
scratch memory stay behind in the address space it shared with its
parent. rr unmaps them while recording (since a6a80fd), but not in
replay, so they stay in replay's model with their local copies. When the
tracee later maps memory over a range that starts below the dead syscall
buffer, which is free in the recording, rr unmapped the local copy of a
live syscall buffer that it had mapped right below the dead one in its
own address space, and then crashed when it read that buffer:

  Program received signal SIGSEGV
  #0  __memmove_avx_unaligned_erms ()
  #1  rr::Task::read_bytes_fallible (...) at src/Task.cc:3176
  ...
  rr-debugger#4  rr::ReplaySession::setup_replay_one_trace_frame (...)

A program whose threads spawn processes with posix_spawn() hit this in
replay of 1 of 40 recordings with --chaos: replay maps a new task's
scratch memory at the address it had in the recording, over 1 MiB of
free memory and a dead syscall buffer.

So unmap the local copy of only the part of the range that the mapping
covers.

Test: in vfork_exec_map_over_buffers, a vfork child sets up its syscall
buffer and execs a process that sets up its own and then waits. Then the
parent maps memory over 16 MiB of free memory below where the child's
syscall buffer was, and over the buffer itself, and the exec'd process
uses its syscall buffer again. To put free memory below the child's
syscall buffer, the parent first fills the memory after its own syscall
buffer, where rr puts the next one, and frees it after the child execs.
This is deterministic. Without the syscall buffer the test does nothing.

Results on x86_64 (Linux 7.0, glibc 2.31):
- Without this change, the test fails in every run with the syscall
  buffer (20 of 20 per bitness: rr crashes in replay), and passes
  without it.
- With this change, it passes in 50 of 50 runs in each of the four
  variants (64- and 32-bit, with and without the syscall buffer), and
  natively in 500 of 500 runs per bitness.
- The recording that crashed in replay now replays to the end, with the
  same output as the recording.
- The full test suite shows no new failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keno added a commit to ChronitonAI/rr that referenced this pull request Oct 6, 2026
…e starts before it

When rr removes a range from its model of an address space, it also
unmaps its local copies of the mappings in the range (rr maps syscall
buffers into its own address space too). The range passed to the
callback is the part of the range not yet processed: it starts at the
start of the range, or where the previous mapping in it ended, so it can
start before the mapping. Then the local address computed for the munmap
was below the mapping's local copy, and the size was too large, so rr
unmapped the whole local copy and as much of its own memory below it as
the range extends below the mapping, whether the range covers the
mapping fully or partly. 1be3973 limited the end of the local munmap to
the end of the mapping, but not its start.

This happens in replay: when a vfork child execs, its syscall buffer and
scratch memory stay behind in the address space it shared with its
parent. rr unmaps them while recording (since a6a80fd), but not in
replay (the next commit fixes that), so they stay in replay's model with
their local copies. When the tracee later maps memory over a range that
starts below the dead syscall buffer, which is free in the recording, rr
unmapped the local copy of a live syscall buffer that it had mapped
right below the dead one in its own address space, and then crashed when
it read that buffer:

  Program received signal SIGSEGV
  #0  __memmove_avx_unaligned_erms ()
  #1  rr::Task::read_bytes_fallible (...) at src/Task.cc:3176
  ...
  rr-debugger#4  rr::ReplaySession::setup_replay_one_trace_frame (...)

A program whose threads spawn processes with posix_spawn() hit this in
replay of 1 of 40 recordings with --chaos: replay maps a new task's
scratch memory at the address it had in the recording, over 1 MiB of
free memory and a dead syscall buffer.

So unmap the local copy of only the part of the range that the mapping
covers.

Test: in vfork_exec_map_over_buffers, a vfork child sets up its syscall
buffer and execs a process that sets up its own and then waits. Then the
parent maps memory over 16 MiB of free memory below where the child's
syscall buffer was, and over the buffer itself, and the exec'd process
uses its syscall buffer again. To put free memory below the child's
syscall buffer, the parent first fills the memory after its own syscall
buffer, where rr puts the next one, and frees it after the child execs.
This is deterministic. Without the syscall buffer the test does nothing.
After the next commit, replay no longer has the dead buffer in its
model, so the test doesn't reach this path anymore; the fix still
applies to any range that starts below a local mapping.

Results on x86_64 (Linux 7.0, glibc 2.31):
- Without this change, the test fails in every run with the syscall
  buffer (20 of 20 per bitness: rr crashes in replay), and passes
  without it.
- With this change, it passes in 50 of 50 runs in each of the four
  variants (64- and 32-bit, with and without the syscall buffer), and
  natively in 500 of 500 runs per bitness.
- The recording that crashed in replay now replays to the end, with the
  same output as the recording.
- The full test suite shows no new failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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