Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1616421

[PATCH v2 3/7] bug: Use WARN_ONCE() for CHECK_DATA_CORRUPTION()

From Kees Cook <keescook@chromium.org>
Newsgroups linux.kernel
Subject [PATCH v2 3/7] bug: Use WARN_ONCE() for CHECK_DATA_CORRUPTION()
Date 2017-04-05 00:20 +0200
Message-ID <tsEXU-2s7-29@gated-at.bofh.it> (permalink)
References <tsEXT-2s7-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Since users of CHECK_DATA_CORRUPTION() should be failing safe, the
condition that triggers a WARN() may recur. This would mean a logging
DoS of the system, so switch to WARN_ONCE() instead. (Those wanting
per-instance notifications should already be building with
CONFIG_BUG_ON_DATA_CORRUPTION so there is no change in that case.)

Signed-off-by: Kees Cook <keescook@chromium.org>
---
 include/linux/bug.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/bug.h b/include/linux/bug.h
index b6cfcb7f778f..c011438a7c6c 100644
--- a/include/linux/bug.h
+++ b/include/linux/bug.h
@@ -136,7 +136,7 @@ static inline __must_check bool check_data_corruption(bool v) { return v; }
 				pr_err(fmt, ##__VA_ARGS__);		 \
 				BUG();					 \
 			} else						 \
-				WARN(1, fmt, ##__VA_ARGS__);		 \
+				WARN_ONCE(1, fmt, ##__VA_ARGS__);	 \
 		}							 \
 		unlikely(corruption);					 \
 	}))
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] bug: further enhance use of CHECK_DATA_CORRUPTION Kees Cook <keescook@chromium.org> - 2017-04-05 00:20 +0200
  [PATCH v2 5/7] bug: Enable DEBUG_SG under BUG_ON_DATA_CORRUPTION Kees Cook <keescook@chromium.org> - 2017-04-05 00:20 +0200
  [PATCH v2 3/7] bug: Use WARN_ONCE() for CHECK_DATA_CORRUPTION() Kees Cook <keescook@chromium.org> - 2017-04-05 00:20 +0200
  [PATCH v2 2/7] bug: Improve unlikely() in data corruption check Kees Cook <keescook@chromium.org> - 2017-04-05 00:20 +0200

csiph-web