lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230927112517.2631674-12-sebastianene@google.com>
Date:   Wed, 27 Sep 2023 11:25:17 +0000
From:   Sebastian Ene <sebastianene@...gle.com>
To:     linux-kernel@...r.kernel.org
Cc:     kernel-team@...roid.com, will@...nel.org, ryan.roberts@....com,
        mark.rutland@....com, maz@...nel.org, vdonnefort@...gle.com,
        Sebastian Ene <sebastianene@...gle.com>
Subject: [PATCH 11/11] arm64: ptdump: Fix format output during stage-2
 pagetable dumping

Fix two issues where the printed address range from debugfs was not showing
out correctly when trying to read from
/sys/kernel/debug/host_stage2_kernel_page_tables entry.

The first issue was printing to debugfs the following:
0x0000010000000000-0x0000000000000000    16777215T PGD

If the st->start_address was larger than the current addr the delta
variable used to display the size of the address range was overflowing.
The second issue was printing the following wrong IPA range:
0x0000000000000000-0x0000000000000000           0E PGD

Validate the current address range before printing it from the debugfs
entry.

Signed-off-by: Sebastian Ene <sebastianene@...gle.com>
---
 arch/arm64/mm/ptdump.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c
index 45ff4ebae01a..2c21ba9b47d1 100644
--- a/arch/arm64/mm/ptdump.c
+++ b/arch/arm64/mm/ptdump.c
@@ -430,6 +430,9 @@ static void note_page(struct ptdump_state *pt_st, unsigned long addr, int level,
 		const char *unit = units;
 		unsigned long delta;
 
+		if (st->start_address >= addr)
+			goto update_state;
+
 		if (st->current_prot) {
 			note_prot_uxn(st, addr);
 			note_prot_wx(st, addr);
@@ -455,6 +458,7 @@ static void note_page(struct ptdump_state *pt_st, unsigned long addr, int level,
 			pt_dump_seq_printf(st->seq, "---[ %s ]---\n", st->marker->name);
 		}
 
+update_state:
 		st->start_address = addr;
 		st->current_prot = prot;
 		st->level = level;
-- 
2.42.0.515.g380fc7ccd1-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ