9pfs: Add 9pfs support for Windows host
cover 9pfs: Add 9pfs support for Windows host
At present there is no Windows support for 9p file system. This series adds initial Windows support for 9p file system.
Only 'local' file system driver backend is supported. security_model should be 'none' due to limitations on Windows host.
Example command line to test:
"-fsdev local,path=c:\msys64,security_model=none,id=p9 -device virtio-9p-pci,fsdev=p9,mount_tag=p9fs"
Guohuai Shi (4):
fsdev: Add missing definitions for Windows in file-op-9p.h hw/9pfs: Update 'local' file system backend driver to support Windows
fsdev: Enable 'local' file system driver backend for Windows meson.build: Turn on virtfs for Windows host
meson.build | 10 +- fsdev/file-op-9p.h | 33 ++++++ hw/9pfs/9p-util.h | 4 + hw/9pfs/9p.h | 22 ++++ fsdev/qemu-fsdev.c | 2 + hw/9pfs/9p-local.c | 273 +++++++++++++++++++++++++++++++++++++++++++- hw/9pfs/9p.c | 85 +++++++++++++- hw/9pfs/codir.c | 17 +++ fsdev/meson.build | 1 + hw/9pfs/meson.build | 10 +- 10 files changed, 449 insertions(+), 8 deletions(-)
Signature · 1 line
2.25.1
RFC PATCH 1/4 fsdev: Add missing definitions for Windows in file-op-9p.h
From: Guohuai Shi <[email protected]>
Add uid_t, gid_t and struct statfs definitions, which are currently missing from Windows headers, but are required when we add 9p file system support for Windows in later patches.
---
fsdev/file-op-9p.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
fsdev/file-op-9p.h +33 -0
@@ -27,6 +27,39 @@# include <sys/mount.h> #endif +#ifdef CONFIG_WIN32 + +/* POSIX structure not defined in Windows */ + +typedef uint32_t uid_t ; +typedef uint32_t gid_t ; + +/* from http://man7.org/linux/man-pages/man2/statfs.2.html */ +typedef uint32_t __fsword_t ; +typedef uint32_t fsblkcnt_t ; +typedef uint32_t fsfilcnt_t ; + +/* from linux/include/uapi/asm-generic/posix_types.h */ +typedef struct { +long __val[2 ]; +}fsid_t ; + +struct statfs { +__fsword_t f_type; +__fsword_t f_bsize; +fsblkcnt_t f_blocks; +fsblkcnt_t f_bfree; +fsblkcnt_t f_bavail; +fsfilcnt_t f_files; +fsfilcnt_t f_ffree; +fsid_t f_fsid; +__fsword_t f_namelen; +__fsword_t f_frsize; +__fsword_t f_flags; +}; + +#endif /* CONFIG_WIN32 */ +#define SM_LOCAL_MODE_BITS 0600#define SM_LOCAL_DIR_MODE_BITS 0700
Signature · 1 line
2.25.1
RFC PATCH 2/4 hw/9pfs: Update 'local' file system backend driver to support Windows
In reply to Bin MengFrom: Guohuai Shi <[email protected]>
Extend the 9p local file system backend driver to support Windows, including open, read, write, close, rename, remove, etc.
Symbolic link, link, chmod, renameat, unlinkat and extended attribute are not supported due to limitations on Windows host.
---
hw/9pfs/9p-util.h | 4 + hw/9pfs/9p.h | 22 ++++ hw/9pfs/9p-local.c | 273 +++++++++++++++++++++++++++++++++++++++++++- hw/9pfs/9p.c | 85 +++++++++++++- hw/9pfs/codir.c | 17 +++ hw/9pfs/meson.build | 10 +- 6 files changed, 408 insertions(+), 3 deletions(-)
hw/9pfs/9p-util.h +4 -0
@@ -43,6 +43,7 @@ static inline void close_preserve_errno(int fd) errno = serrno; } +#ifndef CONFIG_WIN32 static inline int openat_dir (int dirfd,const char *name) { return openat(dirfd, name,
@@ -89,6 +90,7 @@ again: errno = serrno; return fd; } +#endif /* !CONFIG_WIN32 */ ssize_t fgetxattrat_nofollow (int dirfd,const char *path,const char *name,void *value,size_t size);
@@ -99,6 +101,7 @@ ssize_t flistxattrat_nofollow(int dirfd, const char *filename,ssize_t fremovexattrat_nofollow (int dirfd,const char *filename,const char *name); +#ifndef CONFIG_WIN32 /* * Darwin has d_seekoff, which appears to function similarly to d_off. * However, it does not appear to be supported on all file systems,
@@ -113,6 +116,7 @@ static inline off_t qemu_dirent_off(struct dirent *dent)return dent->d_off; #endif } +#endif /* !CONFIG_WIN32 */ /** * qemu_dirent_dup() - Duplicate directory entry @dent.
hw/9pfs/9p.h +22 -0
@@ -3,12 +3,34 @@#include <dirent.h> #include <utime.h> +#ifndef CONFIG_WIN32 #include <sys/resource.h> +#endif #include "fsdev/file-op-9p.h" #include "fsdev/9p-iov-marshal.h" #include "qemu/thread.h" #include "qemu/coroutine.h" #include "qemu/qht.h" +#ifdef CONFIG_WIN32 + +#define O_NOCTTY 0 +#define O_NDELAY 0 +#define O_NONBLOCK 0 +#define O_DSYNC 0 +#define O_DIRECT 0 +#define O_NOFOLLOW 0 +#define O_NOATIME 0 +#define O_SYNC 0 +#define O_ASYNC 0 +#define O_DIRECTORY 02000000 + +#define FASYNC 0 + +#define AT_REMOVEDIR 1 + +#define NAME_MAX 260 + +#endif enum {P9_TLERROR =6 ,
hw/9pfs/9p-local.c +272 -1
683 lines not on this page · raw message
hw/9pfs/9p.c +84 -1
269 lines not on this page · raw message
hw/9pfs/codir.c +17 -0
@@ -22,7 +22,9 @@#include "qemu/coroutine.h" #include "qemu/main-loop.h" #include "coth.h" +#ifndef CONFIG_WIN32 #include "9p-xattr.h" +#endif #include "9p-util.h" /*
@@ -78,6 +80,9 @@ static int do_readdir_many(V9fsPDU *pdu, V9fsFidState *fidp,int len, err =0 ;int32_t size =0 ;off_t saved_dir_pos; +#ifdef CONFIG_WIN32 +off_t next_dir_pos; +#endif struct dirent *dent;struct V9fsDirEnt *e =NULL ;V9fsPath path;
@@ -124,6 +129,14 @@ static int do_readdir_many(V9fsPDU *pdu, V9fsFidState *fidp,break ; } +#ifdef CONFIG_WIN32 + next_dir_pos = s->ops->telldir (&s->ctx, &fidp->fs); +if (next_dir_pos <0 ) { + err = next_dir_pos; + goto out; + } +#endif +/* * stop this loop as soon as it would exceed the allowed maximum * response message size for the directory entries collected so far,
@@ -168,7 +181,11 @@ static int do_readdir_many(V9fsPDU *pdu, V9fsFidState *fidp, } size += len; +#ifndef CONFIG_WIN32 saved_dir_pos =qemu_dirent_off (dent); +#else + saved_dir_pos = next_dir_pos; +#endif }/* restore (last) saved position */
hw/9pfs/meson.build +9 -1
@@ -1,5 +1,13 @@ fs_ss = ss.source_set() -fs_ss.add(files( +fs_ss.add(when: 'CONFIG_WIN32', if_true: files( + '9p-local.c', + '9p.c', + 'codir.c', + 'cofile.c', + 'cofs.c', + 'coth.c', + 'coxattr.c', +), if_false: files( '9p-local.c', '9p-posix-acl.c', '9p-proxy.c',
Signature · 1 line
2.25.1
RFC PATCH 3/4 fsdev: Enable 'local' file system driver backend for Windows
In reply to Bin MengFrom: Guohuai Shi <[email protected]>
Only 'local' file system driver will be supported for Windows host. 'proxy' or 'synth' are not supported.
---
fsdev/qemu-fsdev.c | 2 ++ fsdev/meson.build | 1 + 2 files changed, 3 insertions(+)
fsdev/qemu-fsdev.c +2 -0
@@ -81,6 +81,7 @@ static FsDriverTable FsDrivers[] = { NULL }, }, +#ifndef CONFIG_WIN32 { .name = "synth", .ops = &synth_ops,
@@ -100,6 +101,7 @@ static FsDriverTable FsDrivers[] = {NULL }, }, +#endif }; static int validate_opt(void *opaque, const char *name, const char *value,
fsdev/meson.build +1 -0
@@ -8,6 +8,7 @@ fsdev_ss.add(when: ['CONFIG_FSDEV_9P'], if_true: files( ), if_false: files('qemu-fsdev-dummy.c')) softmmu_ss.add_all(when: 'CONFIG_LINUX', if_true: fsdev_ss) softmmu_ss.add_all(when: 'CONFIG_DARWIN', if_true: fsdev_ss) +softmmu_ss.add_all(when: 'CONFIG_WIN32', if_true: fsdev_ss) if have_virtfs_proxy_helper executable('virtfs-proxy-helper',
Signature · 1 line
2.25.1
RFC PATCH 4/4 meson.build: Turn on virtfs for Windows host
In reply to Bin MengFrom: Guohuai Shi <[email protected]>
Enable virtfs configuration option for Windows host.
---
meson.build | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
meson.build +5 -5
@@ -1465,16 +1465,16 @@ dbus_display = get_option('dbus_display') \ .allowed() have_virtfs = get_option('virtfs') \ - .require(targetos == 'linux' or targetos == 'darwin', - error_message: 'virtio-9p (virtfs) requires Linux or macOS') \ - .require(targetos == 'linux' or cc.has_function('pthread_fchdir_np'), + .require(targetos == 'linux' or targetos == 'darwin' or targetos == 'windows', + error_message: 'virtio-9p (virtfs) requires Linux or macOS or Windows') \ + .require(targetos == 'linux' or cc.has_function('pthread_fchdir_np') or targetos == 'windows', error_message: 'virtio-9p (virtfs) on macOS requires the presence of pthread_fchdir_np') \ - .require(targetos == 'darwin' or (libattr.found() and libcap_ng.found()), + .require(targetos == 'darwin' or (libattr.found() and libcap_ng.found()) or targetos == 'windows', error_message: 'virtio-9p (virtfs) on Linux requires libcap-ng-devel and libattr-devel') \ .disable_auto_if(not have_tools and not have_system) \ .allowed() -have_virtfs_proxy_helper = targetos != 'darwin' and have_virtfs and have_tools +have_virtfs_proxy_helper = targetos != 'darwin' and targetos != 'windows' and have_virtfs and have_tools foreach k : get_option('trace_backends') config_host_data.set('CONFIG_TRACE_' + k.to_upper(), true)
Signature · 1 line
2.25.1
Quoted 2 lines · On Freitag, 8. April 2022 19:10:09 CEST Bin Meng wrote:
At present there is no Windows support for 9p file system. This series adds initial Windows support for 9p file system.
Nice!
Quoted 2 lines
Only 'local' file system driver backend is supported.
security_modelshould be 'none' due to limitations on Windows host.
We have 3 fs drivers: local, synth, proxy. I don't mind about proxy, it is in bad shape and we will probably deprecate it in near future anyway. But it would be good to have support for the synth driver, because we are using it for running test cases and fuzzing tests (QA).
What are the limitations against security_model=mapped on Windows? Keep in mind that with security_model=none you are very limited in what you can do with 9p.
Quoted 23 lines
Example command line to test:
"-fsdev local,path=c:\msys64,security_model=none,id=p9 -device
virtio-9p-pci,fsdev=p9,mount_tag=p9fs"Guohuai Shi (4):
fsdev: Add missing definitions for Windows infile-op-9p.hhw/9pfs: Update 'local' file system backend driver to support Windows
fsdev: Enable 'local' file system driver backend for Windows meson.build: Turn on virtfs for Windows hostmeson.build | 10 +- fsdev/file-op-9p.h | 33 ++++++ hw/9pfs/9p-util.h | 4 + hw/9pfs/9p.h | 22 ++++ fsdev/qemu-fsdev.c | 2 + hw/9pfs/9p-local.c | 273 +++++++++++++++++++++++++++++++++++++++++++- hw/9pfs/9p.c | 85 +++++++++++++- hw/9pfs/codir.c | 17 +++ fsdev/meson.build | 1 + hw/9pfs/meson.build | 10 +- 10 files changed, 449 insertions(+), 8 deletions(-)
+Guohuai
Quoted 10 lines · Christian Schoenebeck
Quoted 2 lines · On Freitag, 8. April 2022 19:10:09 CEST Bin Meng wrote:
At present there is no Windows support for 9p file system. This series adds initial Windows support for 9p file system.
Nice!
Quoted 2 lines
Only 'local' file system driver backend is supported.
security_modelshould be 'none' due to limitations on Windows host.
Quoted 9 lines
We have 3 fs drivers: local, synth, proxy. I don't mind about proxy, it is in bad shape and we will probably deprecate it in near future anyway. But it would be good to have support for the synth driver, because we are using it for running test cases and fuzzing tests (QA).
What are the limitations against security_model=mapped on Windows? Keep in mind that with security_model=none you are very limited in what you can do with 9p.
Regards,
Bin
Quoted 4 lines
We have 3 fs drivers: local, synth, proxy. I don't mind about proxy, it is in bad shape and we will probably deprecate it in near future anyway. But it would be good to have support for the synth driver, because we are using it for running test cases and fuzzing tests (QA).
synth driver can not be built on Windows platform (or cross build on Linux). So the test cases can not work on Windows.
Quoted 3 lines
What are the limitations against security_model=mapped on Windows? Keep in mind that with security_model=none you are very limited in what you can do with 9p.
MSYS library does not support extend attribute (e.g. getxattr), And does not support POSIX permission APIs (e.g. chmod, chown). Security model is useless on Windows host.
It is possible that to "map" extend attribute to NTFS stream data.
However, if Windows host media is not NTFS (e.g. FAT) which does not support stream data, then the "map" can not work.
Thanks
Guohuai
-----Original Message-----
From: Bin Meng <[email protected]>
Sent: 2022年4月13日 11:19
To: Christian Schoenebeck <[email protected]>; Shi, Guohuai <[email protected]>
Cc: [email protected] Developers <[email protected]>; Greg Kurz <[email protected]>
Subject: Re: [RFC PATCH 0/4] 9pfs: Add 9pfs support for Windows host
[Please note: This e-mail is from an EXTERNAL e-mail address]
+Guohuai
Quoted 10 lines · Christian Schoenebeck
Quoted 2 lines · On Freitag, 8. April 2022 19:10:09 CEST Bin Meng wrote:
At present there is no Windows support for 9p file system. This series adds initial Windows support for 9p file system.
Nice!
Quoted 2 lines
Only 'local' file system driver backend is supported.
security_modelshould be 'none' due to limitations on Windows host.
Quoted 9 lines
We have 3 fs drivers: local, synth, proxy. I don't mind about proxy, it is in bad shape and we will probably deprecate it in near future anyway. But it would be good to have support for the synth driver, because we are using it for running test cases and fuzzing tests (QA).
What are the limitations against security_model=mapped on Windows? Keep in mind that with security_model=none you are very limited in what you can do with 9p.
Regards,
Bin
Quoted 7 lines · Guohuai
Quoted 4 lines
We have 3 fs drivers: local, synth, proxy. I don't mind about proxy, it is in bad shape and we will probably deprecate it in near future anyway. But it would be good to have support for the synth driver, because we are using it for running test cases and fuzzing tests (QA).
synth driver can not be built on Windows platform (or cross build on Linux). So the test cases can not work on Windows.
Could you please be more specific what kind of challenge you see for making the synth driver working on Windows? The synth driver is just a simple mockup driver [1] that simulates in-RAM-only a filesystem with a bunch of hard coded dirs and files, solely for the purpose to run test cases. So the synth driver does not interact with any real filesystem on host at all. My expectation therefore would be that it just needs to tweak some header includes and maybe declaring missing POSIX data types, which you have done for the local driver already anyway.
BTW support for macOS hosts has just been recently added for 9p, I know it is different as its a POSIX OS, but maybe you might still find the diff [2] helpful.
[1] https://wiki.qemu.org/Documentation/9p#9p_Filesystem_Drivers
[2] https://gitlab.com/qemu-project/qemu/-/commit/f45cc81911adc772
Quoted 7 lines
Quoted 3 lines
What are the limitations against security_model=mapped on Windows? Keep in
mind that with security_model=none you are very limited in what you can
do with 9p.MSYS library does not support extend attribute (e.g. getxattr), And does not support POSIX permission APIs (e.g. chmod, chown). Security model is useless on Windows host.
That would be security_model=passthrough, yes, that's not possible with msys. The recommended way in practice though is using security_model=mapped [3] for all systems, which should be possible to achieve with msys as well ...
[3] https://wiki.qemu.org/Documentation/9psetup#Starting_the_Guest_directly
Quoted 3 lines
It is possible that to "map" extend attribute to NTFS stream data. However, if Windows host media is not NTFS (e.g. FAT) which does not support stream data, then the "map" can not work.
... yes exactly, it would make sense to use ADS [4] instead of xattr on Windows. ADS are available with NTFS and ReFS and maybe also with exFAT nowadays (?), not sure about the latter though. But I think it is fair enough to assume Windows users to either use NTFS or ReFS. And if they don't, you can still call error_report_once() to make user aware that seucrity_model=mapped(-xattr) requires a fileystem on Windows that supports ADS.
[4] https://en.wikipedia.org/wiki/NTFS#Alternate_data_stream_(ADS)
Best regards,
Christian Schoenebeck
Quoted 20 lines
-----Original Message-----
From: Christian Schoenebeck <[email protected]>
Sent: 2022年4月14日 19:24
To: [email protected]; Shi, Guohuai <[email protected]>
Cc: Bin Meng <[email protected]>; Greg Kurz <[email protected]>
Subject: Re: [RFC PATCH 0/4] 9pfs: Add 9pfs support for Windows host[Please note: This e-mail is from an EXTERNAL e-mail address]
Quoted 7 lines · Guohuai
Quoted 4 lines
We have 3 fs drivers: local, synth, proxy. I don't mind about proxy, it is in bad shape and we will probably deprecate it in near future anyway. But it would be good to have support for the synth driver, because we are using it for running test cases and fuzzing tests (QA).
synth driver can not be built on Windows platform (or cross build on Linux). So the test cases can not work on Windows.
Quoted 8 lines
Could you please be more specific what kind of challenge you see for making the synth driver working on Windows? The synth driver is just a simple mockup driver
[1] that simulates in-RAM-only a filesystem with a bunch of hard coded dirs and files, solely for the purpose to run test cases. So the synth driver does not interact with any real filesystem on host at all. My expectation therefore would be that it just needs to tweak some header includes and maybe declaring missing POSIX data types, which you have done for the local driver already anyway.
For 9p-synth:
I had enabled 9p-synth.c and built it successfully on Windows platform. However, test cases code are not built on Windows host.
So I think it is useless that enable synth on Windows host (no way to run it).
Quoted 24 lines
BTW support for macOS hosts has just been recently added for 9p, I know it is different as its a POSIX OS, but maybe you might still find the diff [2] helpful.
[1] https://wiki.qemu.org/Documentation/9p#9p_Filesystem_Drivers
[2] https://gitlab.com/qemu-project/qemu/-/commit/f45cc81911adc772Quoted 7 lines
Quoted 3 lines
What are the limitations against security_model=mapped on Windows? Keep in mind that with security_model=none you are very limited in what you can do with 9p.
MSYS library does not support extend attribute (e.g. getxattr), And does not support POSIX permission APIs (e.g. chmod, chown). Security model is useless on Windows host.
That would be security_model=passthrough, yes, that's not possible with msys. The recommended way in practice though is using security_model=mapped [3] for all systems, which should be possible to achieve with msys as well ...
[3] https://wiki.qemu.org/Documentation/9psetup#Starting_the_Guest_directly
Quoted 3 lines
It is possible that to "map" extend attribute to NTFS stream data. However, if Windows host media is not NTFS (e.g. FAT) which does not support stream data, then the "map" can not work.
Quoted 9 lines
... yes exactly, it would make sense to use ADS [4] instead of xattr on Windows. ADS are available with NTFS and ReFS and maybe also with exFAT nowadays (?), not sure about the latter though. But I think it is fair enough to assume Windows users to either use NTFS or ReFS. And if they don't, you can still call
error_report_once()to make user aware that
seucrity_model=mapped(-xattr) requires a fileystem on Windows that supports ADS.[4] https://en.wikipedia.org/wiki/NTFS#Alternate_data_stream_(ADS)
Windows does not support POSIX permission.
So I think that only allow user to use security_model=none is reasonable on Windows host.
There is a difficulty to support "mapped" or "mapped-file" on Windows host:
There are many functions in 9p-code using APIs like "openat", "mkdirat", etc. MSYS does not support that (openat is not valid on Windows host).
I remember that 9p replaced "open" by "openat" for a long time.
To fully support "security_model=mapped", 9p for Windows need to replace "openat" by "open". This may impact too many functions.
I would have a try to enable "mapped" by using ADS, but it looks like a big refactor for 9p-local.c
Best Regards,
Guohuai
Quoted 16 lines · Guohuai
Quoted 16 lines
-----Original Message-----
From: Christian Schoenebeck <[email protected]>
Sent: 2022年4月14日 19:24
To: [email protected]; Shi, Guohuai <[email protected]>
Cc: Bin Meng <[email protected]>; Greg Kurz <[email protected]>
Subject: Re: [RFC PATCH 0/4] 9pfs: Add 9pfs support for Windows host[Please note: This e-mail is from an EXTERNAL e-mail address]
Quoted 5 lines · Guohuai
Quoted 5 lines
We have 3 fs drivers: local, synth, proxy. I don't mind about proxy, it is in bad shape and we will probably deprecate it in near future anyway. But it would be good to have support for the synth driver, because we are using it for running test cases and fuzzing tests (QA).
[...]
Quoted 6 lines
For 9p-synth:
I had enabled
9p-synth.cand built it successfully on Windows platform. However, test cases code are not built on Windows host.
So I think it is useless that enable synth on Windows host (no way to run it).
Please, don't give up too soon. Looking at tests/qtest/meson.build it starts with:
# All QTests for now are POSIX-only, but the dependencies are
# really in libqtest, not in the testcases themselves.
if not config_host.has_key('CONFIG_POSIX')
subdir_done()
endifAnd looking at tests/qtest/libqtest.c I "think" this should be working on Windows as well. It uses socket APIs which are available on Windows. I don't see a real show stopper here for Windows.
Could you please try if you can compile the tests on Windows? What we would need is test/qtest/qos-test, we don't need all the other tests:
https://wiki.qemu.org/Documentation/9p#Test_Cases
Quoted 14 lines
Quoted 4 lines
Quoted 3 lines
It is possible that to "map" extend attribute to NTFS stream data. However, if Windows host media is not NTFS (e.g. FAT) which does not support stream data, then the "map" can not work.
Quoted 9 lines
... yes exactly, it would make sense to use ADS [4] instead of xattr on Windows. ADS are available with NTFS and ReFS and maybe also with exFAT nowadays (?), not sure about the latter though. But I think it is fair enough to assume Windows users to either use NTFS or ReFS. And if they don't, you can still call
error_report_once()to make user aware that seucrity_model=mapped(-xattr) requires a fileystem on Windows that supports ADS.
[4] https://en.wikipedia.org/wiki/NTFS#Alternate_data_stream_(ADS)
Quoted 3 lines
Windows does not support POSIX permission.
So I think that only allow user to use security_model=none is reasonable on Windows host.
It depends on the use case. I assume your use case are Windows guests, in that case you don't have the concept of POSIX permissions neither on guest side, nor on host side (on the long-term I am pretty sure though that Windows guest users would want to have some kind of Windows ACL mapping implementation as well).
Quoted 9 lines
There is a difficulty to support "mapped" or "mapped-file" on Windows host:
There are many functions in 9p-code using APIs like "openat", "mkdirat", etc. MSYS does not support that (openat is not valid on Windows host). I remember that 9p replaced "open" by "openat" for a long time. To fully support "security_model=mapped", 9p for Windows need to replace "openat" by "open". This may impact too many functions.I would have a try to enable "mapped" by using ADS, but it looks like a big refactor for
9p-local.c
Regarding openat(): We had a similar challenge for macOS host implementation; macOS does not have mknodat(), so what we're currently doing is
pthread_fchdir_np(...)
mknod(...)
https://github.com/qemu/qemu/blob/master/hw/9pfs/9p-util-darwin.c#L84
So on Windows you could do:
chdir(...)
open(...)
as workaround for providing openat() for msys.
For security_model=mapped(-xattr) to work on Windows you basically would need to provide a replacement implementation (based on Windows ADS) in 9p-util-windows.c for:
ssize_t fgetxattrat_nofollow(int dirfd, const char *filename, const char
*name, void *value, size_t size);
ssize_t flistxattrat_nofollow(int dirfd, const char *filename,
char *list, size_t size);
ssize_t fremovexattrat_nofollow(int dirfd, const char *filename,
const char *name);
int fsetxattrat_nofollow(int dirfd, const char *filename, const char *name,
void *value, size_t size, int flags);
So it does not look too bad I think to get security_model=mapped working, and it would make Windows 9p host support much more usable (for Linux guests, macOS guests, but also for Windows guests with mapped Windows ACL in future).
Best regards,
Christian Schoenebeck
Quoted 103 lines · Christian Schoenebeck
Quoted 16 lines · Guohuai
Quoted 16 lines
-----Original Message-----
From: Christian Schoenebeck <[email protected]>
Sent: 2022年4月14日 19:24
To: [email protected]; Shi, Guohuai <[email protected]>
Cc: Bin Meng <[email protected]>; Greg Kurz <[email protected]>
Subject: Re: [RFC PATCH 0/4] 9pfs: Add 9pfs support for Windows host[Please note: This e-mail is from an EXTERNAL e-mail address]
Quoted 5 lines · Guohuai
Quoted 5 lines
We have 3 fs drivers: local, synth, proxy. I don't mind about proxy, it is in bad shape and we will probably deprecate it in near future anyway. But it would be good to have support for the synth driver, because we are using it for running test cases and fuzzing tests (QA).
[...]
Quoted 6 lines
For 9p-synth:
I had enabled
9p-synth.cand built it successfully on Windows platform. However, test cases code are not built on Windows host.
So I think it is useless that enable synth on Windows host (no way to run it).Please, don't give up too soon. Looking at tests/qtest/meson.build it starts with:
# All QTests for now are POSIX-only, but the dependencies are
# really in libqtest, not in the testcases themselves. if not config_host.has_key('CONFIG_POSIX') subdir_done() endifAnd looking at
tests/qtest/libqtest.cI "think" this should be working on Windows as well. It uses socket APIs which are available on Windows. I don't see a real show stopper here for Windows.Could you please try if you can compile the tests on Windows? What we would need is test/qtest/qos-test, we don't need all the other tests:
https://wiki.qemu.org/Documentation/9p#Test_Cases
Quoted 14 lines
Quoted 4 lines
Quoted 3 lines
It is possible that to "map" extend attribute to NTFS stream data. However, if Windows host media is not NTFS (e.g. FAT) which does not support stream data, then the "map" can not work.
Quoted 9 lines
... yes exactly, it would make sense to use ADS [4] instead of xattr on Windows. ADS are available with NTFS and ReFS and maybe also with exFAT nowadays (?), not sure about the latter though. But I think it is fair enough to assume Windows users to either use NTFS or ReFS. And if they don't, you can still call
error_report_once()to make user aware that seucrity_model=mapped(-xattr) requires a fileystem on Windows that supports ADS.
[4] https://en.wikipedia.org/wiki/NTFS#Alternate_data_stream_(ADS)Quoted 3 lines
Windows does not support POSIX permission.
So I think that only allow user to use security_model=none is reasonable on Windows host.It depends on the use case. I assume your use case are Windows guests, in that case you don't have the concept of POSIX permissions neither on guest side, nor on host side (on the long-term I am pretty sure though that Windows guest users would want to have some kind of Windows ACL mapping implementation as well).
Quoted 9 lines
There is a difficulty to support "mapped" or "mapped-file" on Windows host:
There are many functions in 9p-code using APIs like "openat", "mkdirat", etc. MSYS does not support that (openat is not valid on Windows host). I remember that 9p replaced "open" by "openat" for a long time. To fully support "security_model=mapped", 9p for Windows need to replace "openat" by "open". This may impact too many functions.I would have a try to enable "mapped" by using ADS, but it looks like a big refactor for
9p-local.cRegarding
openat(): We had a similar challenge for macOS host implementation; macOS does not havemknodat(), so what we're currently doing ispthread_fchdir_np(...) mknod(...) https://github.com/qemu/qemu/blob/master/hw/9pfs/9p-util-darwin.c#L84So on Windows you could do:
chdir(...) open(...)as workaround for providing
openat()for msys.For security_model=mapped(-xattr) to work on Windows you basically would need to provide a replacement implementation (based on Windows ADS) in
9p-util-windows.cfor:
ssize_tfgetxattrat_nofollow(int dirfd, const char *filename, const char*name, void *value, size_t size);
ssize_tflistxattrat_nofollow(int dirfd, const char *filename,char *list, size_t size);
ssize_tfremovexattrat_nofollow(int dirfd, const char *filename,
Quoted 8 lines
const char *name);int fsetxattrat_nofollow(int dirfd, const char *filename, const char *name,
void *value, size_t size, int flags);So it does not look too bad I think to get security_model=mapped working, and it would make Windows 9p host support much more usable (for Linux guests, macOS guests, but also for Windows guests with mapped Windows ACL in future).
FWIW even just having security_model=none would be very useful here, since then 9pfs could be used to share host files across all of Windows, MacOS and POSIX OSs which is something that can't yet be done with virtiofsd.
Whilst using ADS would allow the xattrs to be attached to files, how would this work in the case of ACLs which are stored as a "system.posix_acl_access" attribute? My concern would be that files copied from the guest to the host wouldn't have sensible permissions when read directly on the host. Presumably there would be some existing precedent for how this is handled in WSL2?
ATB,
Mark.
Quoted 129 lines · On Montag, 18. April 2022 11:07:33 CEST Mark Cave-Ayland wrote:
Quoted 120 lines · Christian Schoenebeck
Quoted 15 lines · Guohuai
Quoted 15 lines
-----Original Message-----
From: Christian Schoenebeck <[email protected]>
Sent: 2022年4月14日 19:24
To: [email protected]; Shi, Guohuai <[email protected]>
Cc: Bin Meng <[email protected]>; Greg Kurz <[email protected]>
Subject: Re: [RFC PATCH 0/4] 9pfs: Add 9pfs support for Windows host[Please note: This e-mail is from an EXTERNAL e-mail address]
Quoted 5 lines · Guohuai
Quoted 5 lines
We have 3 fs drivers: local, synth, proxy. I don't mind about proxy, it is in bad shape and we will probably deprecate it in near future anyway. But it would be good to have support for the synth driver, because we are using it for running test cases and fuzzing tests (QA).
[...]
Quoted 6 lines
For 9p-synth:
I had enabled
9p-synth.cand built it successfully on Windows platform. However, test cases code are not built on Windows host.
So I think it is useless that enable synth on Windows host (no way to run it).Please, don't give up too soon. Looking at tests/qtest/meson.build it starts with:
# All QTests for now are POSIX-only, but the dependencies are
# really in libqtest, not in the testcases themselves. if not config_host.has_key('CONFIG_POSIX')
subdir_done()endif
And looking at
tests/qtest/libqtest.cI "think" this should be working on Windows as well. It uses socket APIs which are available on Windows. I don't see a real show stopper here for Windows.Could you please try if you can compile the tests on Windows? What we would
need is test/qtest/qos-test, we don't need all the other tests:https://wiki.qemu.org/Documentation/9p#Test_Cases
Quoted 13 lines
Quoted 4 lines
Quoted 3 lines
It is possible that to "map" extend attribute to NTFS stream data. However, if Windows host media is not NTFS (e.g. FAT) which does not support stream data, then the "map" can not work.
Quoted 8 lines
... yes exactly, it would make sense to use ADS [4] instead of xattr on Windows. ADS are available with NTFS and ReFS and maybe also with exFAT nowadays (?), not sure about the latter though. But I think it is fair enough to assume Windows users to either use NTFS or ReFS. And if they don't, you can still call
error_report_once()to make user aware that seucrity_model=mapped(-xattr) requires a fileystem on Windows that supports ADS.
[4] https://en.wikipedia.org/wiki/NTFS#Alternate_data_stream_(ADS)Quoted 4 lines
Windows does not support POSIX permission.
So I think that only allow user to use security_model=none is reasonable on
Windows host.It depends on the use case. I assume your use case are Windows guests, in that case you don't have the concept of POSIX permissions neither on guest side, nor on host side (on the long-term I am pretty sure though that Windows guest users would want to have some kind of Windows ACL mapping implementation as well).
Quoted 11 lines
There is a difficulty to support "mapped" or "mapped-file" on Windows host:
There are many functions in 9p-code using APIs like "openat", "mkdirat", etc. MSYS does not support that (openat is not valid on Windows host). I remember that 9p replaced "open" by "openat" for a long time. To fully support "security_model=mapped", 9p for Windows need to replace "openat" by "open". This may impact too many functions.I would have a try to enable "mapped" by using ADS, but it looks like a big
refactor for9p-local.cRegarding
openat(): We had a similar challenge for macOS host implementation; macOS does not havemknodat(), so what we're currently doing ispthread_fchdir_np(...) mknod(...) https://github.com/qemu/qemu/blob/master/hw/9pfs/9p-util-darwin.c#L84So on Windows you could do:
chdir(...) open(...)as workaround for providing
openat()for msys.For security_model=mapped(-xattr) to work on Windows you basically would need to provide a replacement implementation (based on Windows ADS) in
9p-util-windows.cfor:ssize_t fgetxattrat_nofollow(int dirfd, const char *filename, const char *name, void *value, size_t size); ssize_t flistxattrat_nofollow(int dirfd, const char *filename, char *list, size_t size); ssize_t fremovexattrat_nofollow(int dirfd, const char *filename, const char *name); int fsetxattrat_nofollow(int dirfd, const char *filename, const char *name, void *value, size_t size, int flags);Quoted 4 lines
So it does not look too bad I think to get security_model=mapped working, and it would make Windows 9p host support much more usable (for Linux guests, macOS guests, but also for Windows guests with mapped Windows ACL in future).
FWIW even just having security_model=none would be very useful here, since then 9pfs could be used to share host files across all of Windows, MacOS and POSIX OSs which is something that can't yet be done with virtiofsd.
Quoted 6 lines
Whilst using ADS would allow the xattrs to be attached to files, how would this work in the case of ACLs which are stored as a "system.posix_acl_access" attribute? My concern would be that files copied from the guest to the host wouldn't have sensible permissions when read directly on the host. Presumably there would be some existing precedent for how this is handled in WSL2?
The behaviour with security_level=mapped on Windows would be identical to that of other already supported systems, that is there are two *distinct* levels for ownership and permissions in mapped mode:
1. The actual ownership information and permissions on host's file system. Guest won't ever get more permissions than those on host fs level, so this level defines the maximum permissions if you will. Those information are not directly exposed to, visible to, nor altered by guest though.
2. The ownership information and permissions mapped by 9p server. That's what guest sees and is able to alter in this mode. The only difference between security_level=mapped(-xattr) and security_level=mapped-file is just the location where those mapped ownership and permissions are stored to by 9p server (currently: either hidden xattr vs. hidden file).
See also section "1. local fs driver" for some more explanation on this:
https://wiki.qemu.org/Documentation/9p#9p_Filesystem_Drivers
As for POSIX ACLs specifically: a Linux guest kernel does access those as "system.posix_acl_access" and "system.posix_acl_default" xattrs, but on host fs level they are actually stored and read by 9p server as "user.virtfs.posix_acl_access" and "user.virtfs.posix_acl_default" xattrs instead. So again, ACLs that may exist on host fs level are separated from ACLs on guest level in mapped mode, similar to POSIX ownership, permissions and device type info.
Best regards,
Christian Schoenebeck
Quoted 155 lines · Christian Schoenebeck
Quoted 129 lines · On Montag, 18. April 2022 11:07:33 CEST Mark Cave-Ayland wrote:
Quoted 120 lines · Christian Schoenebeck
Quoted 15 lines · Guohuai
Quoted 15 lines
-----Original Message-----
From: Christian Schoenebeck <[email protected]>
Sent: 2022年4月14日 19:24
To: [email protected]; Shi, Guohuai <[email protected]>
Cc: Bin Meng <[email protected]>; Greg Kurz <[email protected]>
Subject: Re: [RFC PATCH 0/4] 9pfs: Add 9pfs support for Windows host[Please note: This e-mail is from an EXTERNAL e-mail address]
Quoted 5 lines · Guohuai
Quoted 5 lines
We have 3 fs drivers: local, synth, proxy. I don't mind about proxy, it is in bad shape and we will probably deprecate it in near future anyway. But it would be good to have support for the synth driver, because we are using it for running test cases and fuzzing tests (QA).
[...]
Quoted 6 lines
For 9p-synth:
I had enabled
9p-synth.cand built it successfully on Windows platform. However, test cases code are not built on Windows host.
So I think it is useless that enable synth on Windows host (no way to run it).Please, don't give up too soon. Looking at tests/qtest/meson.build it starts with:
# All QTests for now are POSIX-only, but the dependencies are
# really in libqtest, not in the testcases themselves. if not config_host.has_key('CONFIG_POSIX')
subdir_done()endif
And looking at
tests/qtest/libqtest.cI "think" this should be working on Windows as well. It uses socket APIs which are available on Windows. I don't see a real show stopper here for Windows.Could you please try if you can compile the tests on Windows? What we would
need is test/qtest/qos-test, we don't need all the other tests:https://wiki.qemu.org/Documentation/9p#Test_Cases
Quoted 13 lines
Quoted 4 lines
Quoted 3 lines
It is possible that to "map" extend attribute to NTFS stream data. However, if Windows host media is not NTFS (e.g. FAT) which does not support stream data, then the "map" can not work.
Quoted 8 lines
... yes exactly, it would make sense to use ADS [4] instead of xattr on Windows. ADS are available with NTFS and ReFS and maybe also with exFAT nowadays (?), not sure about the latter though. But I think it is fair enough to assume Windows users to either use NTFS or ReFS. And if they don't, you can still call
error_report_once()to make user aware that seucrity_model=mapped(-xattr) requires a fileystem on Windows that supports ADS.
[4] https://en.wikipedia.org/wiki/NTFS#Alternate_data_stream_(ADS)Quoted 4 lines
Windows does not support POSIX permission.
So I think that only allow user to use security_model=none is reasonable on
Windows host.It depends on the use case. I assume your use case are Windows guests, in that case you don't have the concept of POSIX permissions neither on guest side, nor on host side (on the long-term I am pretty sure though that Windows guest users would want to have some kind of Windows ACL mapping implementation as well).
Quoted 11 lines
There is a difficulty to support "mapped" or "mapped-file" on Windows host:
There are many functions in 9p-code using APIs like "openat", "mkdirat", etc. MSYS does not support that (openat is not valid on Windows host). I remember that 9p replaced "open" by "openat" for a long time. To fully support "security_model=mapped", 9p for Windows need to replace "openat" by "open". This may impact too many functions.I would have a try to enable "mapped" by using ADS, but it looks like a big
refactor for9p-local.cRegarding
openat(): We had a similar challenge for macOS host implementation; macOS does not havemknodat(), so what we're currently doing ispthread_fchdir_np(...) mknod(...) https://github.com/qemu/qemu/blob/master/hw/9pfs/9p-util-darwin.c#L84So on Windows you could do:
chdir(...) open(...)as workaround for providing
openat()for msys.For security_model=mapped(-xattr) to work on Windows you basically would need to provide a replacement implementation (based on Windows ADS) in
9p-util-windows.cfor:ssize_t fgetxattrat_nofollow(int dirfd, const char *filename, const char *name, void *value, size_t size); ssize_t flistxattrat_nofollow(int dirfd, const char *filename, char *list, size_t size); ssize_t fremovexattrat_nofollow(int dirfd, const char *filename, const char *name); int fsetxattrat_nofollow(int dirfd, const char *filename, const char *name, void *value, size_t size, int flags);Quoted 4 lines
So it does not look too bad I think to get security_model=mapped working, and it would make Windows 9p host support much more usable (for Linux guests, macOS guests, but also for Windows guests with mapped Windows ACL in future).
FWIW even just having security_model=none would be very useful here, since then 9pfs could be used to share host files across all of Windows, MacOS and POSIX OSs which is something that can't yet be done with virtiofsd.
Quoted 6 lines
Whilst using ADS would allow the xattrs to be attached to files, how would this work in the case of ACLs which are stored as a "system.posix_acl_access" attribute? My concern would be that files copied from the guest to the host wouldn't have sensible permissions when read directly on the host. Presumably there would be some existing precedent for how this is handled in WSL2?
The behaviour with security_level=mapped on Windows would be identical to that of other already supported systems, that is there are two *distinct* levels for ownership and permissions in mapped mode:
1. The actual ownership information and permissions on host's file system. Guest won't ever get more permissions than those on host fs level, so this level defines the maximum permissions if you will. Those information are not directly exposed to, visible to, nor altered by guest though.
2. The ownership information and permissions mapped by 9p server. That's what guest sees and is able to alter in this mode. The only difference between security_level=mapped(-xattr) and security_level=mapped-file is just the location where those mapped ownership and permissions are stored to by 9p server (currently: either hidden xattr vs. hidden file).
See also section "1. local fs driver" for some more explanation on this:
https://wiki.qemu.org/Documentation/9p#9p_Filesystem_Drivers
Quoted 7 lines
As for POSIX ACLs specifically: a Linux guest kernel does access those as "system.posix_acl_access" and "system.posix_acl_default" xattrs, but on host fs level they are actually stored and read by 9p server as "user.virtfs.posix_acl_access" and "user.virtfs.posix_acl_default" xattrs instead. So again, ACLs that may exist on host fs level are separated from ACLs on guest level in mapped mode, similar to POSIX ownership, permissions and device type info.
Hi Christian,
Thanks for the detailed explanation, the last paragraph above in particular clearly answers my question as to how 9pfs handles the xattr-based permissions in mapped mode.
I am certainly interested to help test later versions of the patchset.
ATB,
Mark.
Hi All,
I just finished a basic PoC for mapped-file.
It works! I think I can also support "security_model=map-xattr" by NTFS ADS.
However, I got a limitation of MinGW:
https://github.com/mirror/mingw-w64/blob/master/mingw-w64-crt/misc/dirent.c#L290
MinGW can not handle seekdir() while the directory has changed. That means, if run command like "rm -rf *", MinGW may not delete all files. "rm -rf *" need to call readdir()(and call seekdir() in 9P) and unlink(), and MinGW's seekdir() may seek directory to wrong directory entry index.
I am considering to change 9PFS readdir() implement on Windows host, to fix this problem.
Thanks,
Guohuai
-----Original Message-----
From: Mark Cave-Ayland <[email protected]>
Sent: Tuesday, April 19, 2022 18:59
To: Christian Schoenebeck <[email protected]>
Cc: Shi, Guohuai <[email protected]>; [email protected]; Bin Meng <[email protected]>; Greg Kurz <[email protected]>
Subject: Re: [RFC PATCH 0/4] 9pfs: Add 9pfs support for Windows host
[Please note: This e-mail is from an EXTERNAL e-mail address]
Quoted 161 lines · Christian Schoenebeck
Quoted 134 lines · On Montag, 18. April 2022 11:07:33 CEST Mark Cave-Ayland wrote:
Quoted 125 lines · Christian Schoenebeck
Quoted 17 lines · Guohuai
Quoted 17 lines
-----Original Message-----
From: Christian Schoenebeck <[email protected]>
Sent: 2022年4月14日 19:24
To: [email protected]; Shi, Guohuai <[email protected]>
Cc: Bin Meng <[email protected]>; Greg Kurz <[email protected]>
Subject: Re: [RFC PATCH 0/4] 9pfs: Add 9pfs support for Windows host[Please note: This e-mail is from an EXTERNAL e-mail address]
Quoted 5 lines · Guohuai
Quoted 5 lines
We have 3 fs drivers: local, synth, proxy. I don't mind about proxy, it is in bad shape and we will probably deprecate it in near future anyway. But it would be good to have support for the synth driver, because we are using it for running test cases and fuzzing tests (QA).
[...]
Quoted 6 lines
For 9p-synth:
I had enabled
9p-synth.cand built it successfully on Windows platform. However, test cases code are not built on Windows host.
So I think it is useless that enable synth on Windows host (no way to run it).Please, don't give up too soon. Looking at tests/qtest/meson.build it starts with:
# All QTests for now are POSIX-only, but the dependencies are # really in libqtest, not in the testcases themselves. if not
config_host.has_key('CONFIG_POSIX')
subdir_done()endif
And looking at
tests/qtest/libqtest.cI "think" this should be working on Windows as well. It uses socket APIs which are available on Windows. I don't see a real show stopper here for Windows.Could you please try if you can compile the tests on Windows? What we would need is test/qtest/qos-test, we don't need all the other tests:
https://wiki.qemu.org/Documentation/9p#Test_Cases
Quoted 14 lines
Quoted 4 lines
Quoted 3 lines
It is possible that to "map" extend attribute to NTFS stream data. However, if Windows host media is not NTFS (e.g. FAT) which does not support stream data, then the "map" can not work.
Quoted 9 lines
... yes exactly, it would make sense to use ADS [4] instead of xattr on Windows. ADS are available with NTFS and ReFS and maybe also with exFAT nowadays (?), not sure about the latter though. But I think it is fair enough to assume Windows users to either use NTFS or ReFS. And if they don't, you can still call
error_report_once()to make user aware that seucrity_model=mapped(-xattr) requires a fileystem on Windows that supports ADS.
[4] https://en.wikipedia.org/wiki/NTFS#Alternate_data_stream_(ADS)Quoted 3 lines
Windows does not support POSIX permission.
So I think that only allow user to use security_model=none is reasonable on Windows host.It depends on the use case. I assume your use case are Windows guests, in that case you don't have the concept of POSIX permissions neither on guest side, nor on host side (on the long-term I am pretty sure though that Windows guest users would want to have some kind of Windows ACL mapping implementation as well).
Quoted 11 lines
There is a difficulty to support "mapped" or "mapped-file" on Windows
host:
There are many functions in 9p-code using APIs like "openat", "mkdirat", etc. MSYS does not support that (openat is not valid on Windows host). I remember that 9p replaced "open" by "openat" for a long time. To fully support "security_model=mapped", 9p for Windows need to replace "openat" by "open". This may impact too many functions.I would have a try to enable "mapped" by using ADS, but it looks like a big refactor for
9p-local.cRegarding
openat(): We had a similar challenge for macOS host implementation; macOS does not havemknodat(), so what we're currently doing ispthread_fchdir_np(...) mknod(...)https://github.com/qemu/qemu/blob/master/hw/9pfs/9p-util-darwin.c#L8
4So on Windows you could do:
chdir(...) open(...)as workaround for providing
openat()for msys.For security_model=mapped(-xattr) to work on Windows you basically would need to provide a replacement implementation (based on Windows ADS) in
9p-util-windows.cfor:ssize_t fgetxattrat_nofollow(int dirfd, const char *filename, const char *name, void *value, size_t size); ssize_t flistxattrat_nofollow(int dirfd, const char *filename, char *list, size_t size); ssize_t fremovexattrat_nofollow(int dirfd, const char *filename, const char *name); int fsetxattrat_nofollow(int dirfd, const char *filename, const char *name, void *value, size_t size, int flags);Quoted 4 lines
So it does not look too bad I think to get security_model=mapped working, and it would make Windows 9p host support much more usable (for Linux guests, macOS guests, but also for Windows guests with mapped Windows ACL in future).
FWIW even just having security_model=none would be very useful here, since then 9pfs could be used to share host files across all of
Windows, MacOS and POSIX OSs which is something that can't yet be done with virtiofsd.Quoted 6 lines
Whilst using ADS would allow the xattrs to be attached to files, how would this work in the case of ACLs which are stored as a "system.posix_acl_access" attribute? My concern would be that files copied from the guest to the host wouldn't have sensible permissions when read directly on the host. Presumably there would be some existing precedent for how this is handled in WSL2?
The behaviour with security_level=mapped on Windows would be identical to that of other already supported systems, that is there are two *distinct* levels for ownership and permissions in mapped mode:
1. The actual ownership information and permissions on host's file system. Guest won't ever get more permissions than those on host fs level, so this level defines the maximum permissions if you will. Those information are not directly exposed to, visible to, nor altered by guest though.
2. The ownership information and permissions mapped by 9p server. That's what guest sees and is able to alter in this mode. The only difference between
security_level=mapped(-xattr) and security_level=mapped-file is just the location where those mapped ownership and permissions are stored to by 9p server (currently: either hidden xattr vs. hidden file).See also section "1. local fs driver" for some more explanation on this:
https://wiki.qemu.org/Documentation/9p#9p_Filesystem_Drivers
Quoted 7 lines
As for POSIX ACLs specifically: a Linux guest kernel does access those as "system.posix_acl_access" and "system.posix_acl_default" xattrs, but on host fs level they are actually stored and read by 9p server as "user.virtfs.posix_acl_access" and "user.virtfs.posix_acl_default" xattrs instead. So again, ACLs that may exist on host fs level are separated from ACLs on guest level in mapped mode, similar to POSIX ownership, permissions and device type info.
Hi Christian,
Thanks for the detailed explanation, the last paragraph above in particular clearly answers my question as to how 9pfs handles the xattr-based permissions in mapped mode.
I am certainly interested to help test later versions of the patchset.
ATB,
Mark.
Quoted 5 lines · Guohuai
Hi All,
I just finished a basic PoC for mapped-file.
It works! I think I can also support "security_model=map-xattr" by NTFS ADS.
Slick!
Quoted 11 lines
However, I got a limitation of MinGW:
https://github.com/mirror/mingw-w64/blob/master/mingw-w64-crt/misc/dirent.c#
L290MinGW can not handle
seekdir()while the directory has changed. That means, if run command like "rm -rf *", MinGW may not delete all files. "rm -rf *" need to call readdir()(and callseekdir()in 9P) andunlink(), and MinGW'sseekdir()may seek directory to wrong directory entry index. I am considering to change 9PFSreaddir()implement on Windows host, to fix this problem.
To avoid history repeating [1]: please do not attempt to address this in 9p.c! That file is the controller portion of 9p server and must remain fs-agnostic. Such kind of issue should rather be addressed on fs driver level (e.g. 9p-local.c, 9p-util-windows.c).
I.e. don't do it like this:
[1] https://lore.kernel.org/all/[email protected]/T/#m734f405973768e43ce3ed7550bd21809abb25813
Best regards,
Christian Schoenebeck