lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170614124032.4159-3-brgerst@gmail.com>
Date:   Wed, 14 Jun 2017 08:40:31 -0400
From:   Brian Gerst <brgerst@...il.com>
To:     x86@...nel.org, linux-kernel@...r.kernel.org
Cc:     Ingo Molnar <mingo@...nel.org>, "H . Peter Anvin" <hpa@...or.com>,
        Andy Lutomirski <luto@...capital.net>,
        Juergen Gross <jgross@...e.com>,
        Boris Ostrovsky <boris.ostrovsky@...cle.com>
Subject: [PATCH 2/3] x86-32: Simplify IOPL switch check

Remove the get_kernel_rpl() call from the test for switching IOPL.  Instead
make set_iopl_mask() a no-op when Xen is running in supervisor mode.

Signed-off-by: Brian Gerst <brgerst@...il.com>
---
 arch/x86/kernel/process_32.c | 2 +-
 arch/x86/xen/enlighten_pv.c  | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index ffeae81..b2d1f7c 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -263,7 +263,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
 	 * is running virtualized at a non-zero CPL, the popf will
 	 * not restore flags, so it must be done in a separate step.
 	 */
-	if (get_kernel_rpl() && unlikely(prev->iopl != next->iopl))
+	if (unlikely(prev->iopl != next->iopl))
 		set_iopl_mask(next->iopl);
 
 	/*
diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
index f33eef4..05257c0 100644
--- a/arch/x86/xen/enlighten_pv.c
+++ b/arch/x86/xen/enlighten_pv.c
@@ -1350,8 +1350,10 @@ asmlinkage __visible void __init xen_start_kernel(void)
 
 #ifdef CONFIG_X86_32
 	pv_info.kernel_rpl = 1;
-	if (xen_feature(XENFEAT_supervisor_mode_kernel))
+	if (xen_feature(XENFEAT_supervisor_mode_kernel)) {
 		pv_info.kernel_rpl = 0;
+		pv_cpu_ops.set_iopl_mask = paravirt_nop;
+	}
 #else
 	pv_info.kernel_rpl = 0;
 #endif
-- 
2.9.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ