This is the mail archive of the
gdb-testers@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Check for truncated registers in process_g_packet
- From: sergiodj+buildbot at sergiodj dot net
- To: gdb-testers at sourceware dot org
- Date: Tue, 08 Nov 2016 05:49:03 -0500
- Subject: [binutils-gdb] Check for truncated registers in process_g_packet
- Authentication-results: sourceware.org; auth=none
*** TEST RESULTS FOR COMMIT 9dc193c3be85aafa60ceff57d3b0430af607b4ce ***
Author: Lionel Flandrin <lionel@svkt.org>
Branch: master
Commit: 9dc193c3be85aafa60ceff57d3b0430af607b4ce
Check for truncated registers in process_g_packet
While investigating an unrelated issue in remote.c I noticed that the
bound checking for 'g' packets was bogus:
The previous code would only check that the first byte of the register
was within bounds before passing the buffer to regcache_raw_supply.
If it turned out that the register in the 'g' packet was incomplete
then regcache_raw_supply would proceed to memcpy out-of-bounds.
Since the buffer is allocated with alloca it's relatively unlikely to
crash (you just end up dumping gdb's stack into the cache) but it's
still a bit messy.
I changed this logic to check for truncated registers and raise an
error if one is encountered. Hopefully it should make debugging
remote stubs a bit easier.
gdb/ChangeLog:
2016-11-08 Lionel Flandrin <lionel@svkt.org>
* remote.c (process_g_packet): Detect truncated registers in 'g'
packets and raise an error.
- Follow-Ups:
- Failures on Fedora-x86_64-native-gdbserver-m32, branch master
- Failures on Ubuntu-AArch64-native-gdbserver-m64, branch master
- Failures on Debian-i686-native-extended-gdbserver, branch master
- Failures on Fedora-x86_64-native-extended-gdbserver-m32, branch master
- Failures on Debian-x86_64-native-extended-gdbserver-m64, branch master
- Failures on Fedora-x86_64-native-extended-gdbserver-m64, branch master
- Failures on Fedora-ppc64be-native-gdbserver-m64, branch master
- Failures on Fedora-ppc64be-native-extended-gdbserver-m64, branch master
- Failures on Fedora-ppc64le-native-gdbserver-m64, branch master
- Failures on Fedora-ppc64le-native-extended-gdbserver-m64, branch master