Bug 230969 - [GTK][WPE] Enable bwrap launcher build on bots
Summary: [GTK][WPE] Enable bwrap launcher build on bots
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Philippe Normand
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-29 10:43 PDT by Philippe Normand
Modified: 2021-10-03 08:06 PDT (History)
8 users (show)

See Also:


Attachments
Patch (3.50 KB, patch)
2021-09-29 10:44 PDT, Philippe Normand
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Normand 2021-09-29 10:43:46 PDT
So that it's code does not bitrot.
Comment 1 Philippe Normand 2021-09-29 10:44:56 PDT
Created attachment 439626 [details]
Patch
Comment 2 Michael Catanzaro 2021-09-29 13:06:22 PDT
Comment on attachment 439626 [details]
Patch

Ehh, I can't decide if this is a good change or not. It seems reasonable, so r=me if you decide to proceed. Here's what I'm thinking: building bubblewrap sandbox enabled on buildbots and EWS is definitely good to do. We surely want all tests to run with the sandbox enabled, because they are not meaningfully testing the code that users actually run otherwise (or, in cases where the sandbox is not yet enabled, the code that we want users to actually run). So we surely want to do that. 

The downside is that now we need to modify each downstream flatpak runtime and each flatpak app that bundles WebKitGTK to build with -DENABLE_BUBBLEWRAP_SANDBOX=OFF (because bubblewrap will not be available in these environments, since it is useless under flatpak). That is hardly a big deal. For the GNOME runtime, it would be a one-line change. It might confuse some app developers, but hopefully most app developers inherit WebKitGTK from a runtime instead of building it themselves. So... I think that's OK.

The alternative way to accomplish this would be to enable -DENABLE_BUBBLEWRAP_SANDBOX at the buildbot config or build-webkit level rather than here in CMake. Modifying the config of every bot would be annoying, but perhaps this could be something that build-webkit just knows to pass, because build-webkit is the one special time that we want to build with bubblewrap sandbox enabled inside a flatpak environment?

Whatever. Your call.
Comment 3 Michael Catanzaro 2021-09-29 13:10:21 PDT
(In reply to Michael Catanzaro from comment #2)
> We surely
> want all tests to run with the sandbox enabled, because they are not
> meaningfully testing the code that users actually run otherwise (or, in
> cases where the sandbox is not yet enabled, the code that we want users to
> actually run). So we surely want to do that. 

Also I know we want to avoid mistakes like: spend months developing feature using build-webkit, then discover it doesn't work with the sandbox enabled and is really hard to redesign. I understand you've been there, done that with a web process feature that was going to depend on host network access. That sounds horribly disheartening. Much better to notice the problems immediately instead.
Comment 4 Philippe Normand 2021-09-29 13:13:38 PDT
In g-b-m you already build-depend on bwrap:

https://gitlab.gnome.org/GNOME/gnome-build-meta/-/blob/master/elements/sdk/webkitgtk.bst#L12

Was that an oversight?

IIUC the bwrap process launcher won't be used at runtime anyway if the UIProcess is running in a flatpak runtime.
Comment 5 Philippe Normand 2021-09-29 13:21:03 PDT
(In reply to Philippe Normand from comment #4)
> In g-b-m you already build-depend on bwrap:
> 
> https://gitlab.gnome.org/GNOME/gnome-build-meta/-/blob/master/elements/sdk/
> webkitgtk.bst#L12
> 
> Was that an oversight?
> 
> IIUC the bwrap process launcher won't be used at runtime anyway if the
> UIProcess is running in a flatpak runtime.

Or maybe I am misunderstanding this:

https://github.com/WebKit/WebKit/blob/main/Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp#L174..L184
Comment 6 Michael Catanzaro 2021-09-30 07:11:01 PDT
(In reply to Philippe Normand from comment #4)
> In g-b-m you already build-depend on bwrap:
> 
> https://gitlab.gnome.org/GNOME/gnome-build-meta/-/blob/master/elements/sdk/
> webkitgtk.bst#L12
> 
> Was that an oversight?

An oversight in my previous comment, yes! But not in gnome-build-meta. That's there for GNOME OS.

> IIUC the bwrap process launcher won't be used at runtime anyway if the
> UIProcess is running in a flatpak runtime.

Right, and gnome-build-meta proves that it works. I'm typing this comment in Tech Preview with bubblewrap sandbox enabled at build time but disabled at runtime. Just didn't realize it was enabled before you noticed.

That said, it's still not available in the flatpak runtime (you'll notice we have it in sdk-deps to ensure it doesn't appear in the SDK) so every app bundling WebKit will have to pass -DENABLE_BUBBLEWRAP_SANDBOX=OFF. But apps should really probably not bundle WebKit.

So I think it's fine. Still your call.
Comment 7 EWS 2021-10-02 02:04:22 PDT
Committed r283436 (242423@main): <https://commits.webkit.org/242423@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 439626 [details].
Comment 8 Carlos Alberto Lopez Perez 2021-10-02 03:03:27 PDT
(In reply to Philippe Normand from comment #4)
> IIUC the bwrap process launcher won't be used at runtime anyway if the
> UIProcess is running in a flatpak runtime.

How this works? It may be interesting to do the same when running inside docker. 
Do you know which part of the code does this check?
Comment 10 Michael Catanzaro 2021-10-03 08:06:39 PDT
As you can see, the check is there for docker already, but I'm not sure if it actually works for podman, it might be limited to moby only.