all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: John Kehayias <john.kehayias@protonmail.com>
To: Jelle Licht <jlicht@fsfe.org>
Cc: guix-devel@gnu.org
Subject: Re: Guix driver paths for icecat RDD sandbox
Date: Mon, 16 Jan 2023 01:24:48 +0000	[thread overview]
Message-ID: <87v8l78e5g.fsf@protonmail.com> (raw)
In-Reply-To: <87o7qzzu49.fsf@fsfe.org>

Hi Jelle and guix,

On Sun, Jan 15, 2023 at 04:37 PM, Jelle Licht wrote:

> Hi guix,
>
> I was playing around tyring to get hardware enabled video decoding
> working in icecat and/or firefox in guix, and found out that the fine
> folks working on Nix have already gotten a patch upstreamed that allows
> stuff in /nix/store to be loaded[0]. (Grep around for '/nix/store' in
> our icecat sources to see what I mean).

I think hardware accelerated decoding is more than just nice to have due to the massive
savings in CPU usage (and thus battery power for a laptop beyond general overhead). So
props for working on this!

As a disclaimer, last I tried icecat was not giving me hardware video decoding, but I did
fix it in firefox, at least in my testing. As that is not in Guix (for branding and/or
addon interface, is that correct?) I won't reference that in any detail, though I know you
(Jelle) are familiar with the details there. I'll explain a little below, for others
though. Hardware acceleration does let me watch the highest quality videos I could find
with minimal CPU usage.

>
> From what I can see, the RDD whitelist reads through symlinks, so the
> actual target file needs to be whitelisted before the file is loaded in
> the sandbox.
>

Yes, that is my understanding as well. And we should note that the RDD (Remote Data
Decoder) sandbox is a newer-ish feature that I'm at least aware of in the context of video
accelerated video decoding. This is different from other sandboxes used in icecat/firefox.

However, there is also an automatic allowance for anything in LD_LIBRARY_PATH. That was
the fix I used, drawing upon Mark Weaver's work in icecat to get everything in the runpath
for some drivers (e.g. from mesa). Adding that to LD_LIBRARY_PATH allows the RDD sandbox
access to them. And, as always, getting good debugging of library loading in sandboxes is
a bit tricky. I can probably dig up what I found and used if that is of use for anyone
(there's some Mozilla flags at least).

> Without this (or a similar fix), we'd need a custom package per possible
> value of LIBVA_DRIVERS_PATH, as loadable libraries for hardware
> accelaration do not seem directly configurable via
> 'browser/app/profile/icecat.js' at runtime. I may be wrong here, but
> this seems to also imply that a recompilation of icecat would be
> required as well every time one of these 'inputs' change :/.
>

Agreed, that is a potential downside, but what are the possible libva drivers in Guix?
There's mesa and possibly libvdpau-va-gl? Mesa is already needed anyway (and rarely
changes, though see discussion about more staging/feature branches). I also didn't see a
way to do this at runtime, based on how the RDD sandbox works.

There's also the question on foreign distros, which I don't know about.

> OTOH, it would have some drawbacks:
> - It hardcodes /gnu/store, instead of $MY_MAGIC_STORE_LOCATION
> - It allows loading of pretty much anything in the store by the
> sandboxed process.
>
> The second drawback seems pretty iffy, but the current suggested
> workaround is to disable the sandbox entirely.
>

I also share some concerns on the second solution but I'm not expert. On the one hand, we
expect the store to be world readable in general. On the other, sandboxes are there for a
reason and increasing a possible attack vector (say, on old version of something in the
store or similarly known exploit) is to be avoided. So I don't know.

> So that leaves us with 2 questions:
>
> 1. Do we want apply a patch to whitelist '/gnu/store'?
> 2. If so, would we want to also send this patch upstream firefox? They
> seem open to accepting it.
>

With my caveat that I didn't get this working on my end for icecat (I should retry), I
would be more for a limited workaround. But that might not be workable in general. I don't
use icecat much, and rarely for videos, so I haven't pursued it further. This might be a
good time to try again though.

If we go the second route I think it makes sense to upstream it in light of the similar
patch from Nix.

> I've opened an upstream issue for a similar treatment of /gnu/store,
> which may also simplify the 'build-sandbox-whitelist' phase of our
> icecat package[1] if accepted. I'm not entirely sure if that is
> ultimately a good thing yet though.
>
> Happy to hear any thoughts on this subject.
>
> - Jelle
>
> [0]: <https://bugzilla.mozilla.org/show_bug.cgi?id=1761692>
> [1]: <https://bugzilla.mozilla.org/show_bug.cgi?id=1808408>

All for better hardware video support, alas the ever-growing land of sandboxes and
containers (somehow I keep getting drawn in!).

John



      reply	other threads:[~2023-01-16  1:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-15 15:37 Guix driver paths for icecat RDD sandbox Jelle Licht
2023-01-16  1:24 ` John Kehayias [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v8l78e5g.fsf@protonmail.com \
    --to=john.kehayias@protonmail.com \
    --cc=guix-devel@gnu.org \
    --cc=jlicht@fsfe.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.