diff options
| author | Aneesh Kumar K.V | 2013-05-20 13:58:29 +0200 |
|---|---|---|
| committer | Aneesh Kumar K.V | 2013-05-28 11:53:12 +0200 |
| commit | aed858ce10ef09c7bdf03f73e75e772f567c74cd (patch) | |
| tree | 38a7c504f00d80e9182f3adacb5fd047cd885199 /hw | |
| parent | hw/9pfs: Fix segfault with 9p2000.u (diff) | |
| download | qemu-aed858ce10ef09c7bdf03f73e75e772f567c74cd.tar.gz qemu-aed858ce10ef09c7bdf03f73e75e772f567c74cd.tar.xz qemu-aed858ce10ef09c7bdf03f73e75e772f567c74cd.zip | |
hw/9pfs: use O_NOFOLLOW for mapped readlink operation
With mapped security models like mapped-xattr and mapped-file, we save the
symlink target as file contents. Now if we ever expose a normal directory
with mapped security model and find real symlinks in export path, never
follow them and return proper error.
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
| -rw-r--r-- | hw/9pfs/virtio-9p-local.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/9pfs/virtio-9p-local.c b/hw/9pfs/virtio-9p-local.c index 6ece6f7d1c..87aa75d923 100644 --- a/hw/9pfs/virtio-9p-local.c +++ b/hw/9pfs/virtio-9p-local.c @@ -284,7 +284,7 @@ static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path, if ((fs_ctx->export_flags & V9FS_SM_MAPPED) || (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE)) { int fd; - fd = open(rpath(fs_ctx, path, buffer), O_RDONLY); + fd = open(rpath(fs_ctx, path, buffer), O_RDONLY | O_NOFOLLOW); if (fd == -1) { return -1; } |
