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: <1511753419-52328-1-git-send-email-jiang.biao2@zte.com.cn>
Date:   Mon, 27 Nov 2017 11:30:19 +0800
From:   Jiang Biao <jiang.biao2@....com.cn>
To:     viro@...iv.linux.org.uk
Cc:     linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        jiang.biao2@....com.cn, zhong.weidong@....com.cn
Subject: [PATCH] fs/mbcache: make count_objects more robust.

When running ltp stress test for 7*24 hours, the vmscan occasionally
complains the following warning continuously,

mb_cache_scan+0x0/0x3f0 negative objects to delete
nr=-9232265467809300450
...

The tracing result shows the freeable(mb_cache_count returns)
is -1, which causes the continuous accumulation and overflow of
total_scan.

This patch make sure the mb_cache_count not return negative value,
which make the mbcache shrinker more robust.

Signed-off-by: Jiang Biao <jiang.biao2@....com.cn>
---
 fs/mbcache.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/mbcache.c b/fs/mbcache.c
index d818fd2..b8b8b9c 100644
--- a/fs/mbcache.c
+++ b/fs/mbcache.c
@@ -269,6 +269,9 @@ static unsigned long mb_cache_count(struct shrinker *shrink,
 	struct mb_cache *cache = container_of(shrink, struct mb_cache,
 					      c_shrink);
 
+	/* Unlikely, but not impossible */
+	if (unlikely(cache->c_entry_count < 0))
+		return 0;
 	return cache->c_entry_count;
 }
 
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ