From patchwork Fri May 26 20:17:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9751097 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 287FC60246 for ; Fri, 26 May 2017 20:19:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B2AC28334 for ; Fri, 26 May 2017 20:19:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0FDBA28347; Fri, 26 May 2017 20:19:43 +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 3C03F28334 for ; Fri, 26 May 2017 20:19:42 +0000 (UTC) Received: (qmail 8140 invoked by uid 550); 26 May 2017 20:18:38 -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 7997 invoked from network); 26 May 2017 20:18:35 -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=Vi1sR7GvYhGVSPi7bOLpi/jFMBeMELMakr+wdtZHPxo=; b=S5Plbc1bBnZoC2a4ZFFHp9JhdZavCQZYFKsJkmt2XGzCEOrsBSHs2zg+BUk67+6vno B0T11alTmduIZ+QRBhBi6O6SQa3jE8VuWO9zz6h1TYXSedwvrI1RPE5ubJNTuQaiaodq OeXJ7RGMP3BLxOgph7b1W05p3tlGcEyKYzPuc= 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=Vi1sR7GvYhGVSPi7bOLpi/jFMBeMELMakr+wdtZHPxo=; b=aBQDjPH0/mA9yyOA0TuQ4a2+3Qr5FKXfAQ58f0kOxFNrAxJv+r+27CXdvDaUJ1J8pH yZ1v/oY770wgECiAr3KFaQqT5jqVJBG7KxR0Bp42HKVF7LoOn9Np5FjpKncsxGKmeV0i /GhKwGj3/Sa7iDB06HWyZpoLi2RIiXy8aJXypJexCmuktZdVvgbxQVhZl87AbjGAQB6o r5Uky6kRrgnvhaKZ0+DIF1Tq4ImahCys9pfTBuXHeHIhJCsim7kRbd4imWFaWLAEEyOt 032kznYYOgXt1+RpbfUh7aTxS/HbfkSw4/6ZOxaasbk+Rj7NfL4rdV7Ic3QBA+qCeXk3 1P/g== X-Gm-Message-State: AODbwcDBNq1zMkWPvUq25q8XLEyXrlDDv/qPXAHjeUtz5uW2DUp7LwHS RiM0Grxja4Qij3nQ X-Received: by 10.84.129.65 with SMTP id 59mr59791583plb.166.1495829903947; Fri, 26 May 2017 13:18:23 -0700 (PDT) From: Kees Cook To: kernel-hardening@lists.openwall.com Cc: Kees Cook , Laura Abbott , x86@kernel.org, linux-kernel@vger.kernel.org Date: Fri, 26 May 2017 13:17:16 -0700 Message-Id: <1495829844-69341-13-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1495829844-69341-1-git-send-email-keescook@chromium.org> References: <1495829844-69341-1-git-send-email-keescook@chromium.org> Subject: [kernel-hardening] [PATCH v2 12/20] sgi-xp: Use designated initializers X-Virus-Scanned: ClamAV using ClamSMTP Prepare to mark sensitive kernel structures for randomization by making sure they're using designated initializers. These were identified during allyesconfig builds of x86, arm, and arm64, with most initializer fixes extracted from grsecurity. To avoid casting, this implements dummy functions with full function prototypes. Signed-off-by: Kees Cook Acked-by: Robin Holt --- drivers/misc/sgi-xp/xp_main.c | 59 ++++++++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/drivers/misc/sgi-xp/xp_main.c b/drivers/misc/sgi-xp/xp_main.c index 01be66d02ca8..bb47f9d9b68a 100644 --- a/drivers/misc/sgi-xp/xp_main.c +++ b/drivers/misc/sgi-xp/xp_main.c @@ -71,20 +71,44 @@ EXPORT_SYMBOL_GPL(xpc_registrations); /* * Initialize the XPC interface to indicate that XPC isn't loaded. */ -static enum xp_retval -xpc_notloaded(void) +static void xpc_notloaded_connect(int ch_number) +{ } + +static void xpc_notloaded_disconnect(int ch_number) +{ } + +static enum xp_retval xpc_notloaded_send(short partid, int ch_number, + u32 flags, void *payload, + u16 payload_size) +{ + return xpNotLoaded; +} + +static enum xp_retval xpc_notloaded_send_notify(short partid, int ch_number, + u32 flags, void *payload, + u16 payload_size, + xpc_notify_func func, + void *key) +{ + return xpNotLoaded; +} + +static void xpc_notloaded_received(short partid, int ch_number, void *payload) +{ } + +static enum xp_retval xpc_notloaded_partid_to_nasids(short partid, + void *nasid_mask) { return xpNotLoaded; } struct xpc_interface xpc_interface = { - (void (*)(int))xpc_notloaded, - (void (*)(int))xpc_notloaded, - (enum xp_retval(*)(short, int, u32, void *, u16))xpc_notloaded, - (enum xp_retval(*)(short, int, u32, void *, u16, xpc_notify_func, - void *))xpc_notloaded, - (void (*)(short, int, void *))xpc_notloaded, - (enum xp_retval(*)(short, void *))xpc_notloaded + .connect = xpc_notloaded_connect, + .disconnect = xpc_notloaded_disconnect, + .send = xpc_notloaded_send, + .send_notify = xpc_notloaded_send_notify, + .received = xpc_notloaded_received, + .partid_to_nasids = xpc_notloaded_partid_to_nasids }; EXPORT_SYMBOL_GPL(xpc_interface); @@ -115,17 +139,12 @@ EXPORT_SYMBOL_GPL(xpc_set_interface); void xpc_clear_interface(void) { - xpc_interface.connect = (void (*)(int))xpc_notloaded; - xpc_interface.disconnect = (void (*)(int))xpc_notloaded; - xpc_interface.send = (enum xp_retval(*)(short, int, u32, void *, u16)) - xpc_notloaded; - xpc_interface.send_notify = (enum xp_retval(*)(short, int, u32, void *, - u16, xpc_notify_func, - void *))xpc_notloaded; - xpc_interface.received = (void (*)(short, int, void *)) - xpc_notloaded; - xpc_interface.partid_to_nasids = (enum xp_retval(*)(short, void *)) - xpc_notloaded; + xpc_interface.connect = xpc_notloaded_connect; + xpc_interface.disconnect = xpc_notloaded_disconnect; + xpc_interface.send = xpc_notloaded_send; + xpc_interface.send_notify = xpc_notloaded_send_notify; + xpc_interface.received = xpc_notloaded_received; + xpc_interface.partid_to_nasids = xpc_notloaded_partid_to_nasids; } EXPORT_SYMBOL_GPL(xpc_clear_interface);