[Lldb-commits] [lldb] [lldb][Linux] Add overlay and effective permissions to "memory region" (PR #184115)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Tue Apr 7 06:01:17 PDT 2026
================
@@ -152,6 +152,31 @@ class ABI : public PluginInterface {
static lldb::ABISP FindPlugin(lldb::ProcessSP process_sp, const ArchSpec &arch);
+ struct MemoryPermissions {
+ // Both of these are sets of lldb::Permissions values.
+ // Overlay are the permissions being applied to the original permissions.
+ uint32_t overlay;
+ // Effective is the result of applying the overlay to the original
+ // permissions. Calculating this is done by the plugin because some
+ // permission overlays are done as positive (add permissions) and some as
+ // negative (remove permissions).
+ uint32_t effective;
+ };
+
+ /// Get the permissions being overlayed for a given memory key, and the
+ /// resulting permissions after applying the overlay. Typically the protection
+ /// key is used to look up in some architecture specific set of permissions.
----------------
DavidSpickett wrote:
> Can you explain difference between memory key and the protection key.
I meant the same thing by either term, I've changed it to only use "protection key".
> Is the protection key region specific or it has something to do with TLBs.
The same key can be applied to many memory mappings (which helps a lot because you only get a small number of them). So key 0 will always be the default one and be attached to many mappings. That value 0 refers to one permission set in the `por_el0` register.
But even though you reuse a key, you may get different results after applying those permissions. Since AArch64 overlays can only remove permissions, you could for example assign one key to be the "remove execute" key.
Which would be `rw-`. So if that's applied to a base of `rwx` you get `rw-`, but when applied to `r-x` you get `r--`. It does not add `w`, it only keeps it if it was already there.
I've not seen anything more than demos of this, but I expect that's how it will be used.
https://github.com/llvm/llvm-project/pull/184115
More information about the lldb-commits
mailing list