diff options
author | Jakub Kicinski <kuba@kernel.org> | 2021-05-27 19:22:11 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-05-27 19:55:10 +0300 |
commit | 5ada57a9a6b0be0e6dfcbd4afa519b0347fd5649 (patch) | |
tree | f82f466df9272bb0c385320b25adc51c45309f84 /arch/x86/include/asm/page_64.h | |
parent | 59c56342459a483d5e563ed8b5fdb77ab7622a73 (diff) | |
parent | d7c5303fbc8ac874ae3e597a5a0d3707dc0230b4 (diff) | |
download | linux-5ada57a9a6b0be0e6dfcbd4afa519b0347fd5649.tar.xz |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
cdc-wdm: s/kill_urbs/poison_urbs/ to fix build
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'arch/x86/include/asm/page_64.h')
-rw-r--r-- | arch/x86/include/asm/page_64.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/x86/include/asm/page_64.h b/arch/x86/include/asm/page_64.h index 939b1cff4a7b..ca840fec7776 100644 --- a/arch/x86/include/asm/page_64.h +++ b/arch/x86/include/asm/page_64.h @@ -56,6 +56,39 @@ static inline void clear_page(void *page) void copy_page(void *to, void *from); +#ifdef CONFIG_X86_5LEVEL +/* + * User space process size. This is the first address outside the user range. + * There are a few constraints that determine this: + * + * On Intel CPUs, if a SYSCALL instruction is at the highest canonical + * address, then that syscall will enter the kernel with a + * non-canonical return address, and SYSRET will explode dangerously. + * We avoid this particular problem by preventing anything + * from being mapped at the maximum canonical address. + * + * On AMD CPUs in the Ryzen family, there's a nasty bug in which the + * CPUs malfunction if they execute code from the highest canonical page. + * They'll speculate right off the end of the canonical space, and + * bad things happen. This is worked around in the same way as the + * Intel problem. + * + * With page table isolation enabled, we map the LDT in ... [stay tuned] + */ +static inline unsigned long task_size_max(void) +{ + unsigned long ret; + + alternative_io("movq %[small],%0","movq %[large],%0", + X86_FEATURE_LA57, + "=r" (ret), + [small] "i" ((1ul << 47)-PAGE_SIZE), + [large] "i" ((1ul << 56)-PAGE_SIZE)); + + return ret; +} +#endif /* CONFIG_X86_5LEVEL */ + #endif /* !__ASSEMBLY__ */ #ifdef CONFIG_X86_VSYSCALL_EMULATION |