Skip to content

Commit 7c3a6ae

Browse files
Tetsuo Handatorvalds
authored andcommitted
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] https://syzkaller.appspot.com/bug?id=a0e3436829698d5824231251fad9d8e998f94f5e Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Tetsuo Handa <[email protected]> Reported-by: syzbot <[email protected]> Cc: Eric Biederman <[email protected]> Reviewed-by: Andrew Morton <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 2a4a408 commit 7c3a6ae

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/kexec_core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ static struct page *kimage_alloc_pages(gfp_t gfp_mask, unsigned int order)
300300
{
301301
struct page *pages;
302302

303+
if (fatal_signal_pending(current))
304+
return NULL;
303305
pages = alloc_pages(gfp_mask & ~__GFP_ZERO, order);
304306
if (pages) {
305307
unsigned int count, i;

0 commit comments

Comments
 (0)