Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/mm: Move is_vsyscall_vaddr() into asm/vsyscall.h

Move is_vsyscall_vaddr() into asm/vsyscall.h to make it available for
copy_from_kernel_nofault_allowed() in arch/x86/mm/maccess.c.

Reviewed-by: Sohil Mehta <sohil.mehta@intel.com>
Signed-off-by: Hou Tao <houtao1@huawei.com>
Link: https://lore.kernel.org/r/20240202103935.3154011-2-houtao@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Hou Tao and committed by
Alexei Starovoitov
ee0e39a6 e37243b6

+10 -9
+10
arch/x86/include/asm/vsyscall.h
··· 4 4 5 5 #include <linux/seqlock.h> 6 6 #include <uapi/asm/vsyscall.h> 7 + #include <asm/page_types.h> 7 8 8 9 #ifdef CONFIG_X86_VSYSCALL_EMULATION 9 10 extern void map_vsyscall(void); ··· 24 23 return false; 25 24 } 26 25 #endif 26 + 27 + /* 28 + * The (legacy) vsyscall page is the long page in the kernel portion 29 + * of the address space that has user-accessible permissions. 30 + */ 31 + static inline bool is_vsyscall_vaddr(unsigned long vaddr) 32 + { 33 + return unlikely((vaddr & PAGE_MASK) == VSYSCALL_ADDR); 34 + } 27 35 28 36 #endif /* _ASM_X86_VSYSCALL_H */
-9
arch/x86/mm/fault.c
··· 798 798 show_opcodes(regs, loglvl); 799 799 } 800 800 801 - /* 802 - * The (legacy) vsyscall page is the long page in the kernel portion 803 - * of the address space that has user-accessible permissions. 804 - */ 805 - static bool is_vsyscall_vaddr(unsigned long vaddr) 806 - { 807 - return unlikely((vaddr & PAGE_MASK) == VSYSCALL_ADDR); 808 - } 809 - 810 801 static void 811 802 __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code, 812 803 unsigned long address, u32 pkey, int si_code)