<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
<br />Hi,<br /><br />Continuing discussing [1], but at different angle - probably worth a separate thread.<br /><br />To
 clarify a bit: I'm building a voice control & communication system 
for embedded Linux (part of yet another IoT system, based on Yocto Linux). Of course on top of GStreamer.<br /><br />At the PoC stage 
we're using unix pipes everywhere, but I want to consider other 
transports if they're better, especially in my case of limited CPU 
(~500MHz signle-core armv7 currently).<br /><br />So, I'm considering pipes vs POSIX shared memory vs memfds:<br />(i) Security aspect. <br />-
 With anonymous pipes, I'm planning on passing fd from privileged 
process to a sandboxed one - so it can probably have no filesystem 
access at all. <br /><br />- With shm, does it require more privileges? Also
 does shm require both parties to cooperate - i.e. if a client is 
compromised, there is no security control preventing it from writing to 
shm instead of reading only? Also is there a way to withdraw client's 
access to a shared memory region? (like, one session with audio data was
 intended for one client, another data set - for different one). If 
that's not the case, a copy of shared memory is required per each 
untrusted client then... Looking at PulseAudio's state, they're using 
shm only for per-user setup [2].<br /><br />- Looks like memfds address the 
drawbacks of shm, and also get their way into pulseaudio [2]. But how to 
use them for audio IPC properly is a bit unclear - each audio packet = 
memfd file (sealed)?<br /><br />(ii) Performance - does shm/memfds provide 
noticeable (or rather, worth the trouble) benefits over pipes? 
Especially given that we need to use a separate socket for signaling for
 shm (and even if we replace it with eventfd..)? Also, there is a way to
 speed up pipes (splice [3], O_DIRECT flag [4] - packet mode for pipes 
actually)... <br /><br />Any insights would be much appreciated.<br /><br />[1] <a rel="noopener noreferrer" target="_blank" href="https://lists.freedesktop.org/archives/gstreamer-devel/2016-December/062103.html">https://lists.freedesktop.org/archives/gstreamer-devel/2016-December/062103.html</a><br />[2] <a rel="noopener noreferrer" target="_blank" href="https://www.freedesktop.org/wiki/Software/PulseAudio/Notes/9.0/">https://www.freedesktop.org/wiki/Software/PulseAudio/Notes/9.0</a><br />[3] <a rel="noopener noreferrer" target="_blank" href="https://linux.die.net/man/2/splice">https://linux.die.net/man/2/splice</a><br />[4] <a rel="noopener noreferrer" target="_blank" href="http://man7.org/linux/man-pages/man2/pipe.2.html">http://man7.org/linux/man-pages/man2/pipe.2.html</a><br /><br />Thanks,<br />Wire Snark<br />  </body>
</html>