lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250120092604.3590285-1-zhaoyang.huang@unisoc.com>
Date: Mon, 20 Jan 2025 17:26:04 +0800
From: "zhaoyang.huang" <zhaoyang.huang@...soc.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
        Alistair Popple
	<apopple@...dia.com>,
        John Hubbard <jhubbard@...dia.com>, <linux-mm@...ck.org>,
        <linux-kernel@...r.kernel.org>,
        Zhaoyang Huang
	<huangzhaoyang@...il.com>, <steve.kang@...soc.com>
Subject: [PATCH] mm: gup: fix infinite loop within __get_longterm_locked

From: Zhaoyang Huang <zhaoyang.huang@...soc.com>

Infinite loop within __get_longterm_locked detected in an unique usage
of pin_user_pages where the VA's pages are all unpinnable(vm_ops->fault
function allocate pages via cma_alloc for hardware purpose and leave them
out of LRU). Fixing this by have 'collected' reflect the actual number
of pages in movable_folio_list.

Signed-off-by: Zhaoyang Huang <zhaoyang.huang@...soc.com>
---
 mm/gup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/gup.c b/mm/gup.c
index 3b75e631f369..2231ce7221f9 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -2341,8 +2341,6 @@ static unsigned long collect_longterm_unpinnable_folios(
 		if (folio_is_longterm_pinnable(folio))
 			continue;
 
-		collected++;
-
 		if (folio_is_device_coherent(folio))
 			continue;
 
@@ -2359,6 +2357,8 @@ static unsigned long collect_longterm_unpinnable_folios(
 		if (!folio_isolate_lru(folio))
 			continue;
 
+		collected++;
+
 		list_add_tail(&folio->lru, movable_folio_list);
 		node_stat_mod_folio(folio,
 				    NR_ISOLATED_ANON + folio_is_file_lru(folio),
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ