Skip to content

Commit

Permalink
arm64: Handle an unaligned start in pmap_mask_set_locked()
Browse files Browse the repository at this point in the history
In pmap_mask_set_locked(), correctly handle a starting address that is
in the middle of an L3C page.  The symptoms arising from this error
included assertion failures in pmap_demote_l3c().

Reported by:	andrew
Reviewed by:	markj
Fixes:	fd6cb03 "arm64 pmap: Add ATTR_CONTIGUOUS support [Part 1]"
Differential Revision:	https://reviews.freebsd.org/D45851
  • Loading branch information
alcriceedu committed Jul 5, 2024
1 parent 7f50027 commit 383fd3e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions sys/arm64/arm64/pmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -4403,8 +4403,22 @@ pmap_mask_set_locked(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, pt_entry_t m
va = va_next;
}
if ((l3 & ATTR_CONTIGUOUS) != 0) {
l3p += L3C_ENTRIES - 1;
sva += L3C_SIZE - L3_SIZE;
/*
* Does this L3C page extend beyond
* the requested range? Handle the
* possibility that "va_next" is zero.
*/
if ((sva | L3C_OFFSET) > va_next - 1)
break;

/*
* Skip ahead to the last L3_PAGE
* within this L3C page.
*/
l3p = (pt_entry_t *)((uintptr_t)l3p |
((L3C_ENTRIES - 1) *
sizeof(pt_entry_t)));
sva |= L3C_SIZE - L3_SIZE;
}
continue;
}
Expand Down

0 comments on commit 383fd3e

Please sign in to comment.