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] [day] [month] [year] [list]
Message-ID: <20241004190952.AMYdQn7P@linutronix.de>
Date: Fri, 4 Oct 2024 21:12:10 +0200
From: Nam Cao <namcao@...utronix.de>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: Matthew Wilcox <willy@...radead.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-riscv <linux-riscv@...ts.infradead.org>,
	Linux-MM <linux-mm@...ck.org>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: VM_BUG_ON_PAGE(PageAnonNotKsm(page)) defconfig riscv64

On Fri, Oct 04, 2024 at 03:09:22PM +0200, Miguel Ojeda wrote:
> Hi Matthew,
> 
> I noticed riscv64 defconfig seems to reproducibly hit
> `VM_BUG_ON_PAGE(PageAnonNotKsm(page))` in today's next-20241004 --
> please see below.
> 
> I hope that helps!

I can also reproduce this on arm64 with CONFIG_DEBUG_VM_PGFLAGS=y.

Looks like an invert logic bug from:
https://lore.kernel.org/linux-mm/20241002152533.1350629-5-willy@infradead.org/

I made the below changes and the problem goes away.

Best regards,
Nam

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index fe9abdf26ab0..ccf3c78faefc 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -1131,14 +1131,14 @@ static __always_inline int PageAnonExclusive(const struct page *page)
 
 static __always_inline void SetPageAnonExclusive(struct page *page)
 {
-	VM_BUG_ON_PGFLAGS(PageAnonNotKsm(page), page);
+	VM_BUG_ON_PGFLAGS(!PageAnonNotKsm(page), page);
 	VM_BUG_ON_PGFLAGS(PageHuge(page) && !PageHead(page), page);
 	set_bit(PG_anon_exclusive, &PF_ANY(page, 1)->flags);
 }
 
 static __always_inline void ClearPageAnonExclusive(struct page *page)
 {
-	VM_BUG_ON_PGFLAGS(PageAnonNotKsm(page), page);
+	VM_BUG_ON_PGFLAGS(!PageAnonNotKsm(page), page);
 	VM_BUG_ON_PGFLAGS(PageHuge(page) && !PageHead(page), page);
 	clear_bit(PG_anon_exclusive, &PF_ANY(page, 1)->flags);
 }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ