From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56779) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdMFV-0001MO-50 for qemu-devel@nongnu.org; Fri, 26 Aug 2016 14:53:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bdMFQ-0007wh-5R for qemu-devel@nongnu.org; Fri, 26 Aug 2016 14:53:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34846) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdMFP-0007w9-Vd for qemu-devel@nongnu.org; Fri, 26 Aug 2016 14:53:00 -0400 References: <147222401281.18925.1894824578752486297.stgit@bahia.lan> <147222404628.18925.5711867501337382794.stgit@bahia.lan> From: Eric Blake Message-ID: <57C0900A.9030303@redhat.com> Date: Fri, 26 Aug 2016 13:52:58 -0500 MIME-Version: 1.0 In-Reply-To: <147222404628.18925.5711867501337382794.stgit@bahia.lan> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="v0JhGc4puKUb7nUUDwPVKdsb86uf1Dq5n" Subject: Re: [Qemu-devel] [PATCH v2 4/5] 9p: handle walk of ".." in the root directory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz , qemu-devel@nongnu.org Cc: Peter Maydell , Felix Wilhelm , "Michael S. Tsirkin" , P J P , "Aneesh Kumar K.V" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --v0JhGc4puKUb7nUUDwPVKdsb86uf1Dq5n Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08/26/2016 10:07 AM, Greg Kurz wrote: > The 9P spec at http://man.cat-v.org/plan_9/5/intro says: >=20 > All directories must support walks to the directory .. (dot-dot) meanin= g > parent directory, although by convention directories contain no explici= t > entry for .. or . (dot). The parent of the root directory of a server'= s > tree is itself. >=20 > This means that a client cannot walk further than the root directory > exported by the server. In other words, if the client wants to walk > "/.." or "/foo/../..", the server shoud answer like the request was s/shoud/should/ > to walk "/". >=20 > This patch just does that: > - we cache the QID of the root directory at attach time > - during the walk we compare the QID of each path component with the ro= ot > QID to detect if we're in a "/.." situation > - if so, we skip the current component and go to the next one >=20 > Signed-off-by: Greg Kurz > --- > hw/9pfs/9p.c | 40 +++++++++++++++++++++++++++++++--------- > hw/9pfs/9p.h | 1 + > 2 files changed, 32 insertions(+), 9 deletions(-) >=20 Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --v0JhGc4puKUb7nUUDwPVKdsb86uf1Dq5n Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXwJAKAAoJEKeha0olJ0Nqy5AH+gI87Fg/ZWOIKIiUlfibE0A7 ESDeGLwjWxamz/QBBh6e6lQ/5Kn7SamLF5edEXXOt0ySJ+ZRY7e85JZnQLQzI03f 7lq+EzW6fFneXtY6BEkIcnY9vT5Kh8RnxHj0YtRMlyR/7To4cUMxN1YZF9fKcEVy 0EodgYLhKgk0D+Shj4PGJsLCLvM+QR2xrHvaG8PU+IS+pJFMEOyfrtu0/tOHIbxk k4GIQAQBkcpVH8Z85wUkPIpJ//HiiiltPi7dGBvAlnTAhWJgYU4pExWOXujzosTr 4CyT3hnpESeHSCdVEDD2jkNqwHhGD0Pq3KBzNGQ8g1uwxnqJfOFVrraW25bC9Nk= =7VGw -----END PGP SIGNATURE----- --v0JhGc4puKUb7nUUDwPVKdsb86uf1Dq5n--