linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Dan Carpenter <dancarpenter@oracle.com>
Cc: Chris Mason <clm@fb.com>, Arne Jansen <sensille@gmx.net>,
	Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>,
	linux-btrfs@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] btrfs: prevent potential out of bounds in btrfs_ioctl_snap_create_v2()
Date: Mon, 22 Feb 2021 20:33:03 +0100	[thread overview]
Message-ID: <20210222193302.GT1993@suse.cz> (raw)
In-Reply-To: <YCyx8u40HaplP7a+@mwanda>

On Wed, Feb 17, 2021 at 09:04:34AM +0300, Dan Carpenter wrote:
> The problem is we're copying "inherit" from user space but we don't
> necessarily know that we're copying enough data for a 64 byte
> struct.  Then the next problem is that "inherit" has a variable size
> array at the end, and we have to verify that array is the size we
> expected.
> 
> Fixes: 6f72c7e20dba: ("Btrfs: add qgroup inheritance")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Presumably only root can create snapshots.

Well, no. After first analysis there are some "interesting memory access
patterns" possible, with a crafted data in the inherit member.

> Anyway, I have not tested
> this fix.  I believe it is correct, of course.  But perhaps it's best
> to check.

Yeah I'll write a test also to see where exactly the issues are. Thanks
for the report/fix.

      reply	other threads:[~2021-02-22 19:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-17  6:04 [PATCH] btrfs: prevent potential out of bounds in btrfs_ioctl_snap_create_v2() Dan Carpenter
2021-02-22 19:33 ` David Sterba [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=20210222193302.GT1993@suse.cz \
    --to=dsterba@suse.cz \
    --cc=clm@fb.com \
    --cc=dancarpenter@oracle.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=sensille@gmx.net \
    /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;
as well as URLs for NNTP newsgroup(s).