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: <20231101163414.2105727-1-wozizhi@huawei.com>
Date:   Thu, 2 Nov 2023 00:34:14 +0800
From:   WoZ1zh1 <wozizhi@...wei.com>
To:     <dhowells@...hat.com>
CC:     <linux-cachefs@...hat.com>, <linux-kernel@...r.kernel.org>,
        <wozizhi@...wei.com>, <yangerkun@...wei.com>
Subject: [PATCH -next,V2] fscache: support to disable assert macro

In fs/fscache/internal.h, ASSERT macro is enabled by default and can not
be disabled, then assert failure will crash the kernel as the BUG() is
included in the ASSERT macro. Therefore, add FSCACHE_ASSERT to control it.

Signed-off-by: WoZ1zh1 <wozizhi@...wei.com>
---
 fs/fscache/Kconfig    | 10 ++++++++++
 fs/fscache/internal.h |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/fs/fscache/Kconfig b/fs/fscache/Kconfig
index b313a978ae0a..7ff844038bc3 100644
--- a/fs/fscache/Kconfig
+++ b/fs/fscache/Kconfig
@@ -38,3 +38,13 @@ config FSCACHE_DEBUG
 	  enabled by setting bits in /sys/modules/fscache/parameter/debug.
 
 	  See Documentation/filesystems/caching/fscache.rst for more information.
+
+config FSCACHE_ASSERT
+	bool "FSCACHE asserts"
+	default n
+	depends on FSCACHE
+	help
+	  Support the ASSERT mode for failure behavior.
+	  Say N here to disable the ASSERT by default.
+	  Say Y to add assertion checks in some places. But the assertion
+	  failure will result in fatal errors that BUG() the kernel.
diff --git a/fs/fscache/internal.h b/fs/fscache/internal.h
index 1336f517e9b1..951166ed772f 100644
--- a/fs/fscache/internal.h
+++ b/fs/fscache/internal.h
@@ -225,7 +225,7 @@ do {						\
 /*
  * assertions
  */
-#if 1 /* defined(__KDEBUGALL) */
+#ifdef CONFIG_FSCACHE_ASSERT
 
 #define ASSERT(X)							\
 do {									\
-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ