git: dca91e7a1628 - stable/13 - Teach vm.pmap.kernel_maps about both XN bits
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 29 Dec 2021 10:39:50 UTC
The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=dca91e7a1628a819175ca20864653f4171ff5258 commit dca91e7a1628a819175ca20864653f4171ff5258 Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2021-12-06 13:08:39 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2021-12-29 10:05:59 +0000 Teach vm.pmap.kernel_maps about both XN bits The arm64 vm.pmap.kernel_maps sysctl would only check the kernel XN bit when printing the kernel mapping. It can also be useful to check none of the mappings allow userspace to execute from a given virtual address. To check for this add the user XN bit when getting the kernel maps. While here fix the ATTR_S1_AP_USER check to use ATTR_S1_AP to shift the value to the correct offset. Reviewed by: kib (earlier version), markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33304 (cherry picked from commit 38dbca724335fec679e79b72d91a8e36b2624fe1) --- sys/arm64/arm64/pmap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 6eab5fa5ecd9..17e76c0d5a41 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -7181,11 +7181,12 @@ sysctl_kmaps_dump(struct sbuf *sb, struct pmap_kernel_map_range *range, break; } - sbuf_printf(sb, "0x%016lx-0x%016lx r%c%c%c %3s %d %d %d %d\n", + sbuf_printf(sb, "0x%016lx-0x%016lx r%c%c%c%c %3s %d %d %d %d\n", range->sva, eva, (range->attrs & ATTR_S1_AP_RW_BIT) == ATTR_S1_AP_RW ? 'w' : '-', (range->attrs & ATTR_S1_PXN) != 0 ? '-' : 'x', - (range->attrs & ATTR_S1_AP_USER) != 0 ? 'u' : 's', + (range->attrs & ATTR_S1_UXN) != 0 ? '-' : 'X', + (range->attrs & ATTR_S1_AP(ATTR_S1_AP_USER)) != 0 ? 'u' : 's', mode, range->l1blocks, range->l2blocks, range->l3contig, range->l3pages);