Add GDB-side remote target support for memory tagging
authorLuis Machado <luis.machado@linaro.org>
Mon, 15 Jun 2020 18:18:55 +0000 (15:18 -0300)
committerLuis Machado <luis.machado@linaro.org>
Wed, 24 Mar 2021 17:48:25 +0000 (14:48 -0300)
commit2c2e7f87a81cb3834a31a81c48e37ea9bd469490
tree96ab0612a95413a5643999adf1233ab0e85cdd5d
parentc193949e75809a656b99c8408e5b29504aec436a
Add GDB-side remote target support for memory tagging

This patch adds memory tagging support to GDB's remote side, with
packet string checks, new packet support and an implementation of
the two new tags methods fetch_memtags and store_memtags.

GDBserver needs to know how to read/write allocation tags, since that is
done via ptrace.  It doesn't need to know about logical tags.

The new packets are:

qMemTags:<address>,<length>:<type>
--

Reads tags of the specified type from the address range
[<address>, <address + length>)

QMemTags:<address>,<length>:<type>:<uninterpreted tag bytes>
--
Writes the tags of specified type represented by the uninterpreted bytes to
the address range [<address>, <address + length>).

The interpretation of what to do with the tag bytes is up to the arch-specific
code.

Note that these new packets consider the case of packet size overflow as an
error, given the common use case is to read/write only a few memory tags at
a time.  Having to use a couple new packets for multi-part transfers wouldn't
make sense for the little use it would have.

gdb/ChangeLog:

2021-03-24  Luis Machado  <luis.machado@linaro.org>

* remote.c (PACKET_memory_tagging_feature): New enum.
(remote_memory_tagging_p): New function.
(remote_protocol_features): New "memory-tagging" entry.
(remote_target::remote_query_supported): Handle memory tagging
support.
(remote_target::supports_memory_tagging): Implement.
(create_fetch_memtags_request, parse_fetch_memtags_reply)
(create_store_memtags_request): New functions.
(remote_target::fetch_memtags): Implement.
(remote_target::store_memtags): Implement.
(_initialize_remote): Add new "memory-tagging-feature"
config command.
gdb/ChangeLog
gdb/remote.c