[Virtio-fs] Status of DAX for virtio-fs/virtiofsd?

Stefan Hajnoczi stefanha at gmail.com
Wed Sep 6 13:57:33 UTC 2023


On Wed, 6 Sept 2023 at 09:07, Hao Xu <hao.xu at linux.dev> wrote:
> On 5/18/23 00:26, Stefan Hajnoczi wrote:
> > On Wed, 17 May 2023 at 11:54, Alex Bennée <alex.bennee at linaro.org> wrote:
> > Hi Alex,
> > There were two unresolved issues:
> >
> > 1. How to inject SIGBUS when the guest accesses a page that's beyond
> > the end-of-file.
>
> Hi Stefan,
> Does this SIGBUS issue exist if the guest kernel can be trusted? Since in
>
> that case, we can check the offset value in guest kernel.

The scenario is:
1. A guest userspace process has a DAX file mmapped.
2. The host or another guest that is also sharing the directory
truncates the file. The pages mmapped by our guest are no longer
valid.
3. The guest loads from an mmapped page and a vmexit occurs.
4. Now the host must inject a SIGBUS into the guest. There is
currently no way to do this.

I believe this scenario doesn't happen within a single guest, because
the guest kernel will raise SIGBUS itself without a vmexit if another
process inside that same guest truncates the file.

Another scenario is when the guest kernel access the DAX pages. A
vmexit can occur here too.

If you trust the host and all guests sharing the directory not to
truncate files that are mmapped, then this issue will not occur.

Stefan



More information about the Virtio-fs mailing list