Skip to content

Commit 4a91a77

Browse files
skttwipawel
authored andcommitted
dump_pagetables: Avoid incorrect BUG_ON condition.
The recursion should stop at level 0, since at this level table is not a page table anymore. This would otherwise trigger a panic when dumping page tables. Signed-off-by: Johannes Wikner <[email protected]>
1 parent d1daed0 commit 4a91a77

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

arch/x86/pagetables.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ static inline bool is_canon_va(const void *va) {
101101
static void dump_pagetable(mfn_t table, int level) {
102102
pte_t *pt;
103103

104+
if (level == 0)
105+
return;
106+
104107
BUG_ON(mfn_invalid(table));
105108
pt = tmp_map_mfn(table);
106109
BUG_ON(!pt);

tests/unittests.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ int unit_tests(void *_unused) {
189189
cpu_freq_expect("Prototyp Amazing Foo One @ 1GHz", 1000000000);
190190
cpu_freq_expect("Prototyp Amazing Foo Two @ 1.00GHz", 1000000000);
191191

192+
dump_pagetables(&cr3);
193+
192194
map_pagetables(&cr3, NULL);
193195
map_pagetables(&cr3, &user_cr3);
194196
pte_t *pte = get_pte(unit_tests);

0 commit comments

Comments
 (0)