<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>James,</p>
<p><br>
</p>
<p>This should be a purely syntactical change, to help out tools - for GCC, I'm pretty sure the meaning of { } and { NULL } are the same.  Also, I don't think struct randomization does what you're thinking.</p>
<p><br>
</p>
<p>Kees,</p>
<p><br>
</p>
<p>Is there anything written up on kernel struct randomization?  I was trying to find a talk/post from you or something from LWN, but I couldn't find something about this specifically.  (Probably because I can't find it among the other stuff that's been written
 up)<br>
</p>
<p><br>
</p>
<p>- Patrick<br>
</p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> lustre-devel <lustre-devel-bounces@lists.lustre.org> on behalf of James Simmons <jsimmons@infradead.org><br>
<b>Sent:</b> Monday, December 19, 2016 10:22:58 AM<br>
<b>To:</b> Kees Cook<br>
<b>Cc:</b> devel@driverdev.osuosl.org; Greg Kroah-Hartman; linux-kernel@vger.kernel.org; Oleg Drokin; Vitaly Fertman; Bruce Korb; Emoly Liu; lustre-devel@lists.lustre.org<br>
<b>Subject:</b> Re: [lustre-devel] [PATCH] staging: lustre: ldlm: use designated initializers</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText"><br>
> Prepare to mark sensitive kernel structures for randomization by making<br>
> sure they're using designated initializers. These were identified during<br>
> allyesconfig builds of x86, arm, and arm64, with most initializer fixes<br>
> extracted from grsecurity.<br>
> <br>
> Signed-off-by: Kees Cook <keescook@chromium.org><br>
> ---<br>
>  drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 2 +-<br>
>  1 file changed, 1 insertion(+), 1 deletion(-)<br>
> <br>
> diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c<br>
> index 722160784f83..f815827532dc 100644<br>
> --- a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c<br>
> +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c<br>
> @@ -143,7 +143,7 @@ static int ldlm_process_flock_lock(struct ldlm_lock *req, __u64 *flags,<br>
>        int added = (mode == LCK_NL);<br>
>        int overlaps = 0;<br>
>        int splitted = 0;<br>
> -     const struct ldlm_callback_suite null_cbs = { NULL };<br>
> +     const struct ldlm_callback_suite null_cbs = { };<br>
>  <br>
>        CDEBUG(D_DLMTRACE,<br>
>               "flags %#llx owner %llu pid %u mode %u start %llu end %llu\n",<br>
<br>
Nak. Filling null_cbs with random data is a bad idea. If you look at <br>
ldlm_lock_create() where this is used you have<br>
<br>
if (cbs) {<br>
        lock->l_blocking_ast = cbs->lcs_blocking;<br>
        lock->l_completion_ast = cbs->lcs_completion;<br>
        lock->l_glimpse_ast = cbs->lcs_glimpse;<br>
}<br>
<br>
Having lock->l_* point to random addresses is a bad idea.<br>
What really needs to be done is proper initialization of that<br>
structure. A bunch of patches will be coming to address this.<br>
_______________________________________________<br>
lustre-devel mailing list<br>
lustre-devel@lists.lustre.org<br>
<a href="http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org">http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org</a><br>
</div>
</span></font>
</body>
</html>