Skip to content

venus: make virgl_render_server and venus work also without HAVE_MEMFD_CREATE

In some case, like in the android14-gsi linux_glibc target, memfd_create is not implemented, however the server/proxy code should still be able to create a shared channel using temp files.

This currently fails because the code attempts to perform file sealing operations even on fd not created by memfd_create and this is not valid, quoting the man page of fcntl(2) in the "File Sealing" section:

Currently, file seals can be applied only to a file descriptor returned by memfd_create(2) (if the MFD_ALLOW_SEALING was employed).
On other filesystems, all fcntl() operations that operate on seals will return EINVAL.

Because of this the sealing operations were always failing when HAVE_MEMFD_CREATE was not defined, but this behavior is unnecessarily strict for the use case at hand.

To fix this perform file sealing operations only when HAVE_MEMFD_CREATE is defined, this way virgl_render_server can still be used when memfd_create is not available even though it may behave in a suboptimal way is such pathological cases.

While at it also protect the code for HAVE_LINUX_UDMABUF_H behind HAVE_MEMFD_CREATE as well, since it uses memfd_create.

Merge request reports

Loading