From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50060) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfARX-0008Nd-52 for qemu-devel@nongnu.org; Wed, 22 May 2013 10:55:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UfARP-00012V-EU for qemu-devel@nongnu.org; Wed, 22 May 2013 10:55:07 -0400 Received: from mail-we0-x22f.google.com ([2a00:1450:400c:c03::22f]:63829) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfARP-00012Q-84 for qemu-devel@nongnu.org; Wed, 22 May 2013 10:54:59 -0400 Received: by mail-we0-f175.google.com with SMTP id p60so1334539wes.34 for ; Wed, 22 May 2013 07:54:58 -0700 (PDT) Date: Wed, 22 May 2013 16:54:55 +0200 From: Stefan Hajnoczi Message-ID: <20130522145455.GG28600@stefanha-thinkpad.redhat.com> References: <1369221774-10735-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1369221774-10735-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH] hw/9pfs: Use O_NOFOLLOW when opening files on server List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Aneesh Kumar K.V" Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org On Wed, May 22, 2013 at 04:52:54PM +0530, Aneesh Kumar K.V wrote: > diff --git a/hw/9pfs/virtio-9p-handle.c b/hw/9pfs/virtio-9p-handle.c > index fe8e0ed..e2a89e3 100644 > --- a/hw/9pfs/virtio-9p-handle.c > +++ b/hw/9pfs/virtio-9p-handle.c > @@ -608,7 +608,7 @@ static int handle_init(FsContext *ctx) > struct file_handle fh; > struct handle_data *data = g_malloc(sizeof(struct handle_data)); > > - data->mountfd = open(ctx->fs_root, O_DIRECTORY); > + data->mountfd = open(ctx->fs_root, O_DIRECTORY | O_NOFOLLOW); Why is the root path not allowed to be a symlink? And if so, it would be more user-friendly to resolve the path before open. That way we don't need to bug the user with an error here.