On 08.05.26 13:55, Fiona Ebner wrote:
Dear maintainers,

Am 10.03.26 um 6:37 PM schrieb Kevin Wolf:
From: Hanna Czenczek <[email protected]>

Manually read requests from the /dev/fuse FD and process them, without
using libfuse.  This allows us to safely add parallel request processing
in coroutines later, without having to worry about libfuse internals.
(Technically, we already have exactly that problem with
read_from_fuse_export()/read_from_fuse_fd() nesting.)

We will continue to use libfuse for mounting the filesystem; fusermount3
is a effectively a helper program of libfuse, so it should know best how
to interact with it.  (Doing it manually without libfuse, while doable,
is a bit of a pain, and it is not clear to me how stable the "protocol"
actually is.)

Take this opportunity of quite a major rewrite to update the Copyright
line with corrected information that has surfaced in the meantime.

a colleague ran into another issue with a fuse export, this time in combination with virt-fw-vars and bisecting points to this patch. Before commit a94a1d7699 ("fuse: Manually process requests (without libfuse)") the reproducer [0] completes successfully, after that commit it hangs at [1]. The issue is still present with current master. I can dig into the details next week.

On my system, virt-fw-vars opens the file with O_TRUNC (after “INFO: writing raw edk2 varstore...”). It then tries to write to the file, but this returns a short write because the export is not marked as growable, and for some reason, the write is infinitely retried instead of aborting on ret=0 (which should indicate ENOSPC for writes).

Using growable=true makes it work.  (For me :))

For some reason, before said commit, libfuse just did not pass that truncate on. I’ll look into why exactly, but so far I would say the FUSE export behavior is as I would expect it.

Hanna


Best Regards,
Fiona

[0]:

#!/bin/bash

rm /tmp/disk.raw
rm /tmp/export.fuse
cp /usr/share/pve-edk2-firmware/OVMF_VARS_4M.ms.fd /tmp/disk.raw
touch /tmp/export.fuse

(
./storage-daemon/qemu-storage-daemon \
    --blockdev raw,node-name=node0,file.driver=file,file.filename=/tmp/disk.raw \     --export fuse,id=exp0,mountpoint=/tmp/export.fuse,node-name=node0,writable=true \
    --chardev socket,id=qmp,path=/run/qsd.qmp,server=on,wait=off \
    --monitor chardev=qmp,mode=control
) &

sleep 1 # too lazy to do proper synchronization for the reproducer here
virt-fw-vars --inplace /tmp/export.fuse --distro-keys windows
echo '{"execute": "qmp_capabilities"}{"execute": "quit"}' | socat - /run/qsd.qmp

[1]:

INFO: reading raw edk2 varstore from /tmp/export.fuse
INFO: var store range: 0x64 -> 0x40000
INFO: add db cert /usr/lib/python3/dist-packages/virt/firmware/certs/MicrosoftWindowsProductionPCA2011.pem
INFO: certificate already present, skipping
INFO: add db cert /usr/lib/python3/dist-packages/virt/firmware/certs/WindowsUEFICA2023.pem
INFO: certificate already present, skipping
INFO: writing raw edk2 varstore to /tmp/export.fuse




Reply via email to