From: Josef Bacik <josef@redhat.com>
To: Dan Rosenberg <drosenberg@vsecurity.com>
Cc: chris.mason@oracle.com, security@kernel.org,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@kernel.org
Subject: Re: [PATCH] btrfs: prevent heap corruption in btrfs_ioctl_space_info()
Date: Wed, 9 Feb 2011 10:51:33 -0500 [thread overview]
Message-ID: <20110209155130.GA2564@localhost.localdomain> (raw)
In-Reply-To: <1297260766.2327.40.camel@dan>
On Wed, Feb 09, 2011 at 09:12:46AM -0500, Dan Rosenberg wrote:
> Commit bf5fc093c5b625e4259203f1cee7ca73488a5620 refactored
> btrfs_ioctl_space_info() and introduced several security issues.
>
> space_args.space_slots is an unsigned 64-bit type controlled by a
> possibly unprivileged caller. The comparison as a signed int type
> allows providing values that are treated as negative and cause the
> subsequent allocation size calculation to wrap, or be truncated to 0.
> By providing a size that's truncated to 0, kmalloc() will return
> ZERO_SIZE_PTR. It's also possible to provide a value smaller than the
> slot count. The subsequent loop ignores the allocation size when
> copying data in, resulting in a heap overflow or write to ZERO_SIZE_PTR.
>
> The fix changes the slot count type and comparison typecast to u64,
> which prevents truncation or signedness errors, and also ensures that we
> don't copy more data than we've allocated in the subsequent loop. Note
> that zero-size allocations are no longer possible since there is already
> an explicit check for space_args.space_slots being 0 and truncation of
> this value is no longer an issue.
>
> Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com>
Reviewed-by: Josef Bacik <josef@redhat.com>
Thanks,
Josef
next prev parent reply other threads:[~2011-02-09 15:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-09 14:12 [PATCH] btrfs: prevent heap corruption in btrfs_ioctl_space_info() Dan Rosenberg
2011-02-09 15:51 ` Josef Bacik [this message]
2011-02-09 16:16 ` Josef Bacik
2011-02-09 16:45 ` Dan Rosenberg
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=20110209155130.GA2564@localhost.localdomain \
--to=josef@redhat.com \
--cc=chris.mason@oracle.com \
--cc=drosenberg@vsecurity.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=security@kernel.org \
--cc=stable@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.