path: root/kernel
diff options
authorTetsuo Handa <>2019-09-25 16:47:33 -0700
committerLinus Torvalds <>2019-09-25 17:51:40 -0700
commit7c3a6aedcd6aae0a32a527e68669f7dd667492d1 (patch)
treec25300fde2ccb706b7b96eac01545556aa59da66 /kernel
parent2a4a4082cd4438333b5ecffdd15d1a484e5a83c7 (diff)
kexec: bail out upon SIGKILL when allocating memory.
syzbot found that a thread can stall for minutes inside kexec_load() after that thread was killed by SIGKILL [1]. It turned out that the reproducer was trying to allocate 2408MB of memory using kimage_alloc_page() from kimage_load_normal_segment(). Let's check for SIGKILL before doing memory allocation. [1] Link: Signed-off-by: Tetsuo Handa <> Reported-by: syzbot <> Cc: Eric Biederman <> Reviewed-by: Andrew Morton <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'kernel')
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index d5870723b8ad..15d70a90b50d 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -300,6 +300,8 @@ static struct page *kimage_alloc_pages(gfp_t gfp_mask, unsigned int order)
struct page *pages;
+ if (fatal_signal_pending(current))
+ return NULL;
pages = alloc_pages(gfp_mask & ~__GFP_ZERO, order);
if (pages) {
unsigned int count, i;