oom_killc-futex-delay-the-oom-reaper-to-allow-time-for-proper-futex-cleanup.patch removed from -mm tree
The patch titled
Subject: oom_kill.c: futex: delay the OOM reaper to allow time for proper futex cleanup
has been removed from the -mm tree. Its filename was
oom_killc-futex-delay-the-oom-reaper-to-allow-time-for-proper-futex-cleanup.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Nico Pache <[email protected]>
Subject: oom_kill.c: futex: delay the OOM reaper to allow time for proper futex cleanup
The pthread struct is allocated on PRIVATE|ANONYMOUS memory [1] which can be targeted by the oom reaper. This mapping is used to store the futex robust list head; the kernel does not keep a copy of the robust list and instead references a userspace address to maintain the robustness during a process death. A race can occur between exit_mm and the oom reaper that allows the oom reaper to free the memory of the futex robust list before the exit path has handled the futex death:
CPU1 CPU2
------------------------------------------------------------------------
page_fault
do_exit "signal"
wake_oom_reaper
oom_reaper oom_reap_task_mm (invalidates mm)
exit_mm
exit_mm_release
futex_exit_release
futex_cleanup
exit_robust_list
get_user (EFAULT- can't access memory)
If the get_user EFAULT's, the kernel will be unable to recover the waiters on the robust_list, leaving userspace mutexes hung indefinitely.
Delay the OOM reaper, allowing more time for the exit path to perform the futex cleanup.
Reproducer: https://gitlab.com/jsavitz/oom_futex_reproducer
Based on a patch by Michal Hocko.
[1] https://elixir.bootlin.com/glibc/glibc-2.35/source/nptl/allocatestack.c#L370
---
include/linux/sched.h | 1 mm/oom_kill.c | 54 +++++++++++++++++++++++++++++----------- 2 files changed, 41 insertions(+), 14 deletions(-)
include/linux/sched.h renamed from include/linux/sched.h~oom_killc-futex-delay-the-oom-reaper-to-allow-time-for-proper-futex-cleanup +1 -0
@@ -1443,6 +1443,7 @@ struct task_struct {int pagefault_disabled;#ifdef CONFIG_MMU struct task_struct *oom_reaper_list; +struct timer_list oom_reaper_timer;#endif #ifdef CONFIG_VMAP_STACK struct vm_struct *stack_vm_area;
mm/oom_kill.c renamed from mm/oom_kill.c~oom_killc-futex-delay-the-oom-reaper-to-allow-time-for-proper-futex-cleanup +40 -14
109 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are