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: <CAJd=RBCOCnzM0SbUPeCOe=cLfuJ5doFKWnCk5uSZhkJXbSArHA@mail.gmail.com>
Date:	Sat, 24 Nov 2012 12:27:39 +0800
From:	Hillf Danton <dhillf@...il.com>
To:	Mel Gorman <mgorman@...e.de>
Cc:	Hillf Danton <dhillf@...il.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH 3/3] balancenuma: fix page locking in migrating thp

If fail to migrate thp(due to unsuccessful isolation), and if the original
pmd entry is changed after reaquiring page table lock, it is unsafe to
release the page lock as page maybe unstable.

It is fixed by raising extra page count before trying migration.

Signed-off-by: Hillf Danton <dhillf@...il.com>
---

--- a/mm/huge_memory.c	Fri Nov 23 22:07:38 2012
+++ b/mm/huge_memory.c	Fri Nov 23 22:55:32 2012
@@ -1060,11 +1060,13 @@ int do_huge_pmd_numa_page(struct mm_stru
 	}
 	spin_unlock(&mm->page_table_lock);

+	get_page(page);
 	/* Migrate the THP to the requested node */
 	migrated = migrate_misplaced_transhuge_page(mm, vma,
 				pmdp, pmd, addr,
 				page, target_nid);
 	if (migrated) {
+		put_page(page);
 		count_vm_numa_event(NUMA_THP_MIGRATE_SUCCESS);
 		current_nid = target_nid;
 	} else {
@@ -1072,8 +1074,10 @@ int do_huge_pmd_numa_page(struct mm_stru
 		spin_lock(&mm->page_table_lock);
 		if (unlikely(!pmd_same(pmd, *pmdp))) {
 			unlock_page(page);
+			put_page(page);
 			goto out_unlock;
 		}
+		put_page(page);
 		goto clear_pmdnuma;
 	}

--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ