[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180907194901.C54A0101@viggo.jf.intel.com>
Date: Fri, 07 Sep 2018 12:49:01 -0700
From: Dave Hansen <dave.hansen@...ux.intel.com>
To: linux-kernel@...r.kernel.org
Cc: Dave Hansen <dave.hansen@...ux.intel.com>,
sean.j.christopherson@...el.com, peterz@...radead.org,
tglx@...utronix.de, x86@...nel.org, luto@...nel.org
Subject: [RFC][PATCH 6/8] x86/mm: add vsyscall address helper
From: Dave Hansen <dave.hansen@...ux.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@...ux.intel.com>
Cc: Sean Christopherson <sean.j.christopherson@...el.com>
Cc: "Peter Zijlstra (Intel)" <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: x86@...nel.org
Cc: Andy Lutomirski <luto@...nel.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;
}
_
Powered by blists - more mailing lists