From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794590421; b=3meayTfQY3bcSraNBwsrFKmSHY0eOB2b1njMKrFPMIXSo1hXsVOzp0g29rC5QouFTb5K VybWSKT+c9wiRQt0jYvU7JWZ3CCHsreF4MAyQLv29KQE3Y4FUTKF83AUQ1KF2dXParHxu JUmkCD8ptbea07DDvp0qmKPNJu8J85JNYKmI+osHqa/Ey9wtwk45wt6ERjQajWs92xO6g KMLtNzf0S4yI7gyUi1/SIEhclJZhtz+UtJs1FIa0/pwog8YZ/dfsdGPCPUa3jTK7S8pRK j74L4Aj6aLtiYBrnv7SZRij7uxClA68Jiy9U7sA9s1Y6dRxhNCp/RohZKB6OwgkPTwg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794590421; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=PipltHiog9wpusiqRgcEe6BTsdtfDuFFQZIS+WwzzUY=; b=mzYSxPbuxuDp4JpmbmYZPP6Zmk5rDIV9OMhKjrGKhXI5XeC1AJhDz3IkC7iYgioKukCm rvVDh3RyKmfRPptvhRgV/tZSfaJ/nM5ngV+tLjQO7QNHH1YSpi3ImpTxgazUpOlTZLG4F CJDzLtu9eRSGNi+JppAR8FAMt6oxHGfW9LEPKG9HllFwEuHH4ECE4rrc1gd2RIQqzLish Te5fah1FiklV6owZZ63kqXmquGQcoV+mbbWVQU4kGvW5icqiFVSHyERkUi52CHXJcS9PN aQmVmFckXO5URF2OUM9m0NXB/2n+R1odZ9WwESIUXAPdQhReSsQ1A1UOP0l5ghQo1xw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=2QqdqxsX; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2EE1606A8A2; Fri, 13 Nov 2026 17:20:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=2QqdqxsX Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EFA41F000C7; Fri, 13 Nov 2026 17:20:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1794590421; bh=PipltHiog9wpusiqRgcEe6BTsdtfDuFFQZIS+WwzzUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=2QqdqxsXpiFm5hJPGJzeFdQWIzXu7DiM2d/6pUlKGoZ4Dy6Mx3tBrxxaU7IO/+I5L EVvwrBSQeh6959NR0oMR9AIJBQhWsTfbLeH7MydBFRRkpe5GMFHbSSwpoBAvm6zeSk gGbe1/YJSEpDmbuskJKzXU6BPIj1qBdgSh8m1P5c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Chris Mason , "Lorenzo Stoakes (ARM)" , Muhammad Usama Anjum , "David Hildenbrand (Arm)" , Sasha Levin Subject: [PATCH 6.18 385/686] mm: fix unkillable fault loop on MAP_DROPPABLE memory Date: Fri, 13 Nov 2026 10:48:38 -0500 Message-ID: <20261113153834.044661348@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261113153820.902362109@linuxfoundation.org> References: <20261113153820.902362109@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chris Mason [ Upstream commit 9f02ca8c15a74bc9e4e8e05ec089f63cb87cbf75 ] 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@vger.kernel.org Signed-off-by: Chris Mason Reviewed-by: Lorenzo Stoakes (ARM) [ david: simplify description ] Tested-by: Muhammad Usama Anjum Link: https://patch.msgid.link/20261031-fixes_core-v3-37-d6437171ecc3@kernel.org Signed-off-by: David Hildenbrand (Arm) Signed-off-by: Sasha Levin --- mm/memory.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 0ef286c4a9ae2..3049e4dc2651f 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -6541,8 +6541,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) { -- 2.53.0