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]
Date:	Wed, 20 Mar 2013 17:02:00 -0700
From:	Kevin Hilman <khilman@...aro.org>
To:	Frederic Weisbecker <fweisbec@...il.com>,
	Russell King <rmk+kernel@....linux.org.uk>,
	linux-kernel@...r.kernel.org
Cc:	Paul McKenney <paulmck@...ux.vnet.ibm.com>,
	linux-arm-kernel@...ts.infradead.org,
	linaro-kernel@...ts.linaro.org
Subject: [PATCH 3/4] ARM: context tracking: handle post exception/syscall/IRQ work

do_work_pending() may be called on IRQ, exception or syscall exit (for
reschedule, signal handling, etc.) , but user_enter() may have already
been called (e.g. by syscall return path.)

Since do_work_pending() is still in kernel mode, keep context_tracker
up to date by using user_exit/user_enter.

Based on commit edf55fda35c7dc7f2d9241c3abaddaf759b457c6 (x86: Exit
RCU extended QS on notify resume)

Signed-off-by: Kevin Hilman <khilman@...aro.org>
---
 arch/arm/kernel/signal.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index 296786b..42514fd 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -12,6 +12,7 @@
 #include <linux/personality.h>
 #include <linux/uaccess.h>
 #include <linux/tracehook.h>
+#include <linux/context_tracking.h>
 
 #include <asm/elf.h>
 #include <asm/cacheflush.h>
@@ -575,12 +576,15 @@ static int do_signal(struct pt_regs *regs, int syscall)
 asmlinkage int
 do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall)
 {
+	int retval = 0;
+
+	user_exit();
 	do {
 		if (likely(thread_flags & _TIF_NEED_RESCHED)) {
 			schedule();
 		} else {
 			if (unlikely(!user_mode(regs)))
-				return 0;
+				break;
 			local_irq_enable();
 			if (thread_flags & _TIF_SIGPENDING) {
 				int restart = do_signal(regs, syscall);
@@ -590,7 +594,8 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall)
 					 * Deal with it without leaving
 					 * the kernel space.
 					 */
-					return restart;
+					retval = restart;
+					break;
 				}
 				syscall = 0;
 			} else {
@@ -601,5 +606,6 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall)
 		local_irq_disable();
 		thread_flags = current_thread_info()->flags;
 	} while (thread_flags & _TIF_WORK_MASK);
-	return 0;
+	user_enter();
+	return retval;
 }
-- 
1.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ