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]
Message-ID: <20120615155432.GA5498@breakpoint.cc>
Date:	Fri, 15 Jun 2012 17:54:32 +0200
From:	Sebastian Andrzej Siewior <sebastian@...akpoint.cc>
To:	Mel Gorman <mgorman@...e.de>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Linux-MM <linux-mm@...ck.org>,
	Linux-Netdev <netdev@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	David Miller <davem@...emloft.net>, Neil Brown <neilb@...e.de>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Mike Christie <michaelc@...wisc.edu>,
	Eric B Munson <emunson@...bm.net>
Subject: [PATCH 02.5] mm: sl[au]b: first remove PFMEMALLOC flag then SLAB flag

From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>

If we first remove the SLAB flag followed by the PFMEMALLOC flag then the
removal of the latter will trigger the VM_BUG_ON() as it can be seen in
| kernel BUG at include/linux/page-flags.h:474!
| invalid opcode: 0000 [#1] PREEMPT SMP
| Call Trace:
|  [<c10e2d77>] slab_destroy+0x27/0x70
|  [<c10e3285>] drain_freelist+0x55/0x90
|  [<c10e344e>] __cache_shrink+0x6e/0x90
|  [<c14e3211>] ? acpi_sleep_init+0xcf/0xcf
|  [<c10e349d>] kmem_cache_shrink+0x2d/0x40

because the SLAB flag is gone. This patch simply changes the order.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
---
 mm/slab.c |    2 +-
 mm/slub.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index 00c601b..b1a39f7 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2007,8 +2007,8 @@ static void kmem_freepages(struct kmem_cache *cachep, void *addr)
 				NR_SLAB_UNRECLAIMABLE, nr_freed);
 	while (i--) {
 		BUG_ON(!PageSlab(page));
-		__ClearPageSlab(page);
 		__ClearPageSlabPfmemalloc(page);
+		__ClearPageSlab(page);
 		page++;
 	}
 	if (current->reclaim_state)
diff --git a/mm/slub.c b/mm/slub.c
index f8cbec4..d753146 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1417,8 +1417,8 @@ static void __free_slab(struct kmem_cache *s, struct page *page)
 		NR_SLAB_RECLAIMABLE : NR_SLAB_UNRECLAIMABLE,
 		-pages);
 
-	__ClearPageSlab(page);
 	__ClearPageSlabPfmemalloc(page);
+	__ClearPageSlab(page);
 	reset_page_mapcount(page);
 	if (current->reclaim_state)
 		current->reclaim_state->reclaimed_slab += pages;
-- 
1.7.10

--
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