1d03e56607
A well behaved FUSE client uses FUSE_CREATE to create files. It isn't supposed to pass O_CREAT along a FUSE_OPEN request, as documented in the "fuse_lowlevel.h" header : /** * Open a file * * Open flags are available in fi->flags. The following rules * apply. * * - Creation (O_CREAT, O_EXCL, O_NOCTTY) flags will be * filtered out / handled by the kernel. But if the client happens to do it anyway, the server ends up passing this flag to open() without the mandatory mode_t 4th argument. Since open() is a variadic function, glibc will happily pass whatever it finds on the stack to the syscall. If this file is compiled with -D_FORTIFY_SOURCE=2, glibc will even detect that and abort: *** invalid openat64 call: O_CREAT or O_TMPFILE without mode ***: terminated Specifying O_CREAT with FUSE_OPEN is a protocol violation. Check this in do_open(), print out a message and return an error to the client, EINVAL like we already do when fuse_mbuf_iter_advance() fails. The FUSE filesystem doesn't currently support O_TMPFILE, but the very same would happen if O_TMPFILE was passed in a FUSE_OPEN request. Check that as well. Signed-off-by: Greg Kurz <groug@kaod.org> Message-Id: <20210624101809.48032-1-groug@kaod.org> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> |
||
---|---|---|
.. | ||
50-qemu-virtiofsd.json.in | ||
buffer.c | ||
fuse_common.h | ||
fuse_i.h | ||
fuse_log.c | ||
fuse_log.h | ||
fuse_lowlevel.c | ||
fuse_lowlevel.h | ||
fuse_misc.h | ||
fuse_opt.c | ||
fuse_opt.h | ||
fuse_signals.c | ||
fuse_virtio.c | ||
fuse_virtio.h | ||
helper.c | ||
meson.build | ||
passthrough_helpers.h | ||
passthrough_ll.c | ||
passthrough_seccomp.c | ||
passthrough_seccomp.h |