public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Austin Kim <austindh.kim@gmail.com>
Cc: linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] xfs: Initialize label array properly
Date: Thu, 29 Aug 2019 22:39:45 -0700	[thread overview]
Message-ID: <20190830053945.GX5354@magnolia> (raw)
In-Reply-To: <20190830053707.GA69101@LGEARND20B15>

On Fri, Aug 30, 2019 at 02:37:07PM +0900, Austin Kim wrote:
> In case kernel stack variable is not initialized properly,
> there is a risk of kernel information disclosure.
> 
> So, initialize 'char label[]' array with null characters.

Got a testcase for this?  At least a couple other filesystems implement
this ioctl too, which means they all should be checked/tested on a
regular basis.

--D

> Signed-off-by: Austin Kim <austindh.kim@gmail.com>
> ---
>  fs/xfs/xfs_ioctl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
> index 9ea5166..09b3bee 100644
> --- a/fs/xfs/xfs_ioctl.c
> +++ b/fs/xfs/xfs_ioctl.c
> @@ -2037,7 +2037,7 @@ xfs_ioc_setlabel(
>  	char			__user *newlabel)
>  {
>  	struct xfs_sb		*sbp = &mp->m_sb;
> -	char			label[XFSLABEL_MAX + 1];
> +	char			label[XFSLABEL_MAX + 1] = {0};
>  	size_t			len;
>  	int			error;
>  
> -- 
> 2.6.2
> 

  reply	other threads:[~2019-08-30  5:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-30  5:37 [PATCH] xfs: Initialize label array properly Austin Kim
2019-08-30  5:39 ` Darrick J. Wong [this message]
2019-08-30 14:53   ` Austin Kim
2019-08-30  7:31 ` 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=20190830053945.GX5354@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=austindh.kim@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox