From: "Dilger, Andreas" <andreas.dilger@intel.com>
To: Wenwen Wang <wang6495@umn.edu>
Cc: "open list:STAGING SUBSYSTEM" <devel@driverdev.osuosl.org>,
Aastha Gupta <aastha.gupta4104@gmail.com>,
Roman Storozhenko <romeusmeister@gmail.com>,
Jeff Layton <jlayton@redhat.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Kangjie Lu <kjlu@umn.edu>, NeilBrown <neilb@suse.com>,
open list <linux-kernel@vger.kernel.org>,
"Drokin, Oleg" <oleg.drokin@intel.com>,
"moderated list:STAGING - LUSTRE PARALLEL FILESYSTEM"
<lustre-devel@lists.lustre.org>
Subject: Re: [PATCH v2] staging: lustre: llite: fix potential missing-check bug when copying lumv
Date: Tue, 1 May 2018 04:06:56 +0000 [thread overview]
Message-ID: <BA97D240-2B0A-4AD4-B83B-201C285E4DEB@intel.com> (raw)
In-Reply-To: <1525128971-8946-1-git-send-email-wang6495@umn.edu>
On Apr 30, 2018, at 16:56, Wenwen Wang <wang6495@umn.edu> wrote:
>
> In ll_dir_ioctl(), the object lumv3 is firstly copied from the user space
> using Its address, i.e., lumv1 = &lumv3. If the lmm_magic field of lumv3 is
> LOV_USER_MAGIC_V3, lumv3 will be modified by the second copy from the user
> space. The second copy is necessary, because the two versions (i.e.,
> lov_user_md_v1 and lov_user_md_v3) have different data formats and lengths.
> However, given that the user data resides in the user space, a malicious
> user-space process can race to change the data between the two copies. By
> doing so, the attacker can provide a data with an inconsistent version,
> e.g., v1 version + v3 data. This can lead to logical errors in the
> following execution in ll_dir_setstripe(), which performs different actions
> according to the version specified by the field lmm_magic.
>
> This patch rechecks the version field lmm_magic in the second copy. If the
> version is not as expected, i.e., LOV_USER_MAGIC_V3, an error code will be
> returned: -EINVAL.
>
> Signed-off-by: Wenwen Wang <wang6495@umn.edu>
Thanks for the updated patch.
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
> ---
> drivers/staging/lustre/lustre/llite/dir.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
> index d10d272..80d44ca 100644
> --- a/drivers/staging/lustre/lustre/llite/dir.c
> +++ b/drivers/staging/lustre/lustre/llite/dir.c
> @@ -1185,6 +1185,8 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> if (lumv1->lmm_magic == LOV_USER_MAGIC_V3) {
> if (copy_from_user(&lumv3, lumv3p, sizeof(lumv3)))
> return -EFAULT;
> + if (lumv3.lmm_magic != LOV_USER_MAGIC_V3)
> + return -EINVAL;
> }
>
> if (is_root_inode(inode))
> --
> 2.7.4
>
Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
next prev parent reply other threads:[~2018-05-01 4:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-30 22:56 Wenwen Wang
2018-05-01 4:06 ` Dilger, Andreas [this message]
2018-05-01 8:46 ` Dan Carpenter
2018-05-04 4:19 ` Wenwen Wang
2018-05-04 5:27 ` Dan Carpenter
2018-05-04 5:33 ` Wenwen Wang
2018-05-04 10:08 ` Dilger, Andreas
2018-05-04 14:11 ` Wenwen Wang
2018-05-04 15:01 Kangjie Lu
2018-05-05 8:29 ` Dan Carpenter
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=BA97D240-2B0A-4AD4-B83B-201C285E4DEB@intel.com \
--to=andreas.dilger@intel.com \
--cc=aastha.gupta4104@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=jlayton@redhat.com \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=lustre-devel@lists.lustre.org \
--cc=neilb@suse.com \
--cc=oleg.drokin@intel.com \
--cc=romeusmeister@gmail.com \
--cc=wang6495@umn.edu \
/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
all inboxes | Powered by JetHome®