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-next>] [day] [month] [year] [list]
Date:	Sat, 16 Jan 2016 18:58:07 +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, Borislav Petkov <bp@...e.de>,
	Andy Lutomirski <luto@...nel.org>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	Wang Nan <wangnan0@...wei.com>, linux-kernel@...r.kernel.org,
	Alexander Kuleshov <kuleshovmail@...il.com>
Subject: [PATCH] x86/traps: use conditional_{cli,sti} in preempt_conditinal_{cli_sti}

The 3d2a71a596bd9 commit (x86, traps: converge do_debug handlers by
Alexander van Heukelum <heukelum@...tmail.fm>) introduces two functions:
preempt_conditional_sti/cli() which are enables/disables interrupts
depends on state of the interrupt enable flag and increments/decrements
the preempt counter.

In the same time arch/x86/kernel/traps.c defines two similar inline
functions: conditional_{sti,cli} which are do the same, but without
touch of the preempt counter. Let's use these functions in the
preempt_conditional_{sti,cli} instead of duplication of 'if' statemets.

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

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index ade185a..30ec8fa 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -92,8 +92,7 @@ static inline void conditional_sti(struct pt_regs *regs)
 static inline void preempt_conditional_sti(struct pt_regs *regs)
 {
 	preempt_count_inc();
-	if (regs->flags & X86_EFLAGS_IF)
-		local_irq_enable();
+	conditional_sti(regs);
 }
 
 static inline void conditional_cli(struct pt_regs *regs)
@@ -104,8 +103,7 @@ static inline void conditional_cli(struct pt_regs *regs)
 
 static inline void preempt_conditional_cli(struct pt_regs *regs)
 {
-	if (regs->flags & X86_EFLAGS_IF)
-		local_irq_disable();
+	conditional_cli(regs);
 	preempt_count_dec();
 }
 
-- 
2.7.0.25.gfc10eb5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ