[Lldb-commits] [PATCH] D105182: [lldb] Add "memory tag write" command

David Spickett via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 6 03:56:56 PDT 2021

DavidSpickett added a comment.

> Many different types of memory tagging exist, MTE is but one.

Sure. I'm not opposed to making changes to adapt to the properties of different tags. However the most concrete one I have access to it MTE so that has shaped the initial support and assumptions.

> CHERI uses memory tagging for something completely different (tracking valid capability, ie pointer provenance), and its tags make sense to read (though are a property of the stored data, not the memory allocation), but not explicitly write (only implicitly by writing a capability to the associated location, which will include the non-addressable tag bit), as that is architecturally forbidden in order to ensure that the hardware-enforced tags can never be corrupted by software.

Definitely we could add properties to the tagging scheme information to disable the read and/or/write commands. Something like:

  (lldb) memory tag write 0x12341234 23
  Error: Cannot write memory tags for address 0x12341234. <foo> tags are not writeable by user software

If you mean hiding the commands completely from the interactive sessions, there's no existing mechanism for it but you could make the argument for it. The current pattern is to show the command but error saying that it is unsupported. (this also happens when a remote doesn't support some feature)

> Moreover, in future, CHERI and MTE will be composed (there is ongoing experimental work to investigate doing so on CHERI-RISC-V, and if Arm's experimental Morello prototype is adopted in a future version of the Arm architecture it will also have to compose with MTE). See also the core dump format for MTE tags, which specifies the _type_ of tag, specifically to accommodate other uses of tagged memory.

Certainly. There's nothing stopping us supporting such a configuration apart from (at least personally) zero experience or way to test such a thing. Something like:

  (lldb) memory read foo
  Error: Current process has multiple memory tag types. "foo", "bar". Please select one with the --type argument.

It's not something I could really implement with just MTE as the vast majority of the code would be untested but with a use case we could definitely make the changes.

Where this does become more thorny is the lldb API where we have more stringent commitments to not changing it. Happily, I haven't started on this yet and your concerns very much need to be included.

Perhaps you could write up something and post it to the lldb-dev list for more visibility? I'd be interested to know how things work in the existing lldb cheri port (I assume there is one, there is for Morello at least).

  rG LLVM Github Monorepo



More information about the lldb-commits mailing list