gdb 12.1 generates SIGILL on armhf
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gdb |
Fix Released
|
Medium
|
|||
gdb (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Jammy |
Incomplete
|
Undecided
|
Unassigned |
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_
int thumb_func() {
return 42;
}
__attribute_
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.
Related branches
- Sergio Durigan Junior (community): Approve
- git-ubuntu import: Pending requested
-
Diff: 333 lines (+285/-2)6 files modifieddebian/changelog (+7/-0)
debian/control (+2/-1)
debian/control.in (+2/-1)
debian/patches/Make-sure-a-copy_insn_closure-is-available-when-we-h.patch (+103/-0)
debian/patches/Only-allow-closure-lookup-by-address-if-there-are-th.patch (+167/-0)
debian/patches/series (+4/-0)
affects: | gdb (Debian) → gdb |
description: | updated |
Changed in gdb: | |
importance: | Unknown → Medium |
status: | Unknown → Fix Released |
Changed in gdb (Ubuntu Jammy): | |
milestone: | none → jammy-updates |
Changed in gdb (Ubuntu): | |
milestone: | jammy-updates → none |
Created attachment 14158
rustc debuginfo test sample #1
1. Compile the attached test file `rustc -g associated- types.rs` . types`, dbg.script as follows:
2. Run `gdb -x dbg.script ./associated-
~~~~ load-safe- path /home/infinity0 /rustc/ ./src/etc /rustc/ ./src/etc /rustc/ build/armv7- unknown- linux-gnueabihf /test/debuginfo /associated- types.gdb/ a types.rs' :111 types.rs' :118 types.rs' :122 types.rs' :130 types.rs' :137 types.rs' :140
set charset UTF-8
show version
add-auto-
set print pretty off
directory /home/infinity0
file /home/infinity0
set language rust
break 'associated-
break 'associated-
break 'associated-
break 'associated-
break 'associated-
break 'associated-
run
print arg
continue
print inferred
print explicitly
continue
print arg
continue
print arg
continue
print a
print b
continue
print a
print b
continue
quit
~~~~
This works for all rustc versions (I was able to test 1.13 - 1.59) on gdb 10 but fails with SIGILL on gdb 11.2 armhf Debian.
Other rustc debuginfo tests fail with other signals, SIGSEGV, SIGABRT, etc. More specific details here: https:/ /github. com/rust- lang/rust/ issues/ 96983