From: Kees Cook <keescook@chromium.org>
To: linux-kernel@vger.kernel.org
Cc: Cliff Whickman <cpw@sgi.com>, Robin Holt <robinmholt@gmail.com>
Subject: [PATCH] sgi-xp: use designated initializers
Date: Fri, 16 Dec 2016 17:01:27 -0800 [thread overview]
Message-ID: <20161217010127.GA140378@beast> (raw)
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.
Signed-off-by: Kees Cook <keescook@chromium.org>
---
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);
--
2.7.4
--
Kees Cook
Nexus Security
next reply other threads:[~2016-12-17 1:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-17 1:01 Kees Cook [this message]
2016-12-21 16:24 ` [PATCH] sgi-xp: use designated initializers Robin Holt
2017-01-03 23:19 ` Kees Cook
2017-03-29 20:48 ` Kees Cook
2017-05-06 7:16 ` Kees Cook
2017-05-08 17:32 ` Robin Holt
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=20161217010127.GA140378@beast \
--to=keescook@chromium.org \
--cc=cpw@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robinmholt@gmail.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox