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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161128075057.7724-1-kuleshovmail@gmail.com>
Date:   Mon, 28 Nov 2016 13:50:57 +0600
From:   Alexander Kuleshov <kuleshovmail@...il.com>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     Ingo Molnar <mingo@...hat.com>, "H . Peter Anvin" <hpa@...or.com>,
        x86@...nel.org, Andy Lutomirski <luto@...nel.org>,
        Borislav Petkov <bp@...e.de>, Tony Luck <tony.luck@...el.com>,
        Jianyu Zhan <nasa4836@...il.com>,
        Paul Gortmaker <paul.gortmaker@...driver.com>,
        linux-kernel@...r.kernel.org,
        Alexander Kuleshov <kuleshovmail@...il.com>
Subject: [PATCH] x86/traps: get rid of unnecessary preempt_disable/preempt_enable_no_resched

Exception handlers which may run on IST stack calls ist_enter() at the
start of execution and ist_exit() in the end. The ist_enter() disables
preemption unconditionally and ist_exit() enables it.

Besides this, such exception handlers do additional unnecessary calls
of preempt_disable() and preempt_enable_no_resched() after/before
ist_enter()/ist_exit(). Let's get rid from them.

Signed-off-by: Alexander Kuleshov <kuleshovmail@...il.com>
---
 arch/x86/kernel/traps.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index bd4e3d4..5fbff64 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -563,11 +563,9 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)
 	 * as we may switch to the interrupt stack.
 	 */
 	debug_stack_usage_inc();
-	preempt_disable();
 	cond_local_irq_enable(regs);
 	do_trap(X86_TRAP_BP, SIGTRAP, "int3", regs, error_code, NULL);
 	cond_local_irq_disable(regs);
-	preempt_enable_no_resched();
 	debug_stack_usage_dec();
 exit:
 	ist_exit(regs);
@@ -742,14 +740,12 @@ dotraplinkage void do_debug(struct pt_regs *regs, long error_code)
 	debug_stack_usage_inc();
 
 	/* It's safe to allow irq's after DR6 has been saved */
-	preempt_disable();
 	cond_local_irq_enable(regs);
 
 	if (v8086_mode(regs)) {
 		handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code,
 					X86_TRAP_DB);
 		cond_local_irq_disable(regs);
-		preempt_enable_no_resched();
 		debug_stack_usage_dec();
 		goto exit;
 	}
@@ -769,7 +765,6 @@ dotraplinkage void do_debug(struct pt_regs *regs, long error_code)
 	if (tsk->thread.debugreg6 & (DR_STEP | DR_TRAP_BITS) || user_icebp)
 		send_sigtrap(tsk, regs, error_code, si_code);
 	cond_local_irq_disable(regs);
-	preempt_enable_no_resched();
 	debug_stack_usage_dec();
 
 exit:
-- 
2.8.0.rc3.1353.gea9bdc0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ