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>] [day] [month] [year] [list]
Date:	Sat, 29 Jun 2013 17:15:09 +0200
From:	Ard Biesheuvel <ard.biesheuvel@...aro.org>
To:	linux-kernel@...r.kernel.org
Cc:	linux-arm-kernel@...ts.infradead.org, linux@....linux.org.uk,
	arnd@...db.de, catalin.marinas@....com, will.deacon@....com,
	Ard Biesheuvel <ard.biesheuvel@...aro.org>
Subject: [RFC PATCH] sched: add preempt_[disable|enable]_strict()

Add preempt_disable_strict and preempt_enable_strict functions that
can be used to demarcate atomic sections for which we would like
to enforce -even on non-PREEMPT builds with CONFIG_DEBUG_ATOMIC_SLEEP
disabled- that sleeping is not allowed.

The rationale is that in some cases, the risk of data corruption is
high while the likelihood of immediate detection is low, e.g., when
using the NEON unit in kernel mode on arm64.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@...aro.org>
---
 include/linux/preempt.h |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index f5d4723..178bf2e 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -56,29 +56,33 @@ do { \
 #endif /* CONFIG_PREEMPT */
 
 
-#ifdef CONFIG_PREEMPT_COUNT
-
-#define preempt_disable() \
+#define preempt_disable_strict() \
 do { \
 	inc_preempt_count(); \
 	barrier(); \
 } while (0)
 
-#define sched_preempt_enable_no_resched() \
+#define __atomic_end() \
 do { \
 	barrier(); \
 	dec_preempt_count(); \
 } while (0)
 
-#define preempt_enable_no_resched()	sched_preempt_enable_no_resched()
-
-#define preempt_enable() \
+#define preempt_enable_strict() \
 do { \
-	preempt_enable_no_resched(); \
+	__atomic_end(); \
 	barrier(); \
 	preempt_check_resched(); \
 } while (0)
 
+#ifdef CONFIG_PREEMPT_COUNT
+
+#define preempt_disable()	preempt_disable_strict()
+#define preempt_enable()	preempt_enable_strict()
+
+#define sched_preempt_enable_no_resched()	__atomic_end()
+#define preempt_enable_no_resched()		__atomic_end()
+
 /* For debugging and tracer internals only! */
 #define add_preempt_count_notrace(val)			\
 	do { preempt_count() += (val); } while (0)
-- 
1.7.9.5

--
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