public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: xfs <linux-xfs@vger.kernel.org>
Cc: Eric Sandeen <sandeen@redhat.com>, Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH v2] xfs: fix kernel memory exposure problems
Date: Mon, 3 Apr 2017 12:42:33 -0700	[thread overview]
Message-ID: <20170403194233.GR4864@birch.djwong.org> (raw)
In-Reply-To: <20170403173430.GL4864@birch.djwong.org>

On Mon, Apr 03, 2017 at 10:34:30AM -0700, Darrick J. Wong wrote:
> Fix a memory exposure problems in inumbers where we allocate an array of
> structures with holes, fail to zero the holes, then blindly copy the
> kernel memory contents (junk and all) into userspace.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>

BTW, I intend to send this patch (though not the getbmap patch) for 4.11
since kernel memory exposure is usually treated as a security problem.

--D

> ---
> v2: split patches
> ---
>  fs/xfs/xfs_itable.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
> index 2a6d9b1..26d67ce 100644
> --- a/fs/xfs/xfs_itable.c
> +++ b/fs/xfs/xfs_itable.c
> @@ -583,7 +583,7 @@ xfs_inumbers(
>  		return error;
>  
>  	bcount = MIN(left, (int)(PAGE_SIZE / sizeof(*buffer)));
> -	buffer = kmem_alloc(bcount * sizeof(*buffer), KM_SLEEP);
> +	buffer = kmem_zalloc(bcount * sizeof(*buffer), KM_SLEEP);
>  	do {
>  		struct xfs_inobt_rec_incore	r;
>  		int				stat;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-04-03 19:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03 17:34 [PATCH v2] xfs: fix kernel memory exposure problems Darrick J. Wong
2017-04-03 17:36 ` [PATCH] xfs: fix over-copying of getbmap parameters from userspace Darrick J. Wong
2017-04-03 18:57   ` Christoph Hellwig
2017-04-03 19:20     ` Darrick J. Wong
2017-04-03 19:42 ` Darrick J. Wong [this message]
2017-04-03 20:06   ` [PATCH v2] xfs: fix kernel memory exposure problems Eric Sandeen
2017-04-04  6:54     ` Christoph Hellwig

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=20170403194233.GR4864@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=hch@infradead.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@redhat.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