qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/9] Add MTE stubs for aarch64 user mode
@ 2024-06-17  6:28 Gustavo Romero
  2024-06-17  6:28 ` [PATCH v3 1/9] gdbstub: Clean up process_string_cmd Gustavo Romero
                   ` (8 more replies)
  0 siblings, 9 replies; 21+ messages in thread
From: Gustavo Romero @ 2024-06-17  6:28 UTC (permalink / raw)
  To: qemu-devel, philmd, peter.maydell, alex.bennee, richard.henderson
  Cc: gustavo.romero

This patchset adds the stubs necessary to support GDB memory tagging
commands on QEMU aarch64 user mode.

These new stubs handle the qIsAddressTagged, qMemTag, and QMemTag
packets, which allow GDB memory tagging subcommands 'check',
'print-allocation-tag', and 'set-allocation-tag' to work. The remaining
memory tagging commands ('print-logical-tag' and 'with-logical-tag')
will also work, but they don't rely on any stub because they perform
local operations.

Since the memory tagging stubs are not common to all architectures, this
patchset also introduces three functions: gdb_extend_qsupported_features,
gdb_extend_query_table, and gdb_extend_set_table. These functions can be
used to extend the target-specific 'qSupported' feature string and the
handlers for the 'q' (query) and 'Q' (set) packets. These new functions
are used to add the MTE stubs for the aarch64 gdbstub.
 
Note that this patchset requires a GDB that supports the
qIsAddressTagged packet (recently added to GDB), so the gdbstub MTE
tests introduced by it must be run using GDB's master branch, since the
GDB in the distros hasn't picked up the change yet.

Once GDB is built and installed locally, the tests can be exercised, for
example, this way:

make GDB=~/.local/bin/gdb run-tcg-tests-aarch64-linux-user -j 32

v2:
 - Addressed comments from Richard, Phil, and Alex
 - Made the series more granular by splitting it into more patches
 - Moved gdbstub command-specific structs and functions into a new header, gdbstub/commands.h
 - Fixed exception in allocation_tag_mem_probe()
 - Used MTE helpers ({store,load}_tag1 and allocation_tag_mem_probe) in the MTE stubs
 - Factored out MTE code to set TCF0, avoiding duplication (both prctl and gdbstub code use it)
 - Hoisted sscanf() out of loop in handle_Q_memtag stub and use gdb_hextomem instead
 - Rebased this series on Alex's gdb/next branch
 
v3:
 - Moved stubs to gdbstub64.c
 - Fixed build for BSD target
 - Fixed license tags in the new header files
 - Use of only function prototypes in mte_helpers.h
 - Added prefix to arm_set_mte_tcf0 and marked it inline
 - Moved target/arm/mte.h -> target/arm/tcg/mte_user_helper.h
 - Cleaned up leftover in mte-8 test


Cheers,
Gustavo


Gustavo Romero (9):
  gdbstub: Clean up process_string_cmd
  gdbstub: Move GdbCmdParseEntry into a new header file
  gdbstub: Add support for target-specific stubs
  target/arm: Fix exception case in allocation_tag_mem_probe
  target/arm: Make some MTE helpers widely available
  target/arm: Factor out code for setting MTE TCF0 field
  gdbstub: Make get cpu and hex conversion functions non-internal
  gdbstub: Add support for MTE in user mode
  tests/tcg/aarch64: Add MTE gdbstub tests

 configs/targets/aarch64-linux-user.mak |   2 +-
 gdb-xml/aarch64-mte.xml                |  11 ++
 gdbstub/gdbstub.c                      | 211 ++++++++++++------------
 gdbstub/internals.h                    |  24 ---
 gdbstub/syscalls.c                     |   7 +-
 gdbstub/system.c                       |   7 +-
 gdbstub/user-target.c                  |  25 +--
 gdbstub/user.c                         |   7 +-
 include/exec/gdbstub.h                 |   5 +
 include/gdbstub/commands.h             | 102 ++++++++++++
 linux-user/aarch64/target_prctl.h      |  22 +--
 target/arm/cpu.c                       |   1 +
 target/arm/gdbstub.c                   |  46 ++++++
 target/arm/gdbstub64.c                 | 217 +++++++++++++++++++++++++
 target/arm/internals.h                 |   6 +
 target/arm/tcg/mte_helper.c            |  48 ++----
 target/arm/tcg/mte_helper.h            |  63 +++++++
 target/arm/tcg/mte_user_helper.h       |  40 +++++
 tests/tcg/aarch64/Makefile.target      |  11 +-
 tests/tcg/aarch64/gdbstub/test-mte.py  |  86 ++++++++++
 tests/tcg/aarch64/mte-8.c              |  98 +++++++++++
 21 files changed, 833 insertions(+), 206 deletions(-)
 create mode 100644 gdb-xml/aarch64-mte.xml
 create mode 100644 include/gdbstub/commands.h
 create mode 100644 target/arm/tcg/mte_helper.h
 create mode 100644 target/arm/tcg/mte_user_helper.h
 create mode 100644 tests/tcg/aarch64/gdbstub/test-mte.py
 create mode 100644 tests/tcg/aarch64/mte-8.c

-- 
2.34.1



^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-06-24  5:38 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-17  6:28 [PATCH v3 0/9] Add MTE stubs for aarch64 user mode Gustavo Romero
2024-06-17  6:28 ` [PATCH v3 1/9] gdbstub: Clean up process_string_cmd Gustavo Romero
2024-06-21  0:49   ` Richard Henderson
2024-06-17  6:28 ` [PATCH v3 2/9] gdbstub: Move GdbCmdParseEntry into a new header file Gustavo Romero
2024-06-17  6:28 ` [PATCH v3 3/9] gdbstub: Add support for target-specific stubs Gustavo Romero
2024-06-21  4:28   ` Richard Henderson
2024-06-21  9:01     ` Alex Bennée
2024-06-21  8:11   ` Alex Bennée
2024-06-24  5:35     ` Gustavo Romero
2024-06-17  6:28 ` [PATCH v3 4/9] target/arm: Fix exception case in allocation_tag_mem_probe Gustavo Romero
2024-06-21  4:28   ` Richard Henderson
2024-06-17  6:28 ` [PATCH v3 5/9] target/arm: Make some MTE helpers widely available Gustavo Romero
2024-06-21  4:31   ` Richard Henderson
2024-06-24  5:36     ` Gustavo Romero
2024-06-17  6:28 ` [PATCH v3 6/9] target/arm: Factor out code for setting MTE TCF0 field Gustavo Romero
2024-06-21  4:35   ` Richard Henderson
2024-06-24  5:38     ` Gustavo Romero
2024-06-17  6:28 ` [PATCH v3 7/9] gdbstub: Make get cpu and hex conversion functions non-internal Gustavo Romero
2024-06-21  4:38   ` Richard Henderson
2024-06-17  6:28 ` [PATCH v3 8/9] gdbstub: Add support for MTE in user mode Gustavo Romero
2024-06-17  6:28 ` [PATCH v3 9/9] tests/tcg/aarch64: Add MTE gdbstub tests Gustavo Romero

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).