[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <e2e8e92d67d64700ba88aec73a4fc2b7986c0f87.1542667307.git.luto@kernel.org>
Date: Mon, 19 Nov 2018 14:45:26 -0800
From: Andy Lutomirski <luto@...nel.org>
To: x86@...nel.org
Cc: LKML <linux-kernel@...r.kernel.org>,
Yu-cheng Yu <yu-cheng.yu@...el.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Borislav Petkov <bp@...en8.de>,
Andy Lutomirski <luto@...nel.org>
Subject: [PATCH 02/13] x86/fault: Check user_mode(regs) when validating a stack extension
The fault handling code tries to validate that a page fault from
user mode that would extend the stack is within a certain range of
the user SP. regs->sp is only equal to the user SP if
user_mode(regs). In the extremely unlikely event that that
sw_error_code had the USER bit set but the faulting instruction was
in the kernel (i.e. the faulting instruction was WRUSS), then the
*kernel* stack pointer would have been checked, which would be an
info leak.
Note to -stable maintainers: don't backport this unless you backport
CET. The bug it fixes is unobservable in current kernels.
Signed-off-by: Andy Lutomirski <luto@...nel.org>
---
arch/x86/mm/fault.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 91d4d2722f2e..eae7ee3ce89b 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -1377,7 +1377,7 @@ void do_user_addr_fault(struct pt_regs *regs,
bad_area(regs, sw_error_code, address);
return;
}
- if (sw_error_code & X86_PF_USER) {
+ if (user_mode(regs)) {
/*
* Accessing the stack below %sp is always a bug.
* The large cushion allows instructions like enter
--
2.17.2
Powered by blists - more mailing lists