Verification Report
===================

The test is conducted on an RK3399 device (with 4x ARM Cortex-A53 cores
+ 2x ARM Cortex-A72 cores).


Test (1) original Rust program test (associated-types.rs)
---------------------------------------------------------

GDB 12.1-0ubuntu1~22.04 (unpatched)
Rust 1.70.0+dfsg0ubuntu1~bpo2-0ubuntu0.22.04.2

Test program source: https://github.com/rust-
lang/rust/blob/1.68.2/tests/debuginfo/associated-types.rs

GDB script content:
```
b associated-types.rs:111
r
c
```

Result:

```
Breakpoint 1 at 0x4838: file associated-types.rs, line 111.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

Breakpoint 1, associated_types::assoc_struct<i32> (arg=...) at 
associated-types.rs:111
111         zzz(); // #break

Program received signal SIGILL, Illegal instruction.
0x00404ec4 in core::slice::cmp::{impl#5}::equal<u8, u8> (self=..., other=...) 
at library/core/src/slice/cmp.rs:91
91      library/core/src/slice/cmp.rs: No such file or directory.
```

>>> SRU'ed package:

GDB 12.1-0ubuntu1~22.04.1 (patched)
GCC 11.4.0-1ubuntu1~22.04

Result:
```
Breakpoint 1 at 0x4838: file associated-types.rs, line 111.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

Breakpoint 1, associated_types::assoc_struct<i32> (arg=...) at 
associated-types.rs:111
111         zzz(); // #break
[Inferior 1 (process 3621) exited normally]
```

Test (2) simplified C program test (test.c)
-------------------------------------------

GDB 12.1-0ubuntu1~22.04 (unpatched)
GCC 11.4.0-1ubuntu1~22.04

Test program source:
```
__attribute__((target("arm"), noinline))
int thumb_func() {
  return 42;
}

__attribute__((target("thumb")))
int main() { return thumb_func(); }
```

Commands:
```
gcc -Og -ggdb3 test.c -o test
printf "b 3\nr\nc\n" > repro
gdb --batch -x ./repro ./test
```

Result:
```
Breakpoint 1 at 0x4d8: file test.c, line 3.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

Breakpoint 1, thumb_func () at test.c:3
3         return 42;

Program received signal SIGILL, Illegal instruction.
0x00401004 in ?? ()
```

Disassembly of the crash site (ARM code):

```
=> 0x004004d8 <+0>:     mov     r0, #42 ; 0x2a
   0x004004dc <+4>:     bx      lr
```

Disassembly of the call site (Thumb code, +2 bytes):
```
   0x004004e0 <+0>:     push    {r3, lr}
   0x004004e2 <+2>:     blx     0x4004d8 <thumb_func>
=> 0x004004e6 <+6>:     pop     {r3, pc}
```

>>> SRU'ed package:

GDB 12.1-0ubuntu1~22.04.1 (patched)
GCC 11.4.0-1ubuntu1~22.04

Result:
```
Breakpoint 1 at 0x4d8: file test.c, line 3.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

Breakpoint 1, thumb_func () at test.c:3
3         return 42;
[Inferior 1 (process 3611) exited with code 052]
```


Conclusion
----------
GDB 12.1-0ubuntu1~22.04.1 package correctly fixed the issue described in the 
bug report.


** Tags removed: verification-needed verification-needed-jammy
** Tags added: verification-done verification-done-jammy

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to gdb in Ubuntu.
https://bugs.launchpad.net/bugs/2041396

Title:
  gdb 12.1 generates SIGILL on armhf

Status in gdb:
  Fix Released
Status in gdb package in Ubuntu:
  Fix Released
Status in gdb source package in Jammy:
  Fix Committed

Bug description:
  [ Impact ]

   * GDB 12.1 introduced a regression where it will break program execution 
when the program contains mixed ARM code and THUMB code.
   * Upstream stated they tested the changes on Ubuntu 20.04 and it went okay.

  [ Test Plan ]

  Considering the following C program:

  ```
  __attribute__((target("arm"), noinline))
  int thumb_func() {
    return 42;
  }

  __attribute__((target("thumb")))
  int main() { return thumb_func(); }
  ```

  If you build it using `gcc repro.c -ggdb3 -Og -o repro` and run the
  GDB using the following commands ...

  ```
  b 3
  r
  c
  ```

  (you can save the contents above to a file and run GDB using `gdb -x
  script ./repro`)

  ... you will notice GDB broke the program and threw SIGILL.
  If you run the program without GDB, the program exits normally.

  [ Where problems could occur ]

   * GDB is a complex software. As the patch suggests, it may break other use 
cases (like single-stepping) entirely.
   * Since this is an ARM-only patch, it's unlikely to affect other CPU 
architectures. However, it is possible that this fix may break ARM64 execution.

  [ Other Info ]
   
   * This bug has been fixed in GDB 13, but the fix was never backported to GDB 
12. You can find the upstream bug in the remote bug watch.

To manage notifications about this bug go to:
https://bugs.launchpad.net/gdb/+bug/2041396/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to