Skip to content

Commit d85bc11

Browse files
Tetsuo Handagregkh
authored andcommitted
kexec: bail out upon SIGKILL when allocating memory.
commit 7c3a6ae upstream. 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/993c9185-d324-2640-d061-bed2dd18b1f7@I-love.SAKURA.ne.jp Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Reported-by: syzbot <syzbot+8ab2d0f39fb79fe6ca40@syzkaller.appspotmail.com> Cc: Eric Biederman <ebiederm@xmission.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c8a65ec commit d85bc11

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

kernel/kexec_core.c

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

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

0 commit comments

Comments
 (0)