kernel/vm: Do not assume "no user protection" means "kernel area".

It's entirely possible that we have a user area with a page that
has protections of 0 (e.g. a guard page). In that case we should
print the standard read/write fault message instead of "kernel"
fault messages.

This should not be a major behavioral change, only the syslog
and tracing entries should be affected; such memory accesses
should be caught by the read/write permissions checks immediately
following.
This commit is contained in:
Augustin Cavalier 2022-03-11 14:15:56 -05:00
parent 3a81e9446d
commit 63664eaa21

View File

@ -4725,7 +4725,8 @@ vm_soft_fault(VMAddressSpace* addressSpace, addr_t originalAddress,
// check permissions
uint32 protection = get_area_page_protection(area, address);
if (isUser && (protection & B_USER_PROTECTION) == 0) {
if (isUser && (protection & B_USER_PROTECTION) == 0
&& (area->protection & B_KERNEL_AREA) != 0) {
dprintf("user access on kernel area 0x%" B_PRIx32 " at %p\n",
area->id, (void*)originalAddress);
TPF(PageFaultError(area->id,