rr-debugger / rr-debugger/rr

Assertion failure after stackoverflow.

Open
#1,985 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
10.7k
Forks
662
Avg merge
2d 3h
Merged PRs (30d)
2

Description

The following simple program triggers a stack overflow assuming a stack limit is set (default).

void *global;

__attribute__((noinline)) void f(void)
{
    void *buff[1024];
    buff[0] = global;
    global = buff;
    asm volatile ("" :: "r"(buff) : "memory");
    f();
}

int main()
{
    f();
    return 0;
}

During replay of this, if I access $_siginfo right after the segfault happens, rr fails with an assertion error.

Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
0x00007f7596254d70 in _start () from /lib64/ld-linux-x86-64.so.2
(rr) c
Continuing.
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?

Program received signal SIGSEGV, Segmentation fault.
0x00000000004004d5 in f ()
(rr) p $_siginfo
$1 = {si_signo = 11, si_errno = 0, si_code = 1, _sifields = {_pad = {-1090681984, 32765,
      0 <repeats 26 times>}, _kill = {si_pid = -1090681984, si_uid = 32765}, _timer = {
[FATAL /build/rr-git/src/rr/src/Task.cc:2103:read_bytes_helper() errno: EIO]
 (task 15897 (rec:15865) at time 0)
 -> Assertion `false' failed to hold. Should have read 15 bytes from 0x7ffdbefd8371, but only read 0
      si_tid = -1090681984, Launch gdb with
  gdbsi_overrun = 32765, si_sigval = { '-l' '10000' '-ex' 'target extended-remote :15897' /home/yuyichao/.local/share/rr/latest-trace/mmap_clone_3_segfault
sival_int = 0,
        sival_ptr = 0x0}}, _rt = {si_pid = -1090681984, si_uid = 32765, si_sigval = {
        sival_int = 0, sival_ptr = 0x0}}, _sigchld = {si_pid = -1090681984, si_uid = 32765,
      si_status = 0, si_utime = 0, si_stime = 0}, _sigfault = {si_addr = 0x7ffdbefd8380,
      _addr_lsb = 0, _addr_bnd = {_lower = 0x0, _upper = 0x0}}, _sigpoll = {
      si_band = 140727807738752, si_fd = 0}}}

c.c. @Keno

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by compiling and replaying the provided recursive C reproducer, then inspect rr/src/Task.cc around read_bytes_helper() at the reported assertion. Exercise the $_siginfo access after SIGSEGV and compare the attempted read with the recorded trace. Done means this scenario no longer aborts with the assertion and the signal information remains usable.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cpp, linux
Domain
devtools, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.