public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Jeffrey Hundstad <jeffrey.hundstad@mnsu.edu>, xfs@oss.sgi.com
Subject: Re: kernel panic - stack-protector: kernel stack is corrupted in: f87aca93
Date: Tue, 1 Mar 2011 13:57:26 +1100	[thread overview]
Message-ID: <20110301025726.GF3087@dastard> (raw)
In-Reply-To: <4D6C4CC5.5030909@sandeen.net>

On Mon, Feb 28, 2011 at 07:32:53PM -0600, Eric Sandeen wrote:
> On 2/28/11 7:03 PM, Jeffrey Hundstad wrote:
> > Sadly, I didn't have the vmlinux file around anymore.  I'll be glad to recreate it when I get in tomorrow.  However, I have revered commit 3a3675b7f23f83ca8c67c9c2b6edf707fd28d1ba and the problem seems to have vanished.  I'm guessing the stack at this point is a little to fragile for a memset.  The patch is:
> 
> Ok, no worries, if the below commit is the culprit for sure, that's enough...
> 
> So, whoopsies.
> 
> STATIC int
> xfs_ioc_fsgeometry_v1(
>         xfs_mount_t             *mp,
>         void                    __user *arg)
> {
>         xfs_fsop_geom_v1_t      fsgeo;
>         int                     error;
> 
>         error = xfs_fs_geometry(mp, (xfs_fsop_geom_t *)&fsgeo, 3);
> 
> what we really have is an xfs_fsop_geom_v1_t, but cast to a xfs_fsop_geom_t.
> 
> xfs_fs_geometry() zeroes it out to the tune of sizeof (xfs_fsop_geom_t)
> 
> the latter is bigger, with the addition of
> 
> 	__u32           logsunit;
> 
> so we overwrite memory that's not ours.  :(  Seems like we should zero
> in the callers, when we know how much is really on the stack.  I'll follow
> up with a patch; pity this one was fast-tracked for security, I think :(

Fmeh - the differences in structure size, alignment and padding on
different platforms was why I suggested that memset() is a
preferable fix to just setting a single field. I didn't look any
further at the patch before it was committed so I didn't catch the
fact that it was busted in the first place...

Just another example of Occam's Eraser(*) in action, I'd say.

Cheers,

Dave

(*) From the Fortune Cookie database:

OCCAM'S ERASER:
  The philosophical principle that even the simplest solution is
  bound to have something wrong with it.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2011-03-01  2:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-28 22:58 kernel panic - stack-protector: kernel stack is corrupted in: f87aca93 Jeffrey Hundstad
2011-03-01  0:00 ` Eric Sandeen
2011-03-01  1:03   ` Jeffrey Hundstad
2011-03-01  1:32     ` Eric Sandeen
2011-03-01  2:57       ` Dave Chinner [this message]
2011-03-01  1:37 ` [PATCH] xfs: zero proper structure size for geometry calls Eric Sandeen
2011-03-01  2:59   ` Dave Chinner
2011-03-01  3:01     ` Eric Sandeen
2011-03-01  6:59   ` [PATCH V2] " Eric Sandeen
2011-03-01 12:55     ` Dan Rosenberg
2011-03-01 15:36       ` Jeffrey Hundstad
2011-03-01 15:49         ` Eric Sandeen
2011-03-01 17:50           ` [PATCH, V3 (sort of)] " Alex Elder
2011-03-01 18:18             ` Eric Sandeen
2011-03-01 21:40               ` Jeffrey Hundstad
2011-03-02  0:02             ` Dave Chinner

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=20110301025726.GF3087@dastard \
    --to=david@fromorbit.com \
    --cc=jeffrey.hundstad@mnsu.edu \
    --cc=sandeen@sandeen.net \
    --cc=xfs@oss.sgi.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