From 01796e78f40f759483861563ba1a216251bc618f Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Wed, 20 Feb 2019 15:37:06 -0500 Subject: [PATCH] kernel/x86: Re-introduce the 1MB lower barrier. It was removed in 2008 to make VM86 work, which is now gone. Fixes #14911. --- headers/private/kernel/arch/x86/arch_kernel.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/headers/private/kernel/arch/x86/arch_kernel.h b/headers/private/kernel/arch/x86/arch_kernel.h index 931176bcc6..1ba4c1b54d 100644 --- a/headers/private/kernel/arch/x86/arch_kernel.h +++ b/headers/private/kernel/arch/x86/arch_kernel.h @@ -45,9 +45,9 @@ // There is a 2MB hole just before the end of the bottom half of the address // space. This means that if userland passes in a buffer that crosses into the // uncanonical address region, it will be caught through a page fault. -#define USER_BASE 0x0 -#define USER_BASE_ANY 0x100000 -#define USER_SIZE (0x800000000000 - 0x200000) +#define USER_BASE 0x100000 +#define USER_BASE_ANY USER_BASE +#define USER_SIZE (0x800000000000 - (0x200000 + 0x100000)) #define USER_TOP (USER_BASE + (USER_SIZE - 1)) #define KERNEL_USER_DATA_BASE 0x7f0000000000 @@ -80,14 +80,11 @@ * kernel. There is a gap of 64kb between the user and kernel space. The 64kb * region assures a user space thread cannot pass a buffer into the kernel as * part of a syscall that would cross into kernel space. - * Furthermore no areas are placed in the lower 1Mb unless the application - * explicitly requests it to find null pointer references. - * TODO: introduce the 1Mb lower barrier again - it's only used for vm86 mode, - * and this should be moved into the kernel (and address space) completely. + * Further, there is a 1MB hole starting at 0x0 to prevent NULL from being mapped. */ -#define USER_BASE 0x0 -#define USER_BASE_ANY 0x100000 -#define USER_SIZE (KERNEL_BASE - 0x10000) +#define USER_BASE 0x100000 +#define USER_BASE_ANY USER_BASE +#define USER_SIZE (KERNEL_BASE - (0x10000 + 0x100000)) #define USER_TOP (USER_BASE + (USER_SIZE - 1)) #define KERNEL_USER_DATA_BASE 0x60000000