mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-09-21 07:36:38 +02:00
arm64_pmap: narrow scope of bti_same test
The pmap_bti_same test in pmap_enter_l3c only happens in the !ADDR_IS_KERNEL case; in the other case, a KASSERT fails. So move the test into that case to save a bit of time when ADDR_IS_KERNEL. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D45160
This commit is contained in:
parent
d9f1f0a901
commit
b5a1f0406b
@ -5662,6 +5662,19 @@ retry:
|
||||
}
|
||||
}
|
||||
l3p = (pt_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(*ml3p));
|
||||
|
||||
have_l3p:
|
||||
/*
|
||||
* If bti is not the same for the whole L3C range, return
|
||||
* failure and let vm_fault() cope. Check after L3 allocation,
|
||||
* since it could sleep.
|
||||
*/
|
||||
if (!pmap_bti_same(pmap, va, va + L3C_SIZE)) {
|
||||
(*ml3p)->ref_count -= L3C_ENTRIES - 1;
|
||||
pmap_abort_ptp(pmap, va, *ml3p);
|
||||
*ml3p = NULL;
|
||||
return (KERN_PROTECTION_FAILURE);
|
||||
}
|
||||
} else {
|
||||
*ml3p = NULL;
|
||||
|
||||
@ -5684,22 +5697,8 @@ retry:
|
||||
pmap_load(pde)));
|
||||
}
|
||||
}
|
||||
have_l3p:
|
||||
l3p = &l3p[pmap_l3_index(va)];
|
||||
|
||||
/*
|
||||
* If bti is not the same for the whole L3C range, return failure
|
||||
* and let vm_fault() cope. Check after L3 allocation, since
|
||||
* it could sleep.
|
||||
*/
|
||||
if (!pmap_bti_same(pmap, va, va + L3C_SIZE)) {
|
||||
KASSERT(*ml3p != NULL, ("pmap_enter_l3c: missing L3 PTP"));
|
||||
(*ml3p)->ref_count -= L3C_ENTRIES - 1;
|
||||
pmap_abort_ptp(pmap, va, *ml3p);
|
||||
*ml3p = NULL;
|
||||
return (KERN_PROTECTION_FAILURE);
|
||||
}
|
||||
|
||||
/*
|
||||
* If there are existing mappings, either abort or remove them.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user