From patchwork Wed Jul 27 15:31:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emese Revfy X-Patchwork-Id: 9249989 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 D73E3607F0 for ; Wed, 27 Jul 2016 15:13:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9077269B2 for ; Wed, 27 Jul 2016 15:13:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BCB6926D06; Wed, 27 Jul 2016 15:13:36 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5AD86269B2 for ; Wed, 27 Jul 2016 15:13:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756606AbcG0PNX (ORCPT ); Wed, 27 Jul 2016 11:13:23 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35042 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753179AbcG0PNW (ORCPT ); Wed, 27 Jul 2016 11:13:22 -0400 Received: by mail-wm0-f67.google.com with SMTP id i5so6939999wmg.2; Wed, 27 Jul 2016 08:13:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RUO9ChFqZ4QNNhswRfSGK3YdCd4u2X3xojCZ59Cb7EQ=; b=D2xS9E7D2h7zZYARh81Ays5YsN8ib5omSlNhcl5RYpou8v7IHWxTYwWFTMO5wHgqtM 4slV/Gu2+7wECctNN287FoAh0FXdGjsBULXndEF9uDjWxtgT8Hm1WI1rWh/1Ib4QyYOx JF+YWpXhw7GmPQnDuzZjI4EHo42Xt8UqCQ+41bdE9zaRJ4i0uyMoE0xB/znlW8DaehjP fKaxQ1fN+BQqlkQ6EeWQlSF2vKGYs03USvNMEtekvy+EnE31Yt2QYlVq5edafSt/H7Kn ctp0xIsLSgdOWXy/JplpeMWYJlhIxO6BlVTjczszta5U/vL5lrcPY5e0UbHjOVNU80a2 2/UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RUO9ChFqZ4QNNhswRfSGK3YdCd4u2X3xojCZ59Cb7EQ=; b=UjZ39uDxjtl/JL0ZBjVkztQMqwtW6eFa4pciUJ1/m/7y0jvYQl4t4p5gI3r6zzDjC7 0FzFaOCtNS1/Cx3Tu0PNb28HwrdixKPifCWkU0uSl/NmLHWXlaEmZ1Y8tE0VRv12q+Ze g/zw57w5xFaVacJenwPjb5MzRZJpJny5+Wus7ux/c4NRq8jZ6nmRwc35U8Fn6gSpHMUU retKihmwXr+SZlydvr0Ex/9MpSf9N+yJaQ3cZ2Xy5WnahWxv0tzcbTLa/BLXRhQKr007 I8cWxb2umj2td1NqOOT3/1UbNRyVyZpoLGLmx9SMVLWOAAvHNuFeh2I30VvLc6FapASM L2Ng== X-Gm-Message-State: AEkoouuK4aoDR1mAIZT83v7C4irqX74z/30Z6koLI3/Ju48ZaX4T4fpmbb9wYU6OYLKSlQ== X-Received: by 10.194.18.198 with SMTP id y6mr30055345wjd.87.1469632400309; Wed, 27 Jul 2016 08:13:20 -0700 (PDT) Received: from vakond.lan (beleg.madhouse-project.org. [128.199.36.147]) by smtp.gmail.com with ESMTPSA id 3sm7659419wms.1.2016.07.27.08.13.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jul 2016 08:13:19 -0700 (PDT) Date: Wed, 27 Jul 2016 17:31:42 +0200 From: Emese Revfy To: kernel-hardening@lists.openwall.com Cc: pageexec@freemail.hu, spender@grsecurity.net, mmarek@suse.com, keescook@chromium.org, linux-kernel@vger.kernel.org, yamada.masahiro@socionext.com, linux-kbuild@vger.kernel.org, minipli@ld-linux.so, linux@armlinux.org.uk, catalin.marinas@arm.com, linux@rasmusvillemoes.dk, david.brown@linaro.org, benh@kernel.crashing.org, tglx@linutronix.de, akpm@linux-foundation.org, jlayton@poochiereds.net, arnd@arndb.de, sam@ravnborg.org, isdn@linux-pingi.de Subject: [PATCH v3 2/7] Split up struct warn_args Message-Id: <20160727173142.c8bba4e83d80e9020018216d@gmail.com> In-Reply-To: <20160726223813.16d7cfd7f7dc514c6f7f9e9d@gmail.com> References: <20160726223541.513ce76f6de65389da6a6abe@gmail.com> <20160726223813.16d7cfd7f7dc514c6f7f9e9d@gmail.com> X-Mailer: Sylpheed 3.5.0 (GTK+ 2.24.30; x86_64-pc-linux-gnu) Mime-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Disable the initify plugin on the 6th parameter of __warn() because the va_list type can't be NULL on the tile arch. Signed-off-by: Emese Revfy --- include/asm-generic/bug.h | 7 +++++-- kernel/panic.c | 32 ++++++++++++++++++++------------ lib/bug.c | 2 +- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index 13a9241..f6ae0d7 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h @@ -81,9 +81,12 @@ extern __nocapture(1) void warn_slowpath_null(const char *file, const int line); do { printk(arg); __WARN_TAINT(taint); } while (0) #endif -__nocapture(1, 6) +/* used internally by panic.c */ +struct warn_args; + +__nocapture(1, 0) void __warn(const char *file, int line, void *caller, unsigned taint, - struct pt_regs *regs, const char *fmt, va_list args); + struct pt_regs *regs, struct warn_args *args); #ifndef WARN_ON #define WARN_ON(condition) ({ \ diff --git a/kernel/panic.c b/kernel/panic.c index 993ad20..ca8cea1 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -475,8 +475,13 @@ void oops_exit(void) kmsg_dump(KMSG_DUMP_OOPS); } +struct warn_args { + const char *fmt; + va_list args; +}; + void __warn(const char *file, int line, void *caller, unsigned taint, - struct pt_regs *regs, const char *fmt, va_list args) + struct pt_regs *regs, struct warn_args *args) { disable_trace_on_warning(); @@ -490,8 +495,8 @@ void __warn(const char *file, int line, void *caller, unsigned taint, pr_warn("WARNING: CPU: %d PID: %d at %pS\n", raw_smp_processor_id(), current->pid, caller); - if (fmt) - vprintk(fmt, args); + if (args) + vprintk(args->fmt, args->args); if (panic_on_warn) { /* @@ -520,28 +525,31 @@ void __warn(const char *file, int line, void *caller, unsigned taint, #ifdef WANT_WARN_ON_SLOWPATH void warn_slowpath_fmt(const char *file, int line, const char *fmt, ...) { - va_list args; + struct warn_args args; - va_start(args, fmt); - __warn(file, line, __builtin_return_address(0), TAINT_WARN, NULL, fmt, args); - va_end(args); + args.fmt = fmt; + va_start(args.args, fmt); + __warn(file, line, __builtin_return_address(0), TAINT_WARN, NULL, + &args); + va_end(args.args); } EXPORT_SYMBOL(warn_slowpath_fmt); void warn_slowpath_fmt_taint(const char *file, int line, unsigned taint, const char *fmt, ...) { - va_list args; + struct warn_args args; - va_start(args, fmt); - __warn(file, line, __builtin_return_address(0), taint, NULL, fmt, args); - va_end(args); + args.fmt = fmt; + va_start(args.args, fmt); + __warn(file, line, __builtin_return_address(0), taint, NULL, &args); + va_end(args.args); } EXPORT_SYMBOL(warn_slowpath_fmt_taint); void warn_slowpath_null(const char *file, int line) { - __warn(file, line, __builtin_return_address(0), TAINT_WARN, NULL, NULL, NULL); + __warn(file, line, __builtin_return_address(0), TAINT_WARN, NULL, NULL); } EXPORT_SYMBOL(warn_slowpath_null); #endif diff --git a/lib/bug.c b/lib/bug.c index c8bdebb..bc3656e 100644 --- a/lib/bug.c +++ b/lib/bug.c @@ -168,7 +168,7 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs) if (warning) { /* this is a WARN_ON rather than BUG/BUG_ON */ __warn(file, line, (void *)bugaddr, BUG_GET_TAINT(bug), regs, - NULL, NULL); + NULL); return BUG_TRAP_TYPE_WARN; }