public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Kristian <kbx@posteo.de>
Cc: xfs@oss.sgi.com
Subject: Re: Integer truncation in fs/xfs/libxfs/xfs_da_btree.c
Date: Mon, 21 Dec 2015 06:29:32 +1100	[thread overview]
Message-ID: <20151220192932.GR26718@dastard> (raw)
In-Reply-To: <5676A0C6.9000407@posteo.de>

On Sun, Dec 20, 2015 at 01:36:22PM +0100, Kristian wrote:
> Hello,
> 
> there is an integer truncation in
> 
> fs/xfs/libxfs/xfs_da_btree.c +2081
> 
> /* account for newly allocated blocks in reserved blocks total */
> args->total -= dp->i_d.di_nblocks - nblks;
> 
> with the types: uint32 -= uint64 - uint64
> 
> On a hardened kernel with grsecurity enabled, this leads to a fault.
> 
> https://forums.grsecurity.net/viewtopic.php?f=3&t=4346&sid=3200600c0faaab4bf8779a95c549a737
> 
> Is this intentional and safe?

Yes and yes. We can be, at most, asking for 128 blocks to be
allocated in this function, so that  "uint64 - uint64" will
typically have a value of 1 or 2. the worst case is about 130 in the
most extreme, never-used-but-still-possible filesystem
configuration.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

      reply	other threads:[~2015-12-20 19:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-20 12:36 Integer truncation in fs/xfs/libxfs/xfs_da_btree.c Kristian
2015-12-20 19:29 ` Dave Chinner [this message]

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=20151220192932.GR26718@dastard \
    --to=david@fromorbit.com \
    --cc=kbx@posteo.de \
    --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