Re: [PATCH v3] x86/suspend: fix false positive KASAN warning on suspend/resume

From
Andrey Ryabinin <hidden>
Date
2016-12-02 16:20:57
Also in
lkml
Reply to
Josh Poimboeuf, 2016-12-02

On 12/02/2016 05:42 PM, Josh Poimboeuf wrote:

quoted hunk ↗ jump to hunk
diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c
index 0e9505f..e9d8ba0 100644
--- a/mm/kasan/kasan.c
+++ b/mm/kasan/kasan.c
@@ -80,7 +80,14 @@ void kasan_unpoison_task_stack(struct task_struct *task)
 /* Unpoison the stack for the current task beyond a watermark sp value. */
 asmlinkage void kasan_unpoison_task_stack_below(const void *watermark)
 {
-	__kasan_unpoison_stack(current, watermark);
+	/*
+	 * Calculate the task stack base address.  Avoid using 'current'
+	 * because this function is called by early resume code which hasn't
+	 * yet set up the percpu register (%gs).
+	 */
+	void *base = (void *)((unsigned long)watermark & CURRENT_MASK);
CURRENT_MASK is defined only on x86...
quoted hunk ↗ jump to hunk
+
+	kasan_unpoison_shadow(base, watermark - base);
 }
 
 /*
Thread (28 messages) 28 messages, 7 authors, last reply 2016-12-08
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help