All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] fs/dlm: Fix kernel memory disclosure
Date: Thu, 26 Jan 2017 10:54:44 +0000	[thread overview]
Message-ID: <2efd4f10-da3a-4a24-a9a2-cb0b96d60338@redhat.com> (raw)
In-Reply-To: <CAH0z3hPjz7eg-hpQqM8aZY9pUb=MVWGf6T8w3vx+C81n3EAV0Q@mail.gmail.com>

Hi,


On 26/01/17 08:54, Vlad Tsyrklevich wrote:
> Hello, I wanted to ping the list and see if this could get a review.
>
> On Mon, Jan 9, 2017 at 8:27 PM, Vlad Tsyrklevich <vlad@tsyrklevich.net> wrote:
>> Clear the 'unused' field to avoid leaking memory to userland in
>> copy_result_to_user().
>>
>> Signed-off-by: Vlad Tsyrklevich <vlad@tsyrklevich.net>
>> ---
>>   fs/dlm/user.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/fs/dlm/user.c b/fs/dlm/user.c
>> index 1ce908c..0570711 100644
>> --- a/fs/dlm/user.c
>> +++ b/fs/dlm/user.c
>> @@ -138,6 +138,8 @@ static void compat_output(struct dlm_lock_result *res,
>>          res32->lksb.sb_flags = res->lksb.sb_flags;
>>          res32->lksb.sb_lkid = res->lksb.sb_lkid;
>>          res32->lksb.sb_lvbptr = (__u32)(long)res->lksb.sb_lvbptr;
>> +
>> +       memset(&res32->unused, 0, sizeof(res32->unused));
>>   }
>>   #endif
>>
>> --
>> 2.7.0
>>
It looks like struct dlm_lksb32 has a hole in it, so it would be safer 
just to zero the whole of the dlm_lock_result32 before it is written to, 
rather than trying to find all the holes individually, even if slightly 
slower (I'm not sure it would be noticeable in reality though)

Steve.



  reply	other threads:[~2017-01-26 10:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-09 13:27 [Cluster-devel] [PATCH] fs/dlm: Fix kernel memory disclosure Vlad Tsyrklevich
2017-01-26  8:54 ` Vlad Tsyrklevich
2017-01-26 10:54   ` Steven Whitehouse [this message]
2017-02-02 16:58     ` Vlad Tsyrklevich

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=2efd4f10-da3a-4a24-a9a2-cb0b96d60338@redhat.com \
    --to=swhiteho@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.