9pfs-local: open2() deletes existing data?
I was looking at various interesting functions in hw/9pfs/virtio-9p-local.c and noticed local_open2() which basically tries to open a file in a filesystem, and if that is successful, it tries to set file credentials using a configured mechanism, and if that fails, it deletes the file.
Now I wonder what happens if we tried to open an existing file but was not able to set credentials for whatever reason -- eg, because the underlying filesystem does not support xattrs, or whatever. It looks to me that we will remove the user file!
If that's the case, it looks like it is a very serious bug...
Thanks,
/mjt
Quoted 11 lines · Michael Tokarev
I was looking at various interesting functions in
hw/9pfs/virtio-9p-local.cand noticedlocal_open2()which basically tries to open a file in a filesystem, and if that is successful, it tries to set file credentials using a configured mechanism, and if that fails, it deletes the file.Now I wonder what happens if we tried to open an existing file but was not able to set credentials for whatever reason -- eg, because the underlying filesystem does not support xattrs, or whatever. It looks to me that we will remove the user file!
If that's the case, it looks like it is a very serious bug...
That callback is used for create. What is used for open is local_open()
-aneesh