ipc-channel
ipc-channel copied to clipboard
Use anonymous shared memory on FreeBSD
It works in Capsicum capability mode (process sandbox).
What do you think about pulling this code into a separate tiny crate? This exact functionality is needed in a lot of things (mostly Wayland-related). Would you merge a patch that replaces this code with a dependency?
I think that is reasonable. memfd_create
is only available post linux 3.17 and has no glibc wrapper. It must be called via syscall, so as long as that it is only used when a feature is enabled, I think a separate crate would be reasonable.
Done! https://github.com/myfreeweb/shmemfdrs & updated this PR to use it
Looks good to me. I'm not sure though what Servo's policy is for introducing new external dependencies?
@myfreeweb out of curiosity: how and for what purpose does WR need to use this?
@dlrobertson that's a bit tangential: but did we ever discuss checking for memfd
support at run-time?...
WR? WebRender, on its own? Does it use ipc-channel at all?
Servo needs SHM_ANON
to run sandboxed on FreeBSD: https://github.com/servo/servo/issues/11625#issuecomment-342243384
@antrik I think we discussed it but I think I forgot to create an issue for it and therefore forgot to investigate further.
@myfreeweb whoops, I guess I misread "Wayland" as "Webrender"...
So I'm a bit confused now: are there other users for shmemfdrs
outside of ipc-channel
?
No existing users as the crate was created today :) But potential users like https://github.com/Smithay/wayland-window/issues/14
@myfreeweb going by the discussion there, it seems like they actually need a way to select the specific mechanism depending on client requests, rather than an automatic abstraction? So it doesn't seem like this crate will really help there...
The reason I'm bringing this up is because I am somewhat reluctant -- and from what I gathered, other Servo developers are too -- to introduce a new crate for code that is not actually likely to be used outside of Servo. That would just increase maintenance burden.
The mechanism being file descriptors or not file descriptors — not different ways of creating file descriptors :)
@myfreeweb I was pretty sure it was actually about temporary file based descriptors vs. anonymous descriptors? But then again, I'm not really familiar with the Wayland protocol -- so I guess I might be misreading it...
I made similar changes work in weston, so I know something :) Of course no one cares how a file descriptor is made.
Shared memory file descriptors are used to pass software-rendered buffers from the client to the compositor. The primary "other way" is passing GPU (EGL) buffers. And a compositor theoretically could support EGL only.
:umbrella: The latest upstream changes (presumably #187) made this pull request unmergeable. Please resolve the merge conflicts.
:umbrella: The latest upstream changes (presumably #216) made this pull request unmergeable. Please resolve the merge conflicts.