Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion `!comparison.mismatch_count' failed to hold. Mismatched registers #3630

Closed
teymour-aldridge opened this issue Oct 12, 2023 · 5 comments

Comments

@teymour-aldridge
Copy link

teymour-aldridge commented Oct 12, 2023

I apologise if this is not actually a bug, but I think it might be.

I am using an M1 MacBook Pro (AArch64) running Asahi Linux Fedora with rr built from source (the same issue persists with rr installed from dnf). I have a toy C program

#include <stdio.h>

int main() {
  int x = 0;
  for (int i=0; i<10; i++) {
    printf("x = %d", x);
    x++;
  }
  return 0;
}

which I compiled with gcc.

When I run rr record followed by rr replay, set a breakpoint for main and continue I get the following error

[teymour@asd432 ctesting]$ rr replay
BFD: warning: system-supplied DSO at 0x6ffd0000 has a section extending past end of file

This GDB supports auto-downloading debuginfo from the following URLs:
  <https://debuginfod.fedoraproject.org/>
Enable debuginfod for this session? (y or [n]) y
Debuginfod has been enabled.
To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.
_start () at ../sysdeps/aarch64/dl-start.S:22                                                                                                                        
22      ENTRY (_start)                                                                                                                                               
(rr) b main
Breakpoint 1 at 0x4101b0: file main.c, line 4.
(rr) continue
Continuing.
[FATAL src/ReplayTask.cc:130:validate_regs()] 
 (task 20338 (rec:20224) at time 7)
 -> Assertion `!comparison.mismatch_count' failed to hold. Mismatched registers, replay vs rec: x[30] 0xdffff02104b20 != 0x55ffff02104b20
Tail of trace dump:
=== Start rr backtrace:
rr(_ZN2rr9GdbServer15emergency_debugEPNS_4TaskE+0xe0)[0x48c1c0]
rr[0x49df9c]
rr[0x49eb9c]
rr(_ZN2rr10ReplayTask13validate_regsEj+0xa4)[0x534a14]
rr(_ZN2rr13ReplaySession13enter_syscallEPNS_10ReplayTaskERKNS0_15StepConstraintsE+0x330)[0x51e5a0]
rr(_ZN2rr13ReplaySession11replay_stepERKNS0_15StepConstraintsE+0x104)[0x526f04]
rr(_ZN2rr14ReplayTimeline19replay_step_forwardENS_10RunCommandE+0x84)[0x540848]
rr(_ZN2rr9GdbServer14debug_one_stepERNS_10GdbRequestE+0x1f8)[0x486fa8]
rr(_ZN2rr9GdbServer12serve_replayERKNS0_15ConnectionFlagsE+0x584)[0x487fa4]
rr[0x51cad8]
rr(_ZN2rr13ReplayCommand3runERSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS7_EE+0x448)[0x51d1dc]
rr(main+0x168)[0x433a98]
/lib64/libc.so.6(+0x30598)[0xffff4f610598]
/lib64/libc.so.6(__libc_start_main+0x9c)[0xffff4f610670]
rr(_start+0x30)[0x435030]
=== End rr backtrace
Launch gdb with
  gdb '-l' '10000' '-ex' 'set sysroot /' '-ex' 'target extended-remote 127.0.0.1:20338' /home/teymour/.local/share/rr/a.out-4/mmap_clone_4_a.out
(rr) 

after which the program no longer works. Unfortunately I don't really know what this means.

@rocallahan
Copy link
Collaborator

Try rr record -n ?

@teymour-aldridge
Copy link
Author

I get the same error, unfortunately

[teymour@asd432 ctesting]$ rr record -n ./a.out
rr: Saving execution to trace directory `/home/teymour/.local/share/rr/a.out-5'.
[teymour@asd432 ctesting]$ rr replay
GNU gdb (GDB) Fedora Linux 13.2-5.fc38
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "aarch64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
--Type <RET> for more, q to quit, c to continue without paging--c
Reading symbols from /home/teymour/.local/share/rr/a.out-5/mmap_clone_4_a.out...
Really redefine built-in command "restart"? (y or n) [answered Y; input not from terminal]
Really redefine built-in command "jump"? (y or n) [answered Y; input not from terminal]
Remote debugging using 127.0.0.1:5576
Reading symbols from /lib/ld-linux-aarch64.so.1...
BFD: warning: system-supplied DSO at 0x6ffd0000 has a section extending past end of file

This GDB supports auto-downloading debuginfo from the following URLs:
  <https://debuginfod.fedoraproject.org/>
Enable debuginfod for this session? (y or [n]) y
Debuginfod has been enabled.
To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.
Downloading separate debug info for system-supplied DSO at 0x6ffd0000
_start () at ../sysdeps/aarch64/dl-start.S:22                                                                                                     
22      ENTRY (_start)                                                                                                                            
(rr) b main
Breakpoint 1 at 0x4101b0: file main.c, line 4.
(rr) continue
Continuing.
[FATAL src/ReplayTask.cc:130:validate_regs()] 
 (task 5577 (rec:5563) at time 7)
 -> Assertion `!comparison.mismatch_count' failed to hold. Mismatched registers, replay vs rec: x[30] 0x4affff67f8cb20 != 0x58ffff67f8cb20
Tail of trace dump:
=== Start rr backtrace:
rr(_ZN2rr9GdbServer15emergency_debugEPNS_4TaskE+0xe0)[0x48c1c0]
rr[0x49df9c]
rr[0x49eb9c]
rr(_ZN2rr10ReplayTask13validate_regsEj+0xa4)[0x534a14]
rr(_ZN2rr13ReplaySession13enter_syscallEPNS_10ReplayTaskERKNS0_15StepConstraintsE+0x330)[0x51e5a0]
rr(_ZN2rr13ReplaySession11replay_stepERKNS0_15StepConstraintsE+0x104)[0x526f04]
rr(_ZN2rr14ReplayTimeline19replay_step_forwardENS_10RunCommandE+0x84)[0x540848]
rr(_ZN2rr9GdbServer14debug_one_stepERNS_10GdbRequestE+0x1f8)[0x486fa8]
rr(_ZN2rr9GdbServer12serve_replayERKNS0_15ConnectionFlagsE+0x584)[0x487fa4]
rr[0x51cad8]
rr(_ZN2rr13ReplayCommand3runERSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS7_EE+0x448)[0x51d1dc]
rr(main+0x168)[0x433a98]
/lib64/libc.so.6(+0x30598)[0xfffed2f80598]
/lib64/libc.so.6(__libc_start_main+0x9c)[0xfffed2f80670]
rr(_start+0x30)[0x435030]
=== End rr backtrace

@rocallahan
Copy link
Collaborator

I assume rr replay -a gives you the same error.

@yuyichao I see the first byte of the pointer is different. Is this PAC, i.e. issue #3568?

@yuyichao
Copy link
Contributor

Yeah I think it’s very likely.

@rocallahan
Copy link
Collaborator

OK, duplicate of #3568

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

No branches or pull requests

3 participants