Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d08a044 authored by Mark Rutland's avatar Mark Rutland Committed by Will Deacon
Browse files

arm64: fix CONFIG_DEBUG_WX address reporting



In ptdump_check_wx(), we pass walk_pgd() a start address of 0 (rather
than VA_START) for the init_mm. This means that any reported W&X
addresses are offset by VA_START, which is clearly wrong and can make
them appear like userspace addresses.

Fix this by telling the ptdump code that we're walking init_mm starting
at VA_START. We don't need to update the addr_markers, since these are
still valid bounds regardless.

Cc: <stable@vger.kernel.org>
Fixes: 1404d6f1 ("arm64: dump: Add checking for writable and exectuable pages")
Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Laura Abbott <labbott@redhat.com>
Reported-by: default avatarTimur Tabi <timur@codeaurora.org>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent faa75e14
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -389,7 +389,7 @@ void ptdump_check_wx(void)
		.check_wx = true,
		.check_wx = true,
	};
	};


	walk_pgd(&st, &init_mm, 0);
	walk_pgd(&st, &init_mm, VA_START);
	note_page(&st, 0, 0, 0);
	note_page(&st, 0, 0, 0);
	if (st.wx_pages || st.uxn_pages)
	if (st.wx_pages || st.uxn_pages)
		pr_warn("Checked W+X mappings: FAILED, %lu W+X pages found, %lu non-UXN pages found\n",
		pr_warn("Checked W+X mappings: FAILED, %lu W+X pages found, %lu non-UXN pages found\n",