From patchwork Tue Apr 4 22:12:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9662697 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BE6D06032D for ; Tue, 4 Apr 2017 22:13:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B057E27F94 for ; Tue, 4 Apr 2017 22:13:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4DF52858B; Tue, 4 Apr 2017 22:13:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id C656E27F94 for ; Tue, 4 Apr 2017 22:12:59 +0000 (UTC) Received: (qmail 26332 invoked by uid 550); 4 Apr 2017 22:12:39 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 26227 invoked from network); 4 Apr 2017 22:12:37 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yRucxwTnJ3sQEme4G1xZVKu03zXW9FNdip0XVzS5tlU=; b=NHq5imAwyN6ZlMeZcVLVlHbyKLoKJ4TEnMFy3Bdom3bwP5hToVH9Ik2Gc2boFnDzY5 0AoPmmgiWXsKIMjkCxQpGqmCVP2ZLl+igMme8RCyF+3+JwW2o8wlmLRaFXZ22GZqt5iA IRY4MjvljBVNefYYbmR/2BeEl7tVLwr38c3ak= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yRucxwTnJ3sQEme4G1xZVKu03zXW9FNdip0XVzS5tlU=; b=ThjqoNjh7LKEbHHkyNXXVMJNOeYUSLKPv8yjQnV7VgmKD4/Qg3IZOEtFraLqwVSMWn KWojkd/CKa6Jm9qcoLPn0aam6JXN2o5Dp66at1SstMnycVFYKnEVNSW12XCBBHzM+aa1 V5k4OTTtV0tCFUEdJYOAh02J8+l9hrYOJ30BJZxdLYOOYOvJfReb/sibOahYKLXxHQFu 6slQ2nVPCcOJU+ShHAG529jfKk0wz2lTwEcDl2yvetTpALR9wrbYn9R1IbrEfAGBiL59 x9M29C+DoRBKdnYTPDpajF65qZRXU83rRK5EN/j4tjV5ad8y1GYX8ylTbQxJWnOi9d9g FxOw== X-Gm-Message-State: AFeK/H0Cd7MF7G/fqtC+SG+TKbixPgdy7YojPD9uJvWZ94yc+ZJZsY2kIoTu4XLketH7bvut X-Received: by 10.84.218.69 with SMTP id f5mr31914047plm.114.1491343945641; Tue, 04 Apr 2017 15:12:25 -0700 (PDT) From: Kees Cook To: Ingo Molnar Cc: Kees Cook , Peter Zijlstra , "Paul E. McKenney" , Kalle Valo , Andrew Morton , Rik van Riel , Jakub Kicinski , Viresh Kumar , Andy Shevchenko , Geert Uytterhoeven , Olof Johansson , Chris Wilson , George Spelvin , Thomas Gleixner , Josh Poimboeuf , David Windsor , linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Date: Tue, 4 Apr 2017 15:12:12 -0700 Message-Id: <1491343938-75336-2-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491343938-75336-1-git-send-email-keescook@chromium.org> References: <1491343938-75336-1-git-send-email-keescook@chromium.org> Subject: [kernel-hardening] [PATCH v2 1/7] bug: Clarify help text for BUG_ON_DATA_CORRUPTION X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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.