aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorLuis Machado <luis.machado@linaro.org>2021-05-14 11:34:06 -0300
committerLuis Machado <luis.machado@linaro.org>2021-06-28 15:20:55 -0300
commita52d0b9de195d91bdf6730e114ee09fe4d1e67ad (patch)
tree1dee5b28e29df8a2eeef71e409f57d905ff08f9f /gdb
parente660f4e9054d03549c565a762ba3a8b6e0092d99 (diff)
downloadgdb-a52d0b9de195d91bdf6730e114ee09fe4d1e67ad.zip
gdb-a52d0b9de195d91bdf6730e114ee09fe4d1e67ad.tar.gz
gdb-a52d0b9de195d91bdf6730e114ee09fe4d1e67ad.tar.bz2
Sanitize the address before working with allocation tags
Remove the logical tag/top byte from the address whenever we have to work with allocation tags. gdb/ChangeLog: 2021-06-28 Luis Machado <luis.machado@linaro.org> * aarch64-linux-tdep.c (aarch64_linux_memtag_matches_p): Remove the top byte. (aarch64_linux_set_memtags): Likewise. (aarch64_linux_get_memtag): Likewise. (aarch64_linux_report_signal_info): Likewise.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/aarch64-linux-tdep.c11
2 files changed, 17 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 92a102c..51132e4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
2021-06-28 Luis Machado <luis.machado@linaro.org>
+ * aarch64-linux-tdep.c (aarch64_linux_memtag_matches_p): Remove the top
+ byte.
+ (aarch64_linux_set_memtags): Likewise.
+ (aarch64_linux_get_memtag): Likewise.
+ (aarch64_linux_report_signal_info): Likewise.
+
+2021-06-28 Luis Machado <luis.machado@linaro.org>
+
* aarch64-linux-tdep.c
(aarch64_linux_iterate_over_regset_sections): Fix FFR register size.
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index 1670352..63c200b 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -1587,7 +1587,8 @@ aarch64_linux_memtag_matches_p (struct gdbarch *gdbarch,
CORE_ADDR addr = value_as_address (address);
/* Fetch the allocation tag for ADDRESS. */
- gdb::optional<CORE_ADDR> atag = aarch64_mte_get_atag (addr);
+ gdb::optional<CORE_ADDR> atag
+ = aarch64_mte_get_atag (address_significant (gdbarch, addr));
if (!atag.has_value ())
return true;
@@ -1625,6 +1626,9 @@ aarch64_linux_set_memtags (struct gdbarch *gdbarch, struct value *address,
}
else
{
+ /* Remove the top byte. */
+ addr = address_significant (gdbarch, addr);
+
/* Make sure we are dealing with a tagged address to begin with. */
if (!aarch64_linux_tagged_address_p (gdbarch, address))
return false;
@@ -1679,6 +1683,8 @@ aarch64_linux_get_memtag (struct gdbarch *gdbarch, struct value *address,
if (!aarch64_linux_tagged_address_p (gdbarch, address))
return nullptr;
+ /* Remove the top byte. */
+ addr = address_significant (gdbarch, addr);
gdb::optional<CORE_ADDR> atag = aarch64_mte_get_atag (addr);
if (!atag.has_value ())
@@ -1751,7 +1757,8 @@ aarch64_linux_report_signal_info (struct gdbarch *gdbarch,
uiout->field_core_addr ("fault-addr", gdbarch, fault_addr);
uiout->text ("\n");
- gdb::optional<CORE_ADDR> atag = aarch64_mte_get_atag (fault_addr);
+ gdb::optional<CORE_ADDR> atag
+ = aarch64_mte_get_atag (address_significant (gdbarch, fault_addr));
gdb_byte ltag = aarch64_mte_get_ltag (fault_addr);
if (!atag.has_value ())