aboutsummaryrefslogtreecommitdiff
path: root/gdb/nat
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2015-12-17 13:07:54 +0000
committerYao Qi <yao.qi@linaro.org>2015-12-17 13:07:54 +0000
commitc3c874459bf57a70ccbf71a39a3a7dc3c472a201 (patch)
treeddef83d526377534e71ae055833706b40b5d7785 /gdb/nat
parent10c9892b66d56de0aab3fbaec3d59a0304dc0a21 (diff)
downloadgdb-c3c874459bf57a70ccbf71a39a3a7dc3c472a201.zip
gdb-c3c874459bf57a70ccbf71a39a3a7dc3c472a201.tar.gz
gdb-c3c874459bf57a70ccbf71a39a3a7dc3c472a201.tar.bz2
Fix one heap buffer overflow in aarch64_push_dummy_call
Hi, AddressSanitizer reports an error like this, (gdb) PASS: gdb.base/call-ar-st.exp: continue to tbreak9 print print_long_arg_list(a, b, c, d, e, f, *struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3) ================================================================= ==6236==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200008eb50 at pc 0x89e432 bp 0x7fffa3df9080 sp 0x7fffa3df9078 READ of size 5 at 0x60200008eb50 thread T0 #0 0x89e431 in memory_xfer_partial gdb/target.c:1264 #1 0x89e6c7 in target_xfer_partial gdb/target.c:1320 #2 0x89f267 in target_write_partial gdb/target.c:1595^M #3 0x8a014b in target_write_with_progress gdb/target.c:1889^M #4 0x8a0262 in target_write gdb/target.c:1914^M #5 0x89ee59 in target_write_memory gdb/target.c:1492^M #6 0x9a1c74 in write_memory gdb/corefile.c:393^M #7 0x467ea5 in aarch64_push_dummy_call gdb/aarch64-tdep.c:1388 The problem is that an instance of stack_item_t is created to adjust stack for alignment, the item.len is correct, but item.data is buf, which is wrong, because item.len can be greater than the length of buf. This patch sets item.data to NULL, and only update sp (no inferior memory writes on stack for this item). gdb: 2015-12-17 Yao Qi <yao.qi@linaro.org> * aarch64-tdep.c (struct stack_item_t): Update comments. (pass_on_stack): Set item.data to NULL. (aarch64_push_dummy_call): Call write_memory if si->data isn't NULL.
Diffstat (limited to 'gdb/nat')
0 files changed, 0 insertions, 0 deletions