From: Kees Cook <keescook@chromium.org> To: Ingo Molnar <mingo@kernel.org> Cc: Kees Cook <keescook@chromium.org>, Peter Zijlstra <peterz@infradead.org>, "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>, Kalle Valo <kvalo@codeaurora.org>, Andrew Morton <akpm@linux-foundation.org>, Rik van Riel <riel@redhat.com>, Jakub Kicinski <jakub.kicinski@netronome.com>, Viresh Kumar <viresh.kumar@linaro.org>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Geert Uytterhoeven <geert@linux-m68k.org>, Olof Johansson <olof@lixom.net>, Chris Wilson <chris@chris-wilson.co.uk>, George Spelvin <linux@sciencehorizons.net>, Thomas Gleixner <tglx@linutronix.de>, Josh Poimboeuf <jpoimboe@redhat.com>, David Windsor <dwindsor@gmail.com>, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: [PATCH v2 1/7] bug: Clarify help text for BUG_ON_DATA_CORRUPTION Date: Tue, 4 Apr 2017 15:12:12 -0700 [thread overview] Message-ID: <1491343938-75336-2-git-send-email-keescook@chromium.org> (raw) In-Reply-To: <1491343938-75336-1-git-send-email-keescook@chromium.org> This expands on the Kconfig help text for CONFIG_BUG_ON_DATA_CORRUPTION to more clearly explain the rationale of BUG vs WARN. Additionally fixes a grammar glitch in the macro comment. Signed-off-by: Kees Cook <keescook@chromium.org> --- include/linux/bug.h | 3 ++- lib/Kconfig.debug | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/linux/bug.h b/include/linux/bug.h index 687b557fc5eb..db1e41c69bac 100644 --- a/include/linux/bug.h +++ b/include/linux/bug.h @@ -124,7 +124,8 @@ static inline enum bug_trap_type report_bug(unsigned long bug_addr, /* * Since detected data corruption should stop operation on the affected - * structures. Return value must be checked and sanely acted on by caller. + * structures, require that the condition is checked and sanely acted on + * by the caller. */ static inline __must_check bool check_data_corruption(bool v) { return v; } #define CHECK_DATA_CORRUPTION(condition, fmt, ...) \ diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 77fadface4f9..5ac4d1148385 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -1998,9 +1998,12 @@ config BUG_ON_DATA_CORRUPTION bool "Trigger a BUG when data corruption is detected" select DEBUG_LIST help - Select this option if the kernel should BUG when it encounters - data corruption in kernel memory structures when they get checked - for validity. + This option enables several inexpensive data corruption checks. + Most of these checks normally just WARN and try to further avoid + the corruption. Selecting this option upgrades these to BUGs so + that the offending process is killed. Additionally, the system + owner can furhter configure the system for immediate reboots + (via panic_on_oops sysctl) or crash dumps. If unsure, say N. -- 2.7.4
WARNING: multiple messages have this Message-ID (diff)
From: Kees Cook <keescook@chromium.org> To: Ingo Molnar <mingo@kernel.org> Cc: Kees Cook <keescook@chromium.org>, Peter Zijlstra <peterz@infradead.org>, "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>, Kalle Valo <kvalo@codeaurora.org>, Andrew Morton <akpm@linux-foundation.org>, Rik van Riel <riel@redhat.com>, Jakub Kicinski <jakub.kicinski@netronome.com>, Viresh Kumar <viresh.kumar@linaro.org>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Geert Uytterhoeven <geert@linux-m68k.org>, Olof Johansson <olof@lixom.net>, Chris Wilson <chris@chris-wilson.co.uk>, George Spelvin <linux@sciencehorizons.net>, Thomas Gleixner <tglx@linutronix.de>, Josh Poimboeuf <jpoimboe@redhat.com>, David Windsor <dwindsor@gmail.com>, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: [kernel-hardening] [PATCH v2 1/7] bug: Clarify help text for BUG_ON_DATA_CORRUPTION Date: Tue, 4 Apr 2017 15:12:12 -0700 [thread overview] Message-ID: <1491343938-75336-2-git-send-email-keescook@chromium.org> (raw) In-Reply-To: <1491343938-75336-1-git-send-email-keescook@chromium.org> This expands on the Kconfig help text for CONFIG_BUG_ON_DATA_CORRUPTION to more clearly explain the rationale of BUG vs WARN. Additionally fixes a grammar glitch in the macro comment. Signed-off-by: Kees Cook <keescook@chromium.org> --- include/linux/bug.h | 3 ++- lib/Kconfig.debug | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/linux/bug.h b/include/linux/bug.h index 687b557fc5eb..db1e41c69bac 100644 --- a/include/linux/bug.h +++ b/include/linux/bug.h @@ -124,7 +124,8 @@ static inline enum bug_trap_type report_bug(unsigned long bug_addr, /* * Since detected data corruption should stop operation on the affected - * structures. Return value must be checked and sanely acted on by caller. + * structures, require that the condition is checked and sanely acted on + * by the caller. */ static inline __must_check bool check_data_corruption(bool v) { return v; } #define CHECK_DATA_CORRUPTION(condition, fmt, ...) \ diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 77fadface4f9..5ac4d1148385 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -1998,9 +1998,12 @@ config BUG_ON_DATA_CORRUPTION bool "Trigger a BUG when data corruption is detected" select DEBUG_LIST help - Select this option if the kernel should BUG when it encounters - data corruption in kernel memory structures when they get checked - for validity. + This option enables several inexpensive data corruption checks. + Most of these checks normally just WARN and try to further avoid + the corruption. Selecting this option upgrades these to BUGs so + that the offending process is killed. Additionally, the system + owner can furhter configure the system for immediate reboots + (via panic_on_oops sysctl) or crash dumps. If unsure, say N. -- 2.7.4
next prev parent reply other threads:[~2017-04-04 22:13 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-04-04 22:12 [PATCH v2] bug: further enhance use of CHECK_DATA_CORRUPTION Kees Cook 2017-04-04 22:12 ` [kernel-hardening] " Kees Cook 2017-04-04 22:12 ` Kees Cook [this message] 2017-04-04 22:12 ` [kernel-hardening] [PATCH v2 1/7] bug: Clarify help text for BUG_ON_DATA_CORRUPTION Kees Cook 2017-04-05 5:47 ` Ian Campbell 2017-04-05 19:32 ` Kees Cook 2017-04-05 19:32 ` Kees Cook 2017-04-04 22:12 ` [PATCH v2 2/7] bug: Improve unlikely() in data corruption check Kees Cook 2017-04-04 22:12 ` [kernel-hardening] " Kees Cook 2017-04-04 22:12 ` [PATCH v2 3/7] bug: Use WARN_ONCE() for CHECK_DATA_CORRUPTION() Kees Cook 2017-04-04 22:12 ` [kernel-hardening] " Kees Cook 2017-04-04 22:12 ` [PATCH v2 4/7] bug: Enable DEBUG_CREDENTIALS under BUG_ON_DATA_CORRUPTION Kees Cook 2017-04-04 22:12 ` [kernel-hardening] " Kees Cook 2017-04-04 22:12 ` [PATCH v2 5/7] bug: Enable DEBUG_SG " Kees Cook 2017-04-04 22:12 ` [kernel-hardening] " Kees Cook 2017-04-04 22:12 ` [PATCH v2 6/7] notifiers: Use CHECK_DATA_CORRUPTION() on checks Kees Cook 2017-04-04 22:12 ` [kernel-hardening] " Kees Cook 2017-04-04 22:12 ` [PATCH v2 7/7] refcount: Check bad states with CHECK_DATA_CORRUPTION() Kees Cook 2017-04-04 22:12 ` [kernel-hardening] " Kees Cook 2021-01-04 23:07 ` [PATCH v2] bug: further enhance use of CHECK_DATA_CORRUPTION Josh Poimboeuf
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1491343938-75336-2-git-send-email-keescook@chromium.org \ --to=keescook@chromium.org \ --cc=akpm@linux-foundation.org \ --cc=andriy.shevchenko@linux.intel.com \ --cc=chris@chris-wilson.co.uk \ --cc=dwindsor@gmail.com \ --cc=geert@linux-m68k.org \ --cc=jakub.kicinski@netronome.com \ --cc=jpoimboe@redhat.com \ --cc=kernel-hardening@lists.openwall.com \ --cc=kvalo@codeaurora.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux@sciencehorizons.net \ --cc=mingo@kernel.org \ --cc=olof@lixom.net \ --cc=paulmck@linux.vnet.ibm.com \ --cc=peterz@infradead.org \ --cc=riel@redhat.com \ --cc=tglx@linutronix.de \ --cc=viresh.kumar@linaro.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.