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:
parent
46add12552
commit
6e1f209af1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=118853
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user