Re: [Qemu-devel] [PATCH 1.0] 9pfs: improve portability to older systems
Paolo Bonzini wrote: On 11/30/2011 10:27 PM, Erik Rull wrote: Erik, if you can test on your Debian 4.0 installation, that would be nice. Thanks! I will do so. Can you provide me a snapshot (.tgz) of the git? I have heard that there are possibilities to create the tgz over some web interfaces of git, but I didn't find them. I have only very restricted web access. Please help me for this time and / or provide me a short description how to do it. I will then try to give you feedback asap. You can simply test 1.0 when it comes out. Testing that it compiles would be 99% of the work. :) Paolo No, it does not compile :-( See my mail 2011-12-02 14:22 Best regards, Erik
Re: [Qemu-devel] [PATCH 1.0] 9pfs: improve portability to older systems
Paolo Bonzini wrote: On 11/30/2011 10:27 PM, Erik Rull wrote: Erik, if you can test on your Debian 4.0 installation, that would be nice. Thanks! I will do so. Can you provide me a snapshot (.tgz) of the git? I have heard that there are possibilities to create the tgz over some web interfaces of git, but I didn't find them. I have only very restricted web access. Please help me for this time and / or provide me a short description how to do it. I will then try to give you feedback asap. You can simply test 1.0 when it comes out. Testing that it compiles would be 99% of the work. :) Paolo No, it does not compile :-( See my mail 2011-12-02 14:22 Best regards, Erik
Re: [Qemu-devel] [PATCH 1.0] 9pfs: improve portability to older systems
On 11/30/2011 10:27 PM, Erik Rull wrote: Erik, if you can test on your Debian 4.0 installation, that would be nice. Thanks! I will do so. Can you provide me a snapshot (.tgz) of the git? I have heard that there are possibilities to create the tgz over some web interfaces of git, but I didn't find them. I have only very restricted web access. Please help me for this time and / or provide me a short description how to do it. I will then try to give you feedback asap. You can simply test 1.0 when it comes out. Testing that it compiles would be 99% of the work. :) Paolo
Re: [Qemu-devel] [PATCH 1.0] 9pfs: improve portability to older systems
Paolo Bonzini wrote: On 11/28/2011 11:36 PM, Anthony Liguori wrote: Hrm, I may have messed this up. My mailbox processing script seems to have found Aneesh's patch instead of Paolo's. Can ya'll take a look at 2507718baf311ea78156c6777d38410a9f89ce89 and tell me if I need to revert it? No, qemu.git master is fine. Erik, if you can test on your Debian 4.0 installation, that would be nice. Thanks! Paolo I will do so. Can you provide me a snapshot (.tgz) of the git? I have heard that there are possibilities to create the tgz over some web interfaces of git, but I didn't find them. I have only very restricted web access. Please help me for this time and / or provide me a short description how to do it. I will then try to give you feedback asap. Thanks a lot! Erik
Re: [Qemu-devel] [PATCH 1.0] 9pfs: improve portability to older systems
On 11/28/2011 11:36 PM, Anthony Liguori wrote: Hrm, I may have messed this up. My mailbox processing script seems to have found Aneesh's patch instead of Paolo's. Can ya'll take a look at 2507718baf311ea78156c6777d38410a9f89ce89 and tell me if I need to revert it? No, qemu.git master is fine. Erik, if you can test on your Debian 4.0 installation, that would be nice. Thanks! Paolo
Re: [Qemu-devel] [PATCH 1.0] 9pfs: improve portability to older systems
On Mon, 28 Nov 2011 16:36:18 -0600, Anthony Liguori anth...@codemonkey.ws wrote: On 11/23/2011 12:16 AM, Aneesh Kumar K.V wrote: On Mon, 21 Nov 2011 09:29:11 +0100, Paolo Bonzinipbonz...@redhat.com wrote: 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 Bonzinipbonz...@redhat.com Hrm, I may have messed this up. My mailbox processing script seems to have found Aneesh's patch instead of Paolo's. Can ya'll take a look at 2507718baf311ea78156c6777d38410a9f89ce89 and tell me if I need to revert it? No i don't think that needs a revert. But we may need the below patch. I have also send the change as a separate mail to the list. From db7fdc1c8eb95d556c18ee44fd4f9d5a3aabf9c4 Mon Sep 17 00:00:00 2001 From: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com Date: Tue, 29 Nov 2011 15:10:52 +0530 Subject: [PATCH] hw/9pfs: Improve portability to older systems commit ae0f940e6b4f5177892dd6a12762282fa9089972 2507718baf311ea78156c6777d38410a9f89ce89 missed updating virtio-9p-handle.c. Signed-off-by: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com --- hw/9pfs/virtio-9p-handle.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/hw/9pfs/virtio-9p-handle.c b/hw/9pfs/virtio-9p-handle.c index 7644ae5..93552a1 100644 --- a/hw/9pfs/virtio-9p-handle.c +++ b/hw/9pfs/virtio-9p-handle.c @@ -599,7 +599,8 @@ static int handle_unlinkat(FsContext *ctx, V9fsPath *dir, static int handle_ioc_getversion(FsContext *ctx, V9fsPath *path, mode_t st_mode, uint64_t *st_gen) { -int err; +int err = -ENOTTY; +#ifdef FS_IOC_GETVERSION V9fsFidOpenState fid_open; /* @@ -615,6 +616,7 @@ static int handle_ioc_getversion(FsContext *ctx, V9fsPath *path, } err = ioctl(fid_open.fd, FS_IOC_GETVERSION, st_gen); handle_close(ctx, fid_open); +#endif return err; } @@ -630,6 +632,7 @@ static int handle_init(FsContext *ctx) ret = data-mountfd; goto err_out; } +#ifdef FS_IOC_GETVERSION ret = statfs(ctx-fs_root, stbuf); if (!ret) { switch (stbuf.f_type) { @@ -641,6 +644,7 @@ static int handle_init(FsContext *ctx) break; } } +#endif memset(fh, 0, sizeof(struct file_handle)); ret = name_to_handle(data-mountfd, ., fh, mnt_id, 0); if (ret errno == EOVERFLOW) { -- 1.7.5.4
Re: [Qemu-devel] [PATCH 1.0] 9pfs: improve portability to older systems
On 11/23/2011 12:16 AM, Aneesh Kumar K.V wrote: On Mon, 21 Nov 2011 09:29:11 +0100, Paolo Bonzinipbonz...@redhat.com wrote: 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 Bonzinipbonz...@redhat.com Hrm, I may have messed this up. My mailbox processing script seems to have found Aneesh's patch instead of Paolo's. Can ya'll take a look at 2507718baf311ea78156c6777d38410a9f89ce89 and tell me if I need to revert it? Regards, Anthony Liguori --- hw/9pfs/virtio-9p-local.c |7 +-- oslib-posix.c |5 ++--- qemu-os-posix.h |3 +-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/hw/9pfs/virtio-9p-local.c b/hw/9pfs/virtio-9p-local.c index 7f1c089..cbd07e8 100644 --- a/hw/9pfs/virtio-9p-local.c +++ b/hw/9pfs/virtio-9p-local.c @@ -583,8 +583,7 @@ static int local_utimensat(FsContext *s, V9fsPath *fs_path, char buffer[PATH_MAX]; char *path = fs_path-data; -return qemu_utimensat(AT_FDCWD, rpath(s, path, buffer), buf, - AT_SYMLINK_NOFOLLOW); +return qemu_utimens(rpath(s, path, buffer), buf); } static int local_remove(FsContext *ctx, const char *path) @@ -694,6 +693,7 @@ static int local_ioc_getversion(FsContext *ctx, V9fsPath *path, mode_t st_mode, uint64_t *st_gen) { int err; +#ifdef FS_IOC_GETVERSION V9fsFidOpenState fid_open; /* @@ -709,6 +709,9 @@ static int local_ioc_getversion(FsContext *ctx, V9fsPath *path, } err = ioctl(fid_open.fd, FS_IOC_GETVERSION, st_gen); local_close(ctx,fid_open); +#else +err = -ENOTTY; +#endif return err; I guess we can also make sure we don't call local_ioc_getversion at all. diff --git a/hw/9pfs/virtio-9p-local.c b/hw/9pfs/virtio-9p-local.c index 0da3bdd..1c349af 100644 --- a/hw/9pfs/virtio-9p-local.c +++ b/hw/9pfs/virtio-9p-local.c @@ -714,10 +714,14 @@ static int local_ioc_getversion(FsContext *ctx, V9fsPath *path, static int local_init(FsContext *ctx) { -int err; +int err = 0; struct statfs stbuf; ctx-export_flags |= V9FS_PATHNAME_FSCONTEXT; +#ifdef FS_IOC_GETVERSION +/* + * use ioc_getversion only if the iocl is definied + */ err = statfs(ctx-fs_root,stbuf); if (!err) { switch (stbuf.f_type) { @@ -729,6 +733,7 @@ static int local_init(FsContext *ctx) break; } } +#endif return err; } We would also require same changes for virtio-9p-handle.c right ? -aneesh
Re: [Qemu-devel] [PATCH 1.0] 9pfs: improve portability to older systems
On Wed, 23 Nov 2011 08:24:53 +0100, Paolo Bonzini pbonz...@redhat.com wrote: On 11/23/2011 07:16 AM, Aneesh Kumar K.V wrote: We would also require same changes for virtio-9p-handle.c right ? virtio-9p-handle.c is only for recent Linux and you can assume the ioctl is defined there. But the file gets build by default right ? ie, we would build virtio-9p-handle.c and if FS_IOC_GETVERSION is not defined, build will fail right ? -aneesh
Re: [Qemu-devel] [PATCH 1.0] 9pfs: improve portability to older systems
On 11/23/2011 04:11 PM, Aneesh Kumar K.V wrote: virtio-9p-handle.c is only for recent Linux and you can assume the ioctl is defined there. But the file gets build by default right ? ie, we would build virtio-9p-handle.c and if FS_IOC_GETVERSION is not defined, build will fail right ? I think you're right. Strange that Erik did not see it. Paolo
Re: [Qemu-devel] [PATCH 1.0] 9pfs: improve portability to older systems
On Mon, 21 Nov 2011 09:29:11 +0100, Paolo Bonzini pbonz...@redhat.com wrote: 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 pbonz...@redhat.com --- hw/9pfs/virtio-9p-local.c |7 +-- oslib-posix.c |5 ++--- qemu-os-posix.h |3 +-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/hw/9pfs/virtio-9p-local.c b/hw/9pfs/virtio-9p-local.c index 7f1c089..cbd07e8 100644 --- a/hw/9pfs/virtio-9p-local.c +++ b/hw/9pfs/virtio-9p-local.c @@ -583,8 +583,7 @@ static int local_utimensat(FsContext *s, V9fsPath *fs_path, char buffer[PATH_MAX]; char *path = fs_path-data; -return qemu_utimensat(AT_FDCWD, rpath(s, path, buffer), buf, - AT_SYMLINK_NOFOLLOW); +return qemu_utimens(rpath(s, path, buffer), buf); } static int local_remove(FsContext *ctx, const char *path) @@ -694,6 +693,7 @@ static int local_ioc_getversion(FsContext *ctx, V9fsPath *path, mode_t st_mode, uint64_t *st_gen) { int err; +#ifdef FS_IOC_GETVERSION V9fsFidOpenState fid_open; /* @@ -709,6 +709,9 @@ static int local_ioc_getversion(FsContext *ctx, V9fsPath *path, } err = ioctl(fid_open.fd, FS_IOC_GETVERSION, st_gen); local_close(ctx, fid_open); +#else +err = -ENOTTY; +#endif return err; I guess we can also make sure we don't call local_ioc_getversion at all. diff --git a/hw/9pfs/virtio-9p-local.c b/hw/9pfs/virtio-9p-local.c index 0da3bdd..1c349af 100644 --- a/hw/9pfs/virtio-9p-local.c +++ b/hw/9pfs/virtio-9p-local.c @@ -714,10 +714,14 @@ static int local_ioc_getversion(FsContext *ctx, V9fsPath *path, static int local_init(FsContext *ctx) { -int err; +int err = 0; struct statfs stbuf; ctx-export_flags |= V9FS_PATHNAME_FSCONTEXT; +#ifdef FS_IOC_GETVERSION +/* + * use ioc_getversion only if the iocl is definied + */ err = statfs(ctx-fs_root, stbuf); if (!err) { switch (stbuf.f_type) { @@ -729,6 +733,7 @@ static int local_init(FsContext *ctx) break; } } +#endif return err; } We would also require same changes for virtio-9p-handle.c right ? -aneesh
Re: [Qemu-devel] [PATCH 1.0] 9pfs: improve portability to older systems
On 11/23/2011 07:16 AM, Aneesh Kumar K.V wrote: We would also require same changes for virtio-9p-handle.c right ? virtio-9p-handle.c is only for recent Linux and you can assume the ioctl is defined there. Paolo
[Qemu-devel] [PATCH 1.0] 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 pbonz...@redhat.com --- hw/9pfs/virtio-9p-local.c |7 +-- oslib-posix.c |5 ++--- qemu-os-posix.h |3 +-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/hw/9pfs/virtio-9p-local.c b/hw/9pfs/virtio-9p-local.c index 7f1c089..cbd07e8 100644 --- a/hw/9pfs/virtio-9p-local.c +++ b/hw/9pfs/virtio-9p-local.c @@ -583,8 +583,7 @@ static int local_utimensat(FsContext *s, V9fsPath *fs_path, char buffer[PATH_MAX]; char *path = fs_path-data; -return qemu_utimensat(AT_FDCWD, rpath(s, path, buffer), buf, - AT_SYMLINK_NOFOLLOW); +return qemu_utimens(rpath(s, path, buffer), buf); } static int local_remove(FsContext *ctx, const char *path) @@ -694,6 +693,7 @@ static int local_ioc_getversion(FsContext *ctx, V9fsPath *path, mode_t st_mode, uint64_t *st_gen) { int err; +#ifdef FS_IOC_GETVERSION V9fsFidOpenState fid_open; /* @@ -709,6 +709,9 @@ static int local_ioc_getversion(FsContext *ctx, V9fsPath *path, } err = ioctl(fid_open.fd, FS_IOC_GETVERSION, st_gen); local_close(ctx, fid_open); +#else +err = -ENOTTY; +#endif return err; } diff --git a/oslib-posix.c b/oslib-posix.c index 6f29762..ce75549 100644 --- a/oslib-posix.c +++ b/oslib-posix.c @@ -162,8 +162,7 @@ int qemu_pipe(int pipefd[2]) return ret; } -int qemu_utimensat(int dirfd, const char *path, const struct timespec *times, - int flags) +int qemu_utimens(const char *path, const struct timespec *times) { struct timeval tv[2], tv_now; struct stat st; @@ -171,7 +170,7 @@ int qemu_utimensat(int dirfd, const char *path, const struct timespec *times, #ifdef CONFIG_UTIMENSAT int ret; -ret = utimensat(dirfd, path, times, flags); +ret = utimensat(AT_FDCWD, path, times, AT_SYMLINK_NOFOLLOW); if (ret != -1 || errno != ENOSYS) { return ret; } diff --git a/qemu-os-posix.h b/qemu-os-posix.h index 920499d..8e1149d 100644 --- a/qemu-os-posix.h +++ b/qemu-os-posix.h @@ -44,7 +44,6 @@ typedef struct timeval qemu_timeval; #endif #endif typedef struct timespec qemu_timespec; -int qemu_utimensat(int dirfd, const char *path, const qemu_timespec *times, -int flags); +int qemu_utimens(const char *path, const qemu_timespec *times); #endif -- 1.7.7.1
Re: [Qemu-devel] [PATCH 1.0] 9pfs: improve portability to older systems
On 11/21/2011 02:29 AM, Paolo Bonzini wrote: 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 Bonzinipbonz...@redhat.com --- hw/9pfs/virtio-9p-local.c |7 +-- oslib-posix.c |5 ++--- qemu-os-posix.h |3 +-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/hw/9pfs/virtio-9p-local.c b/hw/9pfs/virtio-9p-local.c index 7f1c089..cbd07e8 100644 --- a/hw/9pfs/virtio-9p-local.c +++ b/hw/9pfs/virtio-9p-local.c @@ -583,8 +583,7 @@ static int local_utimensat(FsContext *s, V9fsPath *fs_path, char buffer[PATH_MAX]; char *path = fs_path-data; -return qemu_utimensat(AT_FDCWD, rpath(s, path, buffer), buf, - AT_SYMLINK_NOFOLLOW); +return qemu_utimens(rpath(s, path, buffer), buf); Hrm, I thought the SYMLINK_NOFOLLOW was critical in enforcing security? Regards, Anthony Liguori } static int local_remove(FsContext *ctx, const char *path) @@ -694,6 +693,7 @@ static int local_ioc_getversion(FsContext *ctx, V9fsPath *path, mode_t st_mode, uint64_t *st_gen) { int err; +#ifdef FS_IOC_GETVERSION V9fsFidOpenState fid_open; /* @@ -709,6 +709,9 @@ static int local_ioc_getversion(FsContext *ctx, V9fsPath *path, } err = ioctl(fid_open.fd, FS_IOC_GETVERSION, st_gen); local_close(ctx,fid_open); +#else +err = -ENOTTY; +#endif return err; } diff --git a/oslib-posix.c b/oslib-posix.c index 6f29762..ce75549 100644 --- a/oslib-posix.c +++ b/oslib-posix.c @@ -162,8 +162,7 @@ int qemu_pipe(int pipefd[2]) return ret; } -int qemu_utimensat(int dirfd, const char *path, const struct timespec *times, - int flags) +int qemu_utimens(const char *path, const struct timespec *times) { struct timeval tv[2], tv_now; struct stat st; @@ -171,7 +170,7 @@ int qemu_utimensat(int dirfd, const char *path, const struct timespec *times, #ifdef CONFIG_UTIMENSAT int ret; -ret = utimensat(dirfd, path, times, flags); +ret = utimensat(AT_FDCWD, path, times, AT_SYMLINK_NOFOLLOW); if (ret != -1 || errno != ENOSYS) { return ret; } diff --git a/qemu-os-posix.h b/qemu-os-posix.h index 920499d..8e1149d 100644 --- a/qemu-os-posix.h +++ b/qemu-os-posix.h @@ -44,7 +44,6 @@ typedef struct timeval qemu_timeval; #endif #endif typedef struct timespec qemu_timespec; -int qemu_utimensat(int dirfd, const char *path, const qemu_timespec *times, -int flags); +int qemu_utimens(const char *path, const qemu_timespec *times); #endif
Re: [Qemu-devel] [PATCH 1.0] 9pfs: improve portability to older systems
On 11/21/2011 10:01 PM, Anthony Liguori wrote: -return qemu_utimensat(AT_FDCWD, rpath(s, path, buffer), buf, - AT_SYMLINK_NOFOLLOW); +return qemu_utimens(rpath(s, path, buffer), buf); Hrm, I thought the SYMLINK_NOFOLLOW was critical in enforcing security? Yes, and it is applied by qemu_utimens automatically (but the constant only appears in a section where we know it is defined). Paolo