]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/ChangeLog
Refactor parsing of /proc/<pid>/smaps
authorLuis Machado <luis.machado@linaro.org>
Mon, 15 Jun 2020 17:24:53 +0000 (14:24 -0300)
committerLuis Machado <luis.machado@linaro.org>
Wed, 24 Mar 2021 17:54:50 +0000 (14:54 -0300)
commit1e735120b95236b1f0fd8c383e64b02b64909d7c
tree9db3580d29028767a59b98cb49c7d2cb142e704d
parent93e447c605e549f183681ed60e729d3d50f4d113
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:

2021-03-24  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.
gdb/ChangeLog
gdb/linux-tdep.c
gdb/linux-tdep.h