4 ms·
> A video player is a great thing to sandbox because all it needs is a video output, very limited file access, and very limited gui input. It doesn't need to re
by jbk 13y ago
> A video player is a great thing to sandbox because all it needs is a video output, very limited file access, and very limited gui input. It doesn't need to read all your files, open network connections, or start processes.
Not sure if serious or sarcasm, to be honest, since this seems very far from what we see.
A media player is not simple to sandbox, (as the MacOS X sandbox showed us for example), because:
- you need to open files by yourself, without user interaction, to support playlists,
- you need to open connections by yourself to support video protocol like RTSP, RTMP, RTP,
- you need raw device access to support Webcams, Capture devices, DVDs, DVB tuners,
- you need to access GPU buffers for direct rendering, and/or shaders to do fast filtering or just plain chroma-conversions,
- you need to be able to access the audio output, at low-level, for libsync which is not always doable with the simplified APIs,
- and I don't understand what you mean by "very limited gui input"; how is that less than other programs?
Sure, it can be done, with performance costs but it's clearly not a "no-brainer".
- chubot 13y agoI'm talking about a multiprocess architecture like Chrome. http://www.chromium.org/developers/design-documents/multi-process-architecture http://www.chromium.org/developers/design-documents/multi-pr... The entire app isn't sandboxed -- just the code that does video parsing, i.e. with the thousands of bugs and hundreds of remote code execution exploits (!). See my other comment on this topic. ffmpeg is already very modular, and used in many video players (user interfaces), so this separation is more than natural -- it already exists in the codebase. BTW, some people seem to be unfamiliar with the multiprocess/Unix design approach (usually people with a Windows background, which I came from as well). I recommend http://www.catb.org/esr/writings/taoup/ http://www.catb.org/esr/writings/taoup/ for a great intro to this design philosophy.
- jbk 13y ago> The entire app isn't sandboxed -- just the code that does video parsing, i.e. with the thousands of bugs and hundreds of remote code execution exploits (!). The exploits are usually on the protocol (access) level, the demuxer (format) level but also the decoder level. While in theory the first 2 are what you call parsing, many security issues appear also at the decoder level. And if you want to split the video decoder from the rendering, you need to introduce an additional memcpy (or two) of full decoded frames, which has an important impact. I agree it would be nice to try, with a correct, separated processes architecture, but it means changing also a bit the usual architecture, where there is a direct-rendering between the decoder and the output.
- ori_b 13y agoWhat you do is split the file I/O from the rendering. Drop privs on the renderer, and feed it data from another process that handles the file access, setup, and other privileged operations. You can open your X11 socket (or whatever your GUI uses) in the I/O process and hand it off to the renderer before dropping privileges, and hand it off without any loss of performance. Another thought -- although I don't generally touch 3d rendering, or know enough to know if it's possible off the top of my head -- is something like cross-process pbuffers: you render into one, and composite the result to the screen from another process. Since your OS already does this sort of thing (X11 compositors, for example, do this sort of cross-process compositing), this can't be too expensive. You might need to use the XACE extension to restrict the renderer to just the rendering output window in case it gets exploited, so that you don't have access to the rest of the UI. The places where vulnerabilities can do damage are when communicating with the rest of the OS: File I/O allows you to get user data, permanently install malware, and delete things. The window system allows you to snoop keystroke/mouse data, synthesize input, and watch what the user does. Drop privs on those, and your app is fairly effectively sandboxed.