Skip to content

Commit b8c8a33

Browse files
hnaztorvalds
authored andcommitted
Revert "vmalloc: back off when the current task is killed"
This reverts commits 5d17a73 ("vmalloc: back off when the current task is killed") and 171012f ("mm: don't warn when vmalloc() fails due to a fatal signal"). Commit 5d17a73 ("vmalloc: back off when the current task is killed") made all vmalloc allocations from a signal-killed task fail. We have seen crashes in the tty driver from this, where a killed task exiting tries to switch back to N_TTY, fails n_tty_open because of the vmalloc failing, and later crashes when dereferencing tty->disc_data. Arguably, relying on a vmalloc() call to succeed in order to properly exit a task is not the most robust way of doing things. There will be a follow-up patch to the tty code to fall back to the N_NULL ldisc. But the justification to make that vmalloc() call fail like this isn't convincing, either. The patch mentions an OOM victim exhausting the memory reserves and thus deadlocking the machine. But the OOM killer is only one, improbable source of fatal signals. It doesn't make sense to fail allocations preemptively with plenty of memory in most cases. The patch doesn't mention real-life instances where vmalloc sites would exhaust memory, which makes it sound more like a theoretical issue to begin with. But just in case, the OOM access to memory reserves has been restricted on the allocator side in cd04ae1 ("mm, oom: do not rely on TIF_MEMDIE for memory reserves access"), which should take care of any theoretical concerns on that front. Revert this patch, and the follow-up that suppresses the allocation warnings when we fail the allocations due to a signal. Link: http://lkml.kernel.org/r/[email protected] Fixes: 171012f ("mm: don't warn when vmalloc() fails due to a fatal signal") Signed-off-by: Johannes Weiner <[email protected]> Acked-by: Vlastimil Babka <[email protected]> Acked-by: Michal Hocko <[email protected]> Cc: Alan Cox <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Dmitry Vyukov <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent ef46501 commit b8c8a33

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

mm/vmalloc.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,11 +1695,6 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
16951695
for (i = 0; i < area->nr_pages; i++) {
16961696
struct page *page;
16971697

1698-
if (fatal_signal_pending(current)) {
1699-
area->nr_pages = i;
1700-
goto fail_no_warn;
1701-
}
1702-
17031698
if (node == NUMA_NO_NODE)
17041699
page = alloc_page(alloc_mask|highmem_mask);
17051700
else
@@ -1723,7 +1718,6 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
17231718
warn_alloc(gfp_mask, NULL,
17241719
"vmalloc: allocation failure, allocated %ld of %ld bytes",
17251720
(area->nr_pages*PAGE_SIZE), area->size);
1726-
fail_no_warn:
17271721
vfree(area->addr);
17281722
return NULL;
17291723
}

0 commit comments

Comments
 (0)