#
1b6f85e2 |
| 12-Mar-2015 |
Michael Tokarev <mjt@tls.msk.ru> |
9pfs-local: simplify/optimize local_mapped_attr_path()
Omit one unnecessary memory allocation for components of the path and create the resulting path directly given lengths of the components.
Do n
9pfs-local: simplify/optimize local_mapped_attr_path()
Omit one unnecessary memory allocation for components of the path and create the resulting path directly given lengths of the components.
Do not use basename(3) because there are 2 versions of this function which differs when argument ends with slash character, use strrchr() instead so we have consistent result. This also makes sure the function will do the right thing in corner cases (eg, empty pathname is given), when basename(3) return entirely another string.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
show more ...
|
#
438940cb |
| 04-Mar-2015 |
Michael Tokarev <mjt@tls.msk.ru> |
9pfs: remove useless return
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
|
#
840a1bf2 |
| 22-Aug-2014 |
Bastian Blank <waldi@debian.org> |
hw/9pfs: Don't return type from host in readdir on local 9p filesystem
When using mapped mode in 9pfs, readdir implementation should not return file type in d_type from the host readdir, instead, it
hw/9pfs: Don't return type from host in readdir on local 9p filesystem
When using mapped mode in 9pfs, readdir implementation should not return file type in d_type from the host readdir, instead, it should use the type stored in the extended attributes. Since d_type is optional and reading ext attrs for every readdir is expensive, it should be sufficient to just set d_type to DT_UNKNOWN, so guest will know to look it up separately.
This is a -stable material.
Signed-off-by: Bastian Blank <waldi@debian.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
show more ...
|
#
f8ad4a89 |
| 03-Aug-2014 |
Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> |
hw/9pfs: Use little-endian format for xattr values
With security_model=mapped-xattr, we encode the uid,gid and other file attributes as extended attributes of the file. We save them under user.virtf
hw/9pfs: Use little-endian format for xattr values
With security_model=mapped-xattr, we encode the uid,gid and other file attributes as extended attributes of the file. We save them under user.virtfs.* namespace.
Use little-endian encoding for on-disk values. This enables us to export the same directory from both little-endian and big-endian hosts.
NOTE: This will break big-endian host that have virtFS exports using security model mapped-xattr. They will have to use external tools to convert the xattr to little-endian format.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
show more ...
|
#
69b15212 |
| 02-May-2014 |
Stefan Weil <sw@weilnetz.de> |
hw/9pfs: Add include file for exported symbol
Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
|
#
4fa4ce71 |
| 01-Mar-2014 |
Chen Gang <gang.chen.5i5j@gmail.com> |
hw/9pfs: use g_strdup_printf() instead of PATH_MAX limitation
When path is truncated by PATH_MAX limitation, it causes QEMU to access incorrect file. So use original full path instead of PATH_MAX wi
hw/9pfs: use g_strdup_printf() instead of PATH_MAX limitation
When path is truncated by PATH_MAX limitation, it causes QEMU to access incorrect file. So use original full path instead of PATH_MAX within 9pfs (need check/process ENOMEM for related memory allocation).
The related test:
- Environments (for qemu-devel):
- Host is under fedora17 desktop with ext4fs:
qemu-system-x86_64 -hda test.img -m 1024 \ -net nic,vlan=4,model=virtio,macaddr=00:16:35:AF:94:04 \ -net tap,vlan=4,ifname=tap4,script=no,downscript=no \ -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hostshare \ -fsdev local,security_model=passthrough,id=fsdev0,\ path=/upstream/vm/data/share/1234567890abcdefghijklmnopqrstuvwxyz\ ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890acdefghijklmnopqrstuvwxyz\ ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890/111111111111111111111111111\ 1111111111111111111111111111111111111111111111111111222222222222\ 2222222222222222222222222222222222222222222222222222222222222222\ 2222222222222222222222222222222222233333333333333333333333333333\ 3333333333333333333333333333333333
- Guest is ubuntu12 server with 9pfs.
mount -t 9p -o trans=virtio,version=9p2000.L hostshare /share
- Limitations:
full path limitation is PATH_MAX (4096B include nul) under Linux. file/dir node name maximized length is 256 (include nul) under ext4.
- Special test:
Under host, modify the file: "/upstream/vm/data/share/1234567890abcdefg\ hijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890acdefghijklmno\ pqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890/111111111111111111111\ 111111111111111111111111111111111111111111111111111111111122222222222\ 222222222222222222222222222222222222222222222222222222222222222222222\ 222222222222222222222222222222233333333333333333333333333333333333333\ 3333333333333333333333333/4444444444444444444444444444444444444444444\ 444444444444444444444444444444444444444444444444444444444444444444444\ 444444444444444444444444444444444444444444444444444444444444444444444\ 444444444444444444444444444444444444444/55555555555555555555555555555\ 555555555555555555555555555555555555555555555555555555555555555555555\ 555555555555555555555555555555555555555555555555555555555555555555555\ 555555555555555555555555555555555555555555555555555555555555555555555\ 55555555/666666666666666666666666666666666666666666666666666666666666\ 666666666666666666666666666666666666666666666666666666666666666666666\ 666666666666666666666666666666666666666666666666666666666666666666666\ 666666666666666666666/77777777777777777777777777777777777777777777777\ 777777777777777777777777777777777777777777777777777777777777777777777\ 777777777777777777777777777777777777777777777777777777777777777777777\ 77777777777777777777777777777777777777777777777777777777777/888888888\ 888888888888888888888888888888888888888888888888888888888888888888888\ 888888888888888888888888888888888888888888888888888888888888888888888\ 888888888888888888888888888888888888888888888888888888888888888888888\ 888888888/99999999999999999999999999999999999999999999999999999999999\ 999999999999999999999999999999999999999999999999999999999999999999999\ 999999999999999999999999999999999999999999999999999999999999999999999\ 99999999999999999999999999999999999999999/000000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000\ 000000000000000000000000000000000000000000000000000000000000000000000\ 000000000000000000000000000000000000000000000000/aaaaaaaaaaaaaaaaaaaa\ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbb\ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ccccccccc\ ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\ cccccccccc/dddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\ dddddddddddddddddddddd/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\ eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee/fffffffffffffff\ fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\ fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\ ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff/gggggggggg\ ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg\ ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg\ ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg\ ggggggggggggggggggggggg/iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\ iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\ iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii\ iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii/jjjjjjjjjjjjj\ jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj\ jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj/ppppppppppppppppppppp\ ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp\ ppppppppppppppppppppppppppppppppppppppp/test1234567890file.log" (need enter dir firstly, then modify file, or can not open it).
Under guest, still allow modify "test1234567890file.log" (will generate "test123456" file with contents).
After apply this patch, can not open "test1234567890file.log" under guest (permission denied).
- Common test:
All are still OK after apply this path.
"mkdir -p", "create/open file/dir", "modify file/dir", "rm file/dir". change various mount point paths under host and/or guest.
Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
show more ...
|
#
fae08645 |
| 01-Mar-2014 |
Chen Gang <gang.chen.5i5j@gmail.com> |
hw/9pfs/virtio-9p-local.c: use snprintf() instead of sprintf()
'ctx->fs_root' + 'path'/'fullname.data' may be larger than PATH_MAX, so need use snprintf() instead of sprintf() just like another area
hw/9pfs/virtio-9p-local.c: use snprintf() instead of sprintf()
'ctx->fs_root' + 'path'/'fullname.data' may be larger than PATH_MAX, so need use snprintf() instead of sprintf() just like another area have done in 9pfs. This could possibly result in the truncation of pathname, which we address in the follow up patch.
Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
show more ...
|
#
75b7931e |
| 01-Mar-2014 |
Chen Gang <gang.chen.5i5j@gmail.com> |
hw/9pfs/virtio-9p-local.c: move v9fs_string_free() to below "err_out:"
When "goto err_out", 'v9fs_string' already was allocated, so still need free 'v9fs_string' before return.
Signed-off-by: Chen
hw/9pfs/virtio-9p-local.c: move v9fs_string_free() to below "err_out:"
When "goto err_out", 'v9fs_string' already was allocated, so still need free 'v9fs_string' before return.
Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
show more ...
|
#
1a9978a5 |
| 28-Jan-2014 |
Kirill A. Shutemov <kirill.shutemov@linux.intel.com> |
hw/9pfs: make get_st_gen() return ENOTTY error on special files
Currently we silently ignore getversion requests for anything except file or directory. Let's instead return ENOTTY error to indicate
hw/9pfs: make get_st_gen() return ENOTTY error on special files
Currently we silently ignore getversion requests for anything except file or directory. Let's instead return ENOTTY error to indicate that getversion is not supported. It makes implementation consistent on all not-supported cases.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
show more ...
|
#
0e5fc994 |
| 28-Jan-2014 |
Kirill A. Shutemov <kirill.shutemov@linux.intel.com> |
hw/9pfs: fix error handing in local_ioc_getversion()
v9fs_co_st_gen() expects to see error code in errno, not in return code.
Let's fix this.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@lin
hw/9pfs: fix error handing in local_ioc_getversion()
v9fs_co_st_gen() expects to see error code in errno, not in return code.
Let's fix this.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
show more ...
|
#
0ceb092e |
| 20-May-2013 |
Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> |
hw/9pfs: Use O_NOFOLLOW when opening files on server
9p server should never follow a symlink. So use O_NOFOLLOW with all open syscall
Tested-by: "M. Mohan Kumar" <mohan@in.ibm.com> Signed-off-by: A
hw/9pfs: Use O_NOFOLLOW when opening files on server
9p server should never follow a symlink. So use O_NOFOLLOW with all open syscall
Tested-by: "M. Mohan Kumar" <mohan@in.ibm.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
show more ...
|
#
aed858ce |
| 20-May-2013 |
Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> |
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 direc
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>
show more ...
|
#
c7e775e4 |
| 09-May-2013 |
Dong Xu Wang <wdongxu@linux.vnet.ibm.com> |
remove double semicolons
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
|
#
0d09e41a |
| 05-Feb-2013 |
Paolo Bonzini <pbonzini@redhat.com> |
hw: move headers to include/
Many of these should be cleaned up with proper qdev-/QOM-ification. Right now there are many catch-all headers in include/hw/ARCH depending on cpu.h, and this makes it n
hw: move headers to include/
Many of these should be cleaned up with proper qdev-/QOM-ification. Right now there are many catch-all headers in include/hw/ARCH depending on cpu.h, and this makes it necessary to compile these files per-target. However, fixing this does not belong in these patches.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
show more ...
|
#
d3f8e138 |
| 22-Jan-2013 |
Markus Armbruster <armbru@redhat.com> |
hw/9pfs: Fix unchecked strdup() by converting to g_strdup()
Note: the allocation in virtio_9p_init() is still leaked. To be fixed in a followup commit.
Signed-off-by: Markus Armbruster <armbru@red
hw/9pfs: Fix unchecked strdup() by converting to g_strdup()
Note: the allocation in virtio_9p_init() is still leaked. To be fixed in a followup commit.
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
show more ...
|
#
1de7afc9 |
| 17-Dec-2012 |
Paolo Bonzini <pbonzini@redhat.com> |
misc: move include files to include/qemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
#
2d40564a |
| 19-Jan-2012 |
M. Mohan Kumar <mohan@in.ibm.com> |
hw/9pfs: Preserve S_ISGID
In passthrough security model in local fs driver, after a file creation chown and chmod are done to set the file credentials and mode as requested by 9p client. But if ther
hw/9pfs: Preserve S_ISGID
In passthrough security model in local fs driver, after a file creation chown and chmod are done to set the file credentials and mode as requested by 9p client. But if there was a request to create a file with S_ISGID bit, doing chown on that file resets the S_ISGID bit. So first call chown and then invoking chmod with proper mode bit retains the S_ISGID (if present/requested)
This resulted in LTP mknod02, mknod03, mknod05, open10 test case failures. This patch fixes this issue.
man 2 chown When the owner or group of an executable file are changed by an unprivileged user the S_ISUID and S_ISGID mode bits are cleared. POSIX does not specify whether this also should happen when root does the chown(); the Linux behavior depends on the kernel version.
Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
show more ...
|
#
2c30dd74 |
| 19-Jan-2012 |
Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> |
hw/9pfs: Add new security model mapped-file.
This enable us to do passthrough equivalent security model on NFS directory. NFS server mostly do root squashing and don't support xattr. Hence we cannot
hw/9pfs: Add new security model mapped-file.
This enable us to do passthrough equivalent security model on NFS directory. NFS server mostly do root squashing and don't support xattr. Hence we cannot use 'passthrough' or 'mapped' security model
Also added "mapped-xattr" security to indicate earlier "mapped" security model Older name is still supported.
POSIX rules regarding ctime update on chmod are not followed by this security model.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
show more ...
|
#
99519f0a |
| 14-Dec-2011 |
Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> |
hw/9pfs: Move opt validation to FsDriver callback
This remove all conditional code from common code path and make opt validation a FSDriver callback.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@l
hw/9pfs: Move opt validation to FsDriver callback
This remove all conditional code from common code path and make opt validation a FSDriver callback.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
show more ...
|
#
8b888272 |
| 04-Dec-2011 |
Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> |
hw/9pfs: Use the correct file descriptor in Fsdriver Callback
Fsdriver callback that operate on file descriptor need to differentiate between directory fd and file fd.
Based on the original patch f
hw/9pfs: Use the correct file descriptor in Fsdriver Callback
Fsdriver callback that operate on file descriptor need to differentiate between directory fd and file fd.
Based on the original patch from Sassan Panahinejad <sassan@sassan.me.uk>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
show more ...
|
#
2507718b |
| 23-Nov-2011 |
Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> |
9pfs: improve portability to older systems
I guess we can also make sure we don't call local_ioc_getversion at all.
Reported-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori
9pfs: improve portability to older systems
I guess we can also make sure we don't call local_ioc_getversion at all.
Reported-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
show more ...
|
#
ae0f940e |
| 21-Nov-2011 |
Paolo Bonzini <pbonzini@redhat.com> |
9pfs: improve portability to older systems
Small requirements on "new" features have percolated to virtio-9p-local.c. In particular, the utimensat wrapper actually only supports dirfd = AT_FDCWD and
9pfs: improve portability to older systems
Small requirements on "new" features have percolated to virtio-9p-local.c. In particular, the utimensat wrapper actually only supports dirfd = AT_FDCWD and flags = AT_SYMLINK_NOFOLLOW in the fallback code. Remove the arguments so that virtio-9p-local.c will not use AT_* constants.
At the same time, fail local_ioc_getversion if the ioctl is not supported by the host.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
show more ...
|
#
4f26f2b6 |
| 09-Nov-2011 |
Avi Kivity <avi@redhat.com> |
configure: fix detection for xattr.h on modern distributions
Modern distributions place xattr.h in /usr/include/sys, and fold libattr.so into libc. They also don't have an ENOATTR.
Make configure
configure: fix detection for xattr.h on modern distributions
Modern distributions place xattr.h in /usr/include/sys, and fold libattr.so into libc. They also don't have an ENOATTR.
Make configure detect this, and add a qemu-xattr.h file that directs the #include to the right place.
Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
show more ...
|
#
cc720ddb |
| 25-Oct-2011 |
Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> |
hw/9pfs: Abstract open state of fid to V9fsFidOpenState
To implement synthetic file system in Qemu we may not really require file descriptor and Dir *. Make generic code use V9fsFidOpenState instead
hw/9pfs: Abstract open state of fid to V9fsFidOpenState
To implement synthetic file system in Qemu we may not really require file descriptor and Dir *. Make generic code use V9fsFidOpenState instead.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
show more ...
|
#
17b1971f |
| 25-Oct-2011 |
Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> |
hw/9pfs: Fix error handling in local_mknod
Update local_chown to remove unnecessary if loop
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
|