diff options
author | Luis Machado <luis.machado@linaro.org> | 2020-06-15 14:24:53 -0300 |
---|---|---|
committer | Luis Machado <luis.machado@linaro.org> | 2020-06-25 13:23:38 -0300 |
commit | 0c7c65e12f384d7035bf79e37ccbbc5d11cdc447 (patch) | |
tree | a9536df8f405757f841709c820d27977fec4e7ee /gdb/linux-tdep.h | |
parent | e5f4e60d4955ba94516ef91d86f0f429a2c12612 (diff) | |
download | gdb-0c7c65e12f384d7035bf79e37ccbbc5d11cdc447.zip gdb-0c7c65e12f384d7035bf79e37ccbbc5d11cdc447.tar.gz gdb-0c7c65e12f384d7035bf79e37ccbbc5d11cdc447.tar.bz2 |
Refactor parsing of /proc/<pid>/smaps
The Linux kernel exposes the information about MTE-protected pages via the
proc filesystem, more specifically through the smaps file.
What we're looking for is a mapping with the 'mt' flag, which tells us that
mapping was created with a PROT_MTE flag and, thus, is capable of using memory
tagging.
We already parse that file for other purposes (core file
generation/filtering), so this patch refactors the code to make the parsing
of the smaps file reusable for memory tagging.
The function linux_address_in_memtag_page uses the refactored code to allow
querying for memory tag support in a particular address, and it gets used in the
next patch.
gdb/ChangeLog:
YYYY-MM-DD Luis Machado <luis.machado@linaro.org>
* linux-tdep.c (struct smaps_vmflags) <memory_tagging>: New flag
bit.
(struct smaps_data): New struct.
(decode_vmflags): Handle the 'mt' flag.
(parse_smaps_data): New function, refactored from
linux_find_memory_regions_full.
(linux_address_in_memtag_page): New function.
(linux_find_memory_regions_full): Refactor into parse_smaps_data.
* linux-tdep.h (linux_address_in_memtag_page): New prototype.
Diffstat (limited to 'gdb/linux-tdep.h')
-rw-r--r-- | gdb/linux-tdep.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gdb/linux-tdep.h b/gdb/linux-tdep.h index 91c2873..32c9c03 100644 --- a/gdb/linux-tdep.h +++ b/gdb/linux-tdep.h @@ -41,6 +41,10 @@ DEF_ENUM_FLAGS_TYPE (enum linux_siginfo_extra_field_values, struct type *linux_get_siginfo_type_with_fields (struct gdbarch *gdbarch, linux_siginfo_extra_fields); + /* Return true if ADDRESS is within the boundaries of a page mapped with + memory tagging protection. */ +bool linux_address_in_memtag_page (CORE_ADDR address); + typedef char *(*linux_collect_thread_registers_ftype) (const struct regcache *, ptid_t, bfd *, char *, int *, |