summaryrefslogtreecommitdiffstats
path: root/mm/kasan
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2017-02-03 09:57:00 +0100
committerIngo Molnar <mingo@kernel.org>2017-03-02 08:42:25 +0100
commitaf8601ad420f6afa6445c927ad9f36d9700d96d6 (patch)
treeb33b49e2aec61c0c3fc666c84d39ee4547ddf42c /mm/kasan
parentmm/vmacache, sched/headers: Introduce 'struct vmacache' and move it from <lin... (diff)
downloadlinux-af8601ad420f6afa6445c927ad9f36d9700d96d6.tar.xz
linux-af8601ad420f6afa6445c927ad9f36d9700d96d6.zip
kasan, sched/headers: Uninline kasan_enable/disable_current()
<linux/kasan.h> is a low level header that is included early in affected kernel headers. But it includes <linux/sched.h> which complicates the cleanup of sched.h dependencies. But kasan.h has almost no need for sched.h: its only use of scheduler functionality is in two inline functions which are not used very frequently - so uninline kasan_enable_current() and kasan_disable_current(). Also add a <linux/sched.h> dependency to a .c file that depended on kasan.h including it. This paves the way to remove the <linux/sched.h> include from kasan.h. Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'mm/kasan')
-rw-r--r--mm/kasan/kasan.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c
index 25f0e6521f36..d99312ed7c22 100644
--- a/mm/kasan/kasan.c
+++ b/mm/kasan/kasan.c
@@ -39,6 +39,16 @@
#include "kasan.h"
#include "../slab.h"
+void kasan_enable_current(void)
+{
+ current->kasan_depth++;
+}
+
+void kasan_disable_current(void)
+{
+ current->kasan_depth--;
+}
+
/*
* Poisons the shadow memory for 'size' bytes starting from 'addr'.
* Memory addresses should be aligned to KASAN_SHADOW_SCALE_SIZE.