From: Namhyung Kim <namhy...@kernel.org>

Since we're finding a cause of broken data, it'd be desired not to miss
any suspects.  It doesn't use GFP_ATOMIC since it includes __GFP_HIGH
which is for system making forward progress.

It also adds a WARN_ON whenever it fails to allocate pages even with
__GFP_ATOMIC.

Signed-off-by: Namhyung Kim <namhy...@kernel.org>
Signed-off-by: Joonsoo Kim <iamjoonsoo....@lge.com>
---
 mm/kasan/vchecker.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/mm/kasan/vchecker.c b/mm/kasan/vchecker.c
index 6b3824f..df480d5 100644
--- a/mm/kasan/vchecker.c
+++ b/mm/kasan/vchecker.c
@@ -301,13 +301,20 @@ static noinline depot_stack_handle_t save_stack(int skip, 
bool *is_new)
                .max_entries = VCHECKER_STACK_DEPTH,
                .skip = skip,
        };
+       depot_stack_handle_t handle;
 
        save_stack_trace(&trace);
        if (trace.nr_entries != 0 &&
            trace.entries[trace.nr_entries-1] == ULONG_MAX)
                trace.nr_entries--;
 
-       return depot_save_stack(NULL, &trace, GFP_NOWAIT, is_new);
+       if (trace.nr_entries == 0)
+               return 0;
+
+       handle = depot_save_stack(NULL, &trace, __GFP_ATOMIC, is_new);
+       WARN_ON(!handle);
+
+       return handle;
 }
 
 static ssize_t vchecker_type_write(struct file *filp, const char __user *ubuf,
-- 
2.7.4

Reply via email to