mbox series

[0/4] Add another way to check for MTE-tagged addresses on remote targets

Message ID 20240328070055.2578783-1-gustavo.romero@linaro.org
Headers show
Series Add another way to check for MTE-tagged addresses on remote targets | expand

Message

Gustavo Romero March 28, 2024, 7 a.m. UTC
This series introduces a new method to check for MTE-tagged addresses on
remote targets.

A new remote packet, qMemTagAddrCheck, is introduced, along with a new
remote feature associated with it, 'memory-tagging-check-add+'. Only
when 'memory-tagging-check-add+' feature is advertised GDB will use the
new packet to query if an address is tagged.

This new mechanism allows for checking MTE addresses in an OS-agnostic
way, which is necessary when debugging targets that do not support
'/proc/<PID>/smaps', as the current method of reading smaps contents
fails in such cases.

Cheers,
Gustavo

Gustavo Romero (4):
  gdb: aarch64: Remove MTE address checking from get_memtag
  gdb: aarch64: Move MTE address check out of set_memtag
  gdb: aarch64: Remove MTE address checking from memtag_matches_p
  gdb: Add new remote packet to check if address is tagged

 gdb/aarch64-linux-nat.c   |  8 +++++
 gdb/aarch64-linux-tdep.c  | 22 +++-----------
 gdb/arch-utils.c          |  2 +-
 gdb/arch-utils.h          |  2 +-
 gdb/corelow.c             |  8 +++++
 gdb/gdbarch-gen.h         |  4 +--
 gdb/gdbarch.c             |  2 +-
 gdb/gdbarch_components.py |  2 +-
 gdb/printcmd.c            | 29 +++++++++++-------
 gdb/remote.c              | 62 +++++++++++++++++++++++++++++++++++++++
 gdb/target-delegates.c    | 28 ++++++++++++++++++
 gdb/target.c              |  6 ++++
 gdb/target.h              |  6 ++++
 13 files changed, 147 insertions(+), 34 deletions(-)

Comments

Luis Machado March 28, 2024, 1 p.m. UTC | #1
Hi Gustavo,

On 3/28/24 07:00, Gustavo Romero wrote:
> This series introduces a new method to check for MTE-tagged addresses on
> remote targets.
> 
> A new remote packet, qMemTagAddrCheck, is introduced, along with a new
> remote feature associated with it, 'memory-tagging-check-add+'. Only
> when 'memory-tagging-check-add+' feature is advertised GDB will use the
> new packet to query if an address is tagged.
> 
> This new mechanism allows for checking MTE addresses in an OS-agnostic
> way, which is necessary when debugging targets that do not support
> '/proc/<PID>/smaps', as the current method of reading smaps contents
> fails in such cases.
> 
> Cheers,
> Gustavo
> 
> Gustavo Romero (4):
>   gdb: aarch64: Remove MTE address checking from get_memtag
>   gdb: aarch64: Move MTE address check out of set_memtag
>   gdb: aarch64: Remove MTE address checking from memtag_matches_p
>   gdb: Add new remote packet to check if address is tagged
> 
>  gdb/aarch64-linux-nat.c   |  8 +++++
>  gdb/aarch64-linux-tdep.c  | 22 +++-----------
>  gdb/arch-utils.c          |  2 +-
>  gdb/arch-utils.h          |  2 +-
>  gdb/corelow.c             |  8 +++++
>  gdb/gdbarch-gen.h         |  4 +--
>  gdb/gdbarch.c             |  2 +-
>  gdb/gdbarch_components.py |  2 +-
>  gdb/printcmd.c            | 29 +++++++++++-------
>  gdb/remote.c              | 62 +++++++++++++++++++++++++++++++++++++++
>  gdb/target-delegates.c    | 28 ++++++++++++++++++
>  gdb/target.c              |  6 ++++
>  gdb/target.h              |  6 ++++
>  13 files changed, 147 insertions(+), 34 deletions(-)
> 

Thanks for the series. Please bear with me while I go through it and try it on my end.
Gustavo Romero March 28, 2024, 10:59 p.m. UTC | #2
Hi Luis,

On 3/28/24 10:00 AM, Luis Machado wrote:
> Hi Gustavo,
> 
> On 3/28/24 07:00, Gustavo Romero wrote:
>> This series introduces a new method to check for MTE-tagged addresses on
>> remote targets.
>>
>> A new remote packet, qMemTagAddrCheck, is introduced, along with a new
>> remote feature associated with it, 'memory-tagging-check-add+'. Only
>> when 'memory-tagging-check-add+' feature is advertised GDB will use the
>> new packet to query if an address is tagged.
>>
>> This new mechanism allows for checking MTE addresses in an OS-agnostic
>> way, which is necessary when debugging targets that do not support
>> '/proc/<PID>/smaps', as the current method of reading smaps contents
>> fails in such cases.
>>
>> Cheers,
>> Gustavo
>>
>> Gustavo Romero (4):
>>    gdb: aarch64: Remove MTE address checking from get_memtag
>>    gdb: aarch64: Move MTE address check out of set_memtag
>>    gdb: aarch64: Remove MTE address checking from memtag_matches_p
>>    gdb: Add new remote packet to check if address is tagged
>>
>>   gdb/aarch64-linux-nat.c   |  8 +++++
>>   gdb/aarch64-linux-tdep.c  | 22 +++-----------
>>   gdb/arch-utils.c          |  2 +-
>>   gdb/arch-utils.h          |  2 +-
>>   gdb/corelow.c             |  8 +++++
>>   gdb/gdbarch-gen.h         |  4 +--
>>   gdb/gdbarch.c             |  2 +-
>>   gdb/gdbarch_components.py |  2 +-
>>   gdb/printcmd.c            | 29 +++++++++++-------
>>   gdb/remote.c              | 62 +++++++++++++++++++++++++++++++++++++++
>>   gdb/target-delegates.c    | 28 ++++++++++++++++++
>>   gdb/target.c              |  6 ++++
>>   gdb/target.h              |  6 ++++
>>   13 files changed, 147 insertions(+), 34 deletions(-)
>>
> 
> Thanks for the series. Please bear with me while I go through it and try it on my end.

Thanks a lot! I've sent a v2 [0] that fixes a build error and also has
instructions on how to build a QEMU gdbstub that supports the new packet
so it's possible to test the remote target with this series.


Cheers,
Gustavo

[0] https://sourceware.org/pipermail/gdb-patches/2024-March/207650.html