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: <151834540184.176427.12174649162560874101.stgit@buzz>
Date:   Sun, 11 Feb 2018 13:36:41 +0300
From:   Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
To:     linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
        linux-kernel@...r.kernel.org
Cc:     Naoya Horiguchi <n-horiguchi@...jp.nec.com>,
        Michal Hocko <mhocko@...e.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
        Nicholas Piggin <npiggin@...il.com>
Subject: [PATCH] proc/kpageflags: add KPF_WAITERS

KPF_WAITERS indicates tasks are waiting for a page lock or writeback.
This might be false-positive, in this case next unlock will clear it.
This looks like worth information not only for kernel hacking.

In tool page-types in non-raw mode treat KPF_WAITERS without
KPF_LOCKED and KPF_WRITEBACK as false-positive and hide it.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
---
 fs/proc/page.c                         |    1 +
 include/uapi/linux/kernel-page-flags.h |    1 +
 tools/vm/page-types.c                  |    7 +++++++
 3 files changed, 9 insertions(+)

diff --git a/fs/proc/page.c b/fs/proc/page.c
index 1491918a33c3..b9312e1124af 100644
--- a/fs/proc/page.c
+++ b/fs/proc/page.c
@@ -159,6 +159,7 @@ u64 stable_page_flags(struct page *page)
 		u |= 1 << KPF_IDLE;
 
 	u |= kpf_copy_bit(k, KPF_LOCKED,	PG_locked);
+	u |= kpf_copy_bit(k, KPF_WAITERS,	PG_waiters);
 
 	u |= kpf_copy_bit(k, KPF_SLAB,		PG_slab);
 	if (PageTail(page) && PageSlab(compound_head(page)))
diff --git a/include/uapi/linux/kernel-page-flags.h b/include/uapi/linux/kernel-page-flags.h
index fa139841ec18..1118a028f2b3 100644
--- a/include/uapi/linux/kernel-page-flags.h
+++ b/include/uapi/linux/kernel-page-flags.h
@@ -35,6 +35,7 @@
 #define KPF_BALLOON		23
 #define KPF_ZERO_PAGE		24
 #define KPF_IDLE		25
+#define KPF_WAITERS		26
 
 
 #endif /* _UAPILINUX_KERNEL_PAGE_FLAGS_H */
diff --git a/tools/vm/page-types.c b/tools/vm/page-types.c
index a8783f48f77f..76d880b768b5 100644
--- a/tools/vm/page-types.c
+++ b/tools/vm/page-types.c
@@ -107,6 +107,7 @@
 
 static const char * const page_flag_names[] = {
 	[KPF_LOCKED]		= "L:locked",
+	[KPF_WAITERS]		= "Q:waiters",
 	[KPF_ERROR]		= "E:error",
 	[KPF_REFERENCED]	= "R:referenced",
 	[KPF_UPTODATE]		= "U:uptodate",
@@ -498,6 +499,12 @@ static uint64_t well_known_flags(uint64_t flags)
 	if ((flags & BITS_COMPOUND) && !(flags & BIT(HUGE)))
 		flags &= ~BITS_COMPOUND;
 
+	/* Treat WAITERS without LOCKED or WRITEBACK as false-postive */
+	if ((flags & (BIT(WAITERS) |
+		      BIT(LOCKED) |
+		      BIT(WRITEBACK))) == BIT(WAITERS))
+		flags &= ~BIT(WAITERS);
+
 	return flags;
 }
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ