Don't use VM_MIN_KERNEL_ADDRESS to check if the faulting address is

in user space or kernel space. VM_MIN_KERNEL_ADDRESS starts after the
gateway page, which means that improper memory accesses to the gateway
page while in user mode would panic the kernel. Use VM_MAX_ADDRESS
instead. It ends before the gateway page. The difference between
VM_MIN_KERNEL_ADDRESS and VM_MAX_ADDRESS is exactly the gateway page.
This commit is contained in:
Marcel Moolenaar 2003-08-13 03:20:10 +00:00
parent 46add12552
commit 6e1f209af1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=118853

View File

@ -589,10 +589,10 @@ trap(int vector, struct trapframe *framep)
rv = 0;
va = trunc_page(framep->tf_special.ifa);
if (va >= VM_MIN_KERNEL_ADDRESS) {
if (va >= VM_MAX_ADDRESS) {
/*
* Don't allow user-mode faults for kernel virtual
* addresses
* addresses, including the gateway page.
*/
if (user)
goto no_fault_in;