From patchwork Tue Apr 4 22:12:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9662705 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 A27446032D for ; Tue, 4 Apr 2017 22:13:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9480C27F94 for ; Tue, 4 Apr 2017 22:13:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88FE428587; Tue, 4 Apr 2017 22:13:19 +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 9C2ED27F94 for ; Tue, 4 Apr 2017 22:13:18 +0000 (UTC) Received: (qmail 26415 invoked by uid 550); 4 Apr 2017 22:12:41 -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 26271 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=SDpHlvOhK7exbi2d4HDTtbTcpr3RMk9Ii052KFPs1uo=; b=g/3xs/PrEHbJDZPrafh8R+saXIJVVs3vB1CjXL5Q+aQyK+HHZdPWcs2TCdDHmpHGVH tJuxt9L9GzLGL3SfOOCNT3YlK6osMG5hEkToWnlyg11DCg2sz9gjp37Y8wpNsbBDi/q4 6xwWsvY8OPM4nGAtUvtchrd6vhhe9lOWAy9Ps= 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=SDpHlvOhK7exbi2d4HDTtbTcpr3RMk9Ii052KFPs1uo=; b=iHmiK5eYjKtGROwKBYnTE08MwFVQwwE+P5QFklN/Ov+GfF0IpTz7ISzZD6HnNru/Dq 0RLZjTG244Q9mukJvYBAwcqtIHVqZM2FDUwxryMmqOi6X1UxtwuQE99NWJs+pusUchAM UnYx8I2js/mMq4sPo2FUiRIaj+rcblV2pyOoAqhFcY4gCUZ35BsRiB5MUvqRVSQNQF3h ysBJOYm3eZmtLfYHtYD0c+6wL4Jl2FvjAv3A9G9rtmeH8ZHvG1eTEGVZrMnGbvIq04FX 09ueh+xdNaFUUunrRP0/862+z4G/XVaKNMQhBj8fVex7hhq5RMPxijriPEhcLkJDoXBm rL9w== X-Gm-Message-State: AFeK/H3Fs2NPNhfH6TYWr+IT9245406Ouy53hC2Bf+XSLkCnZhnvgzhONhc+wiWhHA6ZSSWX X-Received: by 10.84.197.131 with SMTP id n3mr31523564pld.43.1491343946237; Tue, 04 Apr 2017 15:12:26 -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:14 -0700 Message-Id: <1491343938-75336-4-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 3/7] bug: Use WARN_ONCE() for CHECK_DATA_CORRUPTION() X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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); \ }))