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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 9 Apr 2022 15:38:45 +0800
From:   Miaohe Lin <linmiaohe@...wei.com>
To:     <akpm@...ux-foundation.org>
CC:     <mike.kravetz@...cle.com>, <shy828301@...il.com>,
        <willy@...radead.org>, <ying.huang@...el.com>, <ziy@...dia.com>,
        <minchan@...nel.org>, <apopple@...dia.com>,
        <dave.hansen@...ux.intel.com>, <o451686892@...il.com>,
        <jhubbard@...dia.com>, <peterx@...hat.com>,
        <naoya.horiguchi@....com>, <mhocko@...e.com>, <riel@...hat.com>,
        <osalvador@...e.de>, <david@...hat.com>, <sfr@...b.auug.org.au>,
        <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
        <linmiaohe@...wei.com>
Subject: [PATCH 3/4] mm/migration: return errno when isolate_huge_page failed

We might fail to isolate huge page due to e.g. the page is under migration
which cleared HPageMigratable. So we should return -EBUSY in this case
rather than always return 1 which could confuse the user.

Fixes: e8db67eb0ded ("mm: migrate: move_pages() supports thp migration")
Reviewed-by: Muchun Song <songmuchun@...edance.com>
Reviewed-by: Baolin Wang <baolin.wang@...ux.alibaba.com>
Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
---
 mm/migrate.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/mm/migrate.c b/mm/migrate.c
index 381963231a62..044656a14ae2 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1632,10 +1632,8 @@ static int add_page_for_migration(struct mm_struct *mm, unsigned long addr,
 		goto out_putpage;
 
 	if (PageHuge(page)) {
-		if (PageHead(page)) {
-			isolate_huge_page(page, pagelist);
-			err = 1;
-		}
+		if (PageHead(page))
+			err = isolate_huge_page(page, pagelist) ? 1 : -EBUSY;
 	} else {
 		struct page *head;
 
-- 
2.23.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ