diff options
Diffstat (limited to 'mm/kasan/kasan.c')
-rw-r--r-- | mm/kasan/kasan.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c index bc0a8d8b8f42..1ad20ade8c91 100644 --- a/mm/kasan/kasan.c +++ b/mm/kasan/kasan.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/kmemleak.h> | 22 | #include <linux/kmemleak.h> |
23 | #include <linux/linkage.h> | ||
23 | #include <linux/memblock.h> | 24 | #include <linux/memblock.h> |
24 | #include <linux/memory.h> | 25 | #include <linux/memory.h> |
25 | #include <linux/mm.h> | 26 | #include <linux/mm.h> |
@@ -60,6 +61,25 @@ void kasan_unpoison_shadow(const void *address, size_t size) | |||
60 | } | 61 | } |
61 | } | 62 | } |
62 | 63 | ||
64 | static void __kasan_unpoison_stack(struct task_struct *task, void *sp) | ||
65 | { | ||
66 | void *base = task_stack_page(task); | ||
67 | size_t size = sp - base; | ||
68 | |||
69 | kasan_unpoison_shadow(base, size); | ||
70 | } | ||
71 | |||
72 | /* Unpoison the entire stack for a task. */ | ||
73 | void kasan_unpoison_task_stack(struct task_struct *task) | ||
74 | { | ||
75 | __kasan_unpoison_stack(task, task_stack_page(task) + THREAD_SIZE); | ||
76 | } | ||
77 | |||
78 | /* Unpoison the stack for the current task beyond a watermark sp value. */ | ||
79 | asmlinkage void kasan_unpoison_remaining_stack(void *sp) | ||
80 | { | ||
81 | __kasan_unpoison_stack(current, sp); | ||
82 | } | ||
63 | 83 | ||
64 | /* | 84 | /* |
65 | * All functions below always inlined so compiler could | 85 | * All functions below always inlined so compiler could |