Messages in this thread Patch in this message | | | Subject | [RFC][PATCH 6/8] x86/mm: add vsyscall address helper | From | Dave Hansen <> | Date | Fri, 07 Sep 2018 12:49:01 -0700 |
| |
From: Dave Hansen <dave.hansen@linux.intel.com>
We will shortly be using this check in two locations. Put it in a helper before we do so.
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Cc: Sean Christopherson <sean.j.christopherson@intel.com> Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: x86@kernel.org Cc: Andy Lutomirski <luto@kernel.org> ---
b/arch/x86/mm/fault.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff -puN arch/x86/mm/fault.c~is-vsyscall-addr arch/x86/mm/fault.c --- a/arch/x86/mm/fault.c~is-vsyscall-addr 2018-09-07 11:21:48.208751897 -0700 +++ b/arch/x86/mm/fault.c 2018-09-07 11:21:48.211751897 -0700 @@ -841,6 +841,15 @@ show_signal_msg(struct pt_regs *regs, un show_opcodes((u8 *)regs->ip, loglvl); } +/* + * The (legacy) vsyscall page is the long page in the kernel portion + * of the address space that has user-accessible permissions. + */ +static bool is_vsyscall_vaddr(unsigned long vaddr) +{ + return (vaddr & ~0xfff) == VSYSCALL_ADDR; +} + static void __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code, unsigned long address, u32 *pkey, int si_code) @@ -870,7 +879,7 @@ __bad_area_nosemaphore(struct pt_regs *r * emulation. */ if (unlikely((error_code & X86_PF_INSTR) && - ((address & ~0xfff) == VSYSCALL_ADDR))) { + is_vsyscall_vaddr(address))) { if (emulate_vsyscall(regs, address)) return; } _
| |