Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-102003

GDB incorrectly reports rwatch trigger when watch was triggered

Linking RHIVOS CVEs to...Migration: Automation ...Sync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • rhel-9.7
    • gdb
    • None
    • Yes
    • Moderate
    • rhel-pt-gdb
    • 2
    • False
    • False
    • Hide

      None

      Show
      None
    • No
    • None
    • None
    • None
    • Unspecified Release Note Type - Unknown
    • Unspecified
    • Unspecified
    • Unspecified
    • aarch64
    • None

      When both a watch and an rwatch are set and a write triggers the watch, GDB misattributes the event to the rwatch, incorrectly reporting that the read watchpoint fired, even though no read occurred and the rwatch target was untouched.

      Please provide the package NVR for which the bug is seen:

      kernel-5.14.0-594.el9.aarch64
      gcc-11.5.0-7.el9.aarch64
      gdb-16.3-2.el9.aarch64
      

      How reproducible is this bug?:

      always

      Steps to reproduce

      # cat test.c
      int a, b;
      
      int main(){
        a = 1;
        b = 2;
        return 0;
      }
      # rpm -q kernel gcc gdb
      kernel-5.14.0-594.el9.aarch64
      gcc-11.5.0-7.el9.aarch64
      gdb-16.3-2.el9.aarch64
      # gcc -g -O0 -o test test.c
      # gdb -q ./test
      Reading symbols from ./test...
      (gdb) list
      1       int a, b;
      2
      3       int main(){
      4         a = 1;
      5         b = 2;
      6         return 0;
      7       }
      (gdb) watch a
      Hardware watchpoint 1: a
      (gdb) run
      Starting program: /root/test/test 
      [Thread debugging using libthread_db enabled]
      Using host libthread_db library "/lib64/libthread_db.so.1".
      
      Hardware watchpoint 1: a
      
      Old value = 0
      New value = 1
      main () at test.c:5
      5         b = 2;
      (gdb) continue
      Continuing.
      [Inferior 1 (process 27713) exited normally]
      (gdb) rwatch b
      Hardware read watchpoint 2: b
      (gdb) run
      Starting program: /root/test/test 
      [Thread debugging using libthread_db enabled]
      Using host libthread_db library "/lib64/libthread_db.so.1".
      
      Hardware read watchpoint 2: b
      
      Value = 0
      main () at test.c:5
      5         b = 2;
      (gdb) continue
      Continuing.
      [Inferior 1 (process 27742) exited normally]
      (gdb) delete 1
      (gdb) run
      Starting program: /root/test/test 
      [Thread debugging using libthread_db enabled]
      Using host libthread_db library "/lib64/libthread_db.so.1".
      [Inferior 1 (process 27759) exited normally]
      (gdb) quit
      #
      

      Expected results

      Only the watch on a should trigger. The rwatch on b should not trigger — there should be no output related to rwatch.

              aburgess@redhat.com Andrew Burgess
              rhn-support-mkolar Michal Kolar
              Keith Seitz Keith Seitz
              Michal Kolar Michal Kolar
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: