qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
	Felix Wilhelm <fwilhelm@ernw.de>,
	"Michael S. Tsirkin" <mst@redhat.com>, P J P <ppandit@redhat.com>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH v4 1/3] 9pfs: forbid illegal path names
Date: Tue, 30 Aug 2016 21:27:05 +0200	[thread overview]
Message-ID: <20160830212705.52840d45@bahia.lan> (raw)
In-Reply-To: <23f1a214-da76-7bda-d464-20f4d55def25@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2272 bytes --]

On Tue, 30 Aug 2016 13:03:40 -0500
Eric Blake <eblake@redhat.com> wrote:

> On 08/30/2016 12:11 PM, Greg Kurz wrote:
> > Empty path components don't make sense for most commands and may cause
> > undefined behavior, depending on the backend.
> > 
> > Also, the walk request described in the 9P spec [1] clearly shows that
> > the client is supposed to send individual path components: the official
> > linux client never sends portions of path containing the / character for
> > example.
> > 
> > Moreover, the 9P spec [2] also states that a system can decide to restrict
> > the set of supported characters used in path components, with an explicit
> > mention "to remove slashes from name components".
> > 
> > This patch introduces a new name_is_illegal() helper that checks the
> > names sent by the client are not empty and don't contain unwanted chars.
> > Since 9pfs is only supported on linux hosts, only the / character is
> > checked at the moment. When support for other hosts (AKA. win32) is added,
> > other chars may need to be blacklisted as well.
> > 
> > If a client sends an illegal path component, the request will fail and
> > ENOENT is returned to the client.
> > 
> > [1] http://man.cat-v.org/plan_9/5/walk
> > [2] http://man.cat-v.org/plan_9/5/intro
> > 
> > Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> > Signed-off-by: Greg Kurz <groug@kaod.org>
> > ---
> > v4: dropped the checking of the symbolic link target name: because a target
> >     can be a full path and thus contain '/' and linux already complains if
> >     it is an empty string. When the symlink gets dereferenced, slashes are
> >     interpreted as the usual path component separator.  
> 
> Can a symlink to "/foo" be used to escape the root (by being absolute

No it can't because the target isn't a actually a file name but a string that
will be translated to a path when the link is dereferenced. And all other
requests with a file name argument that could have some unwanted effect don't
allow '/' in file names.

> instead of relative)?  However, if the answer to that question requires
> more code, I'm fine with it being a separate patch.  So for this email,
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  reply	other threads:[~2016-08-30 19:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-30 17:10 [Qemu-devel] [PATCH v4 0/3] 9pfs security fixes Greg Kurz
2016-08-30 17:11 ` [Qemu-devel] [PATCH v4 1/3] 9pfs: forbid illegal path names Greg Kurz
2016-08-30 18:03   ` Eric Blake
2016-08-30 19:27     ` Greg Kurz [this message]
2016-08-31  2:42     ` Aneesh Kumar K.V
2016-08-30 17:13 ` [Qemu-devel] [PATCH v4 2/3] 9pfs: forbid . and .. in file names Greg Kurz
2016-08-30 18:06   ` Eric Blake
2016-08-30 19:03     ` Greg Kurz
2016-08-30 18:19 ` [Qemu-devel] [PATCH v4 0/3] 9pfs security fixes Michael S. Tsirkin
2016-08-30 18:29 ` Peter Maydell
2016-08-30 19:39   ` Peter Maydell
2016-08-31  9:33     ` Greg Kurz
2016-08-30 18:40 ` [Qemu-devel] [PATCH v4 3/3] 9pfs: handle walk of ".." in the root directory Greg Kurz
2016-09-15 22:22   ` Paolo Bonzini

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=20160830212705.52840d45@bahia.lan \
    --to=groug@kaod.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=eblake@redhat.com \
    --cc=fwilhelm@ernw.de \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=ppandit@redhat.com \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).