Re: [PATCH 36/46] mm: fix unkillable fault loop on MAP_DROPPABLE memory
From: David Hildenbrand (Arm)
Date: Thu Oct 29 2026 - 07:06:42 EST
On 10/27/26 00:17, David Hildenbrand (Arm) wrote:
> From: Chris Mason <mason@xxxxxxxxxx>
>
> handle_mm_fault() suppresses VM_FAULT_OOM for VM_DROPPABLE mappings.
>
> For user-mode faults, pending signals are processed before retrying the
> access. Kernel-mode faults on user buffers instead return directly to
> the faulting instruction.
>
> With persistent allocation failures (esp. memcg limits), a syscall,
> such as write(), can therefore loop while not dropping locks.
>
> Only suppress VM_FAULT_OOM when FAULT_FLAG_USER is set, allowing
> kernel-mode faults and GUP to fail and signal allocation errors.
>
> Fix generated by an LLM and sent by Chris Mason in private.
>
> Fixes: 9651fcedf7b9 ("mm: add MAP_DROPPABLE for designating always lazily freeable mappings")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Chris Mason <mason@xxxxxxxxxx>
> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>
> [ david: simplify description ]
> Signed-off-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
> ---
> mm/memory.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/mm/memory.c b/mm/memory.c
> index 5c5f326b8bcbe..230a2f4dafa13 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -6957,8 +6957,12 @@ vm_fault_t handle_mm_fault(struct vm_area_struct *vma, unsigned long address,
>
> lru_gen_exit_fault();
>
> - /* If the mapping is droppable, then errors due to OOM aren't fatal. */
> - if (is_droppable)
> + /*
> + * If the mapping is droppable, then errors due to OOM aren't fatal: the
> + * task returns to user mode, handles its signals and tries again. A
> + * fault from kernel mode has no such return, so it must see the error.
> + */
> + if (is_droppable && (flags & FAULT_FLAG_USER))
> ret &= ~VM_FAULT_OOM;
>
> if (flags & FAULT_FLAG_USER) {
>
I think this is the single patch in here where I struggle with the side-effects
and possibly remaining issues for user faults.
It feels like the obviously right thing to do, but it all feels a bit shaky.
Maybe the memcg/reclaim folks have a better understanding of this?
--
Cheers,
David