All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vasiliy Kulikov <segooon@gmail.com>
To: Jiri Slaby <jslaby@suse.cz>
Cc: kernel-janitors@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Alan Cox <alan@linux.intel.com>, Arnd Bergmann <arnd@arndb.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/8] char: synclink: fix information leak to userland
Date: Sun, 17 Oct 2010 15:38:39 +0000	[thread overview]
Message-ID: <20101017153839.GA11029@albatros> (raw)
In-Reply-To: <4CBB177C.9050007@suse.cz>

On Sun, Oct 17, 2010 at 17:34 +0200, Jiri Slaby wrote:
> On 10/17/2010 04:41 PM, Vasiliy Kulikov wrote:
> > Structure new_line is copied to userland with some padding fields unitialized.
> > It leads to leaking of stack memory.
> 
> I think your tool has a bug. I must admit I fail to see the padding
> which would cause leaks. Could you elaborate?

I didn't use any tool except "grep copy_to_user" :)

    typedef struct { 
        unsigned int clock_rate; /* bits per second */
        unsigned int clock_type; /* internal, external, TX-internal etc. */
        unsigned short loopback;
    } sync_serial_settings;          /* V.35, V.24, X.21 */

On x86_64 sizeof(sync_serial_settings) = 4 + 4 + 2 + 2 = 12.
The last 2 is padding.

> 
> > Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
> > ---
> >  Compile tested.
> > 
> >  drivers/char/synclink.c |    2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
> > index 3a6824f..abd0867 100644
> > --- a/drivers/char/synclink.c
> > +++ b/drivers/char/synclink.c
> > @@ -7846,6 +7846,8 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
> >  	if (cmd != SIOCWANDEV)
> >  		return hdlc_ioctl(dev, ifr, cmd);
> >  
> > +	memset(&new_line, 0, size);
> > +
> >  	switch(ifr->ifr_settings.type) {
> >  	case IF_GET_IFACE: /* return current sync_serial_settings */
> >  
> 
> 
> -- 
> js
> suse labs

-- 
Vasiliy

WARNING: multiple messages have this Message-ID (diff)
From: Vasiliy Kulikov <segooon@gmail.com>
To: Jiri Slaby <jslaby@suse.cz>
Cc: kernel-janitors@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Alan Cox <alan@linux.intel.com>, Arnd Bergmann <arnd@arndb.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/8] char: synclink: fix information leak to userland
Date: Sun, 17 Oct 2010 19:38:39 +0400	[thread overview]
Message-ID: <20101017153839.GA11029@albatros> (raw)
In-Reply-To: <4CBB177C.9050007@suse.cz>

On Sun, Oct 17, 2010 at 17:34 +0200, Jiri Slaby wrote:
> On 10/17/2010 04:41 PM, Vasiliy Kulikov wrote:
> > Structure new_line is copied to userland with some padding fields unitialized.
> > It leads to leaking of stack memory.
> 
> I think your tool has a bug. I must admit I fail to see the padding
> which would cause leaks. Could you elaborate?

I didn't use any tool except "grep copy_to_user" :)

    typedef struct { 
        unsigned int clock_rate; /* bits per second */
        unsigned int clock_type; /* internal, external, TX-internal etc. */
        unsigned short loopback;
    } sync_serial_settings;          /* V.35, V.24, X.21 */

On x86_64 sizeof(sync_serial_settings) = 4 + 4 + 2 + 2 = 12.
The last 2 is padding.

> 
> > Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
> > ---
> >  Compile tested.
> > 
> >  drivers/char/synclink.c |    2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
> > index 3a6824f..abd0867 100644
> > --- a/drivers/char/synclink.c
> > +++ b/drivers/char/synclink.c
> > @@ -7846,6 +7846,8 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
> >  	if (cmd != SIOCWANDEV)
> >  		return hdlc_ioctl(dev, ifr, cmd);
> >  
> > +	memset(&new_line, 0, size);
> > +
> >  	switch(ifr->ifr_settings.type) {
> >  	case IF_GET_IFACE: /* return current sync_serial_settings */
> >  
> 
> 
> -- 
> js
> suse labs

-- 
Vasiliy

  reply	other threads:[~2010-10-17 15:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-17 14:41 [PATCH 6/8] char: synclink: fix information leak to userland Vasiliy Kulikov
2010-10-17 14:41 ` Vasiliy Kulikov
2010-10-17 15:34 ` Jiri Slaby
2010-10-17 15:34   ` Jiri Slaby
2010-10-17 15:38   ` Vasiliy Kulikov [this message]
2010-10-17 15:38     ` Vasiliy Kulikov
2010-10-17 17:36     ` Dan Carpenter
2010-10-17 17:36       ` Dan Carpenter
2010-10-17 17:50       ` Vasiliy Kulikov
2010-10-17 17:50         ` Vasiliy Kulikov
2010-10-17 17:46     ` Jiri Slaby
2010-10-17 17:46       ` Jiri Slaby
2010-10-17 17:55       ` Vasiliy Kulikov
2010-10-17 17:55         ` Vasiliy Kulikov

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=20101017153839.GA11029@albatros \
    --to=segooon@gmail.com \
    --cc=alan@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@suse.de \
    --cc=jslaby@suse.cz \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.