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>] [day] [month] [year] [list]
Date:	Wed, 21 Oct 2015 14:56:58 -0700
From:	Dave Hansen <dave@...1.net>
To:	dave@...1.net
Cc:	kirill.shutemov@...ux.intel.com, akpm@...ux-foundation.org,
	n-horiguchi@...jp.nec.com, mike.kravetz@...cle.com,
	hillf.zj@...baba-inc.com, rientjes@...gle.com, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org, dave.hansen@...ux.intel.com
Subject: [PATCH] mm, hugetlbfs: Fix new warning in fault-time huge page allocation


From: Dave Hansen <dave.hansen@...ux.intel.com>

Kirill reported that he hit:
>> +	if (vma || addr) {
>> +		WARN_ON_ONCE(!addr || addr == -1);
>
> Trinity triggered the WARN for me:

This was just a dumb mistake. I put the WARN_ON() in and planned to
have addr=0 mean "use nid". But, I realized pretty quickly that addr=0
_is_ a valid place to fault. So I made it addr=-1 in
__alloc_buddy_huge_page_no_mpol(), but I did not fix up the WARN_ON().

So hitting the warning in this case was harmless.  But, fix up the
warning condition.

Cc: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Naoya Horiguchi <n-horiguchi@...jp.nec.com>
Cc: Mike Kravetz <mike.kravetz@...cle.com>
Cc: Hillf Danton <hillf.zj@...baba-inc.com>
Cc: David Rientjes <rientjes@...gle.com>
Cc: linux-mm@...ck.org
Cc: linux-kernel@...r.kernel.org
Signed-off-by: Dave Hansen <dave.hansen@...ux.intel.com>

---

 b/mm/hugetlb.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff -puN mm/hugetlb.c~hugetlbfs-fix-warn mm/hugetlb.c
--- a/mm/hugetlb.c~hugetlbfs-fix-warn	2015-10-21 14:40:15.809961389 -0700
+++ b/mm/hugetlb.c	2015-10-21 14:40:15.814961616 -0700
@@ -1520,8 +1520,14 @@ static struct page *__alloc_buddy_huge_p
 	if (hstate_is_gigantic(h))
 		return NULL;
 
-	if (vma || addr) {
-		VM_WARN_ON_ONCE(!addr || addr == -1);
+	/*
+	 * Make sure that anyone specifying 'nid' is not also
+	 * specifying a VMA.  This makes sure the caller is
+	 * picking _one_ of the modes with which we can call this
+	 * function, not both.
+	 */
+	if (vma || (addr != -1)) {
+		VM_WARN_ON_ONCE(addr == -1);
 		VM_WARN_ON_ONCE(nid != NUMA_NO_NODE);
 	}
 	/*
_
--
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