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]
Message-Id: <20180420171949.15710-1-ynorov@caviumnetworks.com>
Date:   Fri, 20 Apr 2018 20:19:49 +0300
From:   Yury Norov <ynorov@...iumnetworks.com>
To:     Fengguang Wu <fengguang.wu@...el.com>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Kefeng Wang <wangkefeng.wang@...wei.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Clement Courbet <courbet@...gle.com>,
        Arnd Bergmann <arnd@...db.de>,
        Geert Uytterhoeven <geert@...ux-m68k.org>,
        linux-kernel@...r.kernel.org, lkp@...org
Cc:     Yury Norov <ynorov@...iumnetworks.com>
Subject: [PATCH] lib: avoid soft lockup in test_find_first_bit()

test_find_first_bit() is intentionally sub-optimal,
and may cause soft lockup due to long time of run on some systems.
So decrease length of bitmap to traverse to avoid lockup.

With the change below, time of test execution doesn't exceed 0.2
seconds on my testing system.

Signed-off-by: Yury Norov <ynorov@...iumnetworks.com>
Reported-by: Fengguang Wu <fengguang.wu@...el.com>
Fixes: 4441fca0a27f5 ("lib: test module for find_*_bit() functions")
---
 lib/find_bit_benchmark.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/find_bit_benchmark.c b/lib/find_bit_benchmark.c
index 5985a25e6cbc..5367ffa5c18f 100644
--- a/lib/find_bit_benchmark.c
+++ b/lib/find_bit_benchmark.c
@@ -132,7 +132,12 @@ static int __init find_bit_test(void)
 	test_find_next_bit(bitmap, BITMAP_LEN);
 	test_find_next_zero_bit(bitmap, BITMAP_LEN);
 	test_find_last_bit(bitmap, BITMAP_LEN);
-	test_find_first_bit(bitmap, BITMAP_LEN);
+
+	/*
+	 * test_find_first_bit() may take some time, so
+	 * traverse only part of bitmap to avoid soft lockup.
+	 */
+	test_find_first_bit(bitmap, BITMAP_LEN / 10);
 	test_find_next_and_bit(bitmap, bitmap2, BITMAP_LEN);
 
 	pr_err("\nStart testing find_bit() with sparse bitmap\n");
-- 
2.14.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ