Bug 209223 - [Flatpak SDK] Release logs not sent to journald when running within the SDK runtime
Summary: [Flatpak SDK] Release logs not sent to journald when running within the SDK r...
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: 2020-03-18 05:52 PDT by Philippe Normand
Modified: 2020-03-19 08:25 PDT (History)
4 users (show)

See Also:


Attachments
Patch (2.55 KB, patch)
2020-03-18 09:08 PDT, Philippe Normand
no flags Details | Formatted Diff | Diff
Patch (2.58 KB, patch)
2020-03-18 09:24 PDT, Philippe Normand
no flags Details | Formatted Diff | Diff
Patch (2.54 KB, patch)
2020-03-19 02:56 PDT, Philippe Normand
no flags Details | Formatted Diff | Diff
Patch (2.65 KB, patch)
2020-03-19 03:55 PDT, Philippe Normand
no flags Details | Formatted Diff | Diff
Patch (2.78 KB, patch)
2020-03-19 07:57 PDT, Philippe Normand
clopez: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Normand 2020-03-18 05:52:08 PDT
This needs further investigation.
Comment 1 Philippe Normand 2020-03-18 08:43:47 PDT
$ cat ~/journal-test.c 

#include <systemd/sd-journal.h>

int main(int argc, char *argv[]) {
  sd_journal_print(LOG_NOTICE, "Hello World");
  return 0;
}

$ gcc -o /tmp/test `pkg-config --cflags --libs libsystemd` /app/phil/journal-test.c

$ strace /tmp/test
[...]
sendmsg(3, {msg_name={sa_family=AF_UNIX, sun_path="/run/systemd/journal/socket"}, msg_namelen=30, msg_iov=[{iov_base="MESSAGE=Hello World", iov_len=19}, {iov_base="\n", iov_len=1}, {iov_base="PRIORITY=5", iov_len=10}, {iov_base="\n", iov_len=1}, {iov_base="CODE_FILE=/app/phil/journal-test"..., iov_len=34}, {iov_base="\n", iov_len=1}, {iov_base="CODE_LINE=5", iov_len=11}, {iov_base="\n", iov_len=1}, {iov_base="CODE_FUNC=main", iov_len=14}, {iov_base="\n", iov_len=1}, {iov_base="SYSLOG_IDENTIFIER=", iov_len=18}, {iov_base="test", iov_len=4}, {iov_base="\n", iov_len=1}], msg_iovlen=13, msg_controllen=0, msg_flags=0}, MSG_NOSIGNAL) = -1 ENOENT (No such file or directory)
Comment 2 Philippe Normand 2020-03-18 09:08:50 PDT
Created attachment 393865 [details]
Patch
Comment 3 Philippe Normand 2020-03-18 09:24:42 PDT
Created attachment 393870 [details]
Patch
Comment 4 Aakash Jain 2020-03-18 14:30:27 PDT
Comment on attachment 393870 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=393870&action=review

> Tools/flatpak/flatpakutils.py:580
> +                           # systemd journal socket. So white-list everything in /run. ¯\_(ã)_/¯

Seems like unintentional characters here: ¯\_(ã)_/¯
breaks gtk api-tests. https://ews-build.webkit.org/#/builders/34/builds/5027/steps/10/logs/stdio
Comment 5 Patrick Griffis 2020-03-18 18:35:37 PDT
I think pulling in all of `/run` is quite scary when it comes to reproducability. I'd rather see specific paths but if the goal is to just get things working and tighten it down later maybe its fine.
Comment 6 Philippe Normand 2020-03-19 02:56:04 PDT
Created attachment 393959 [details]
Patch
Comment 7 Philippe Normand 2020-03-19 03:02:31 PDT
(In reply to Patrick Griffis from comment #5)
> I think pulling in all of `/run` is quite scary when it comes to
> reproducability. I'd rather see specific paths but if the goal is to just
> get things working and tighten it down later maybe its fine.

Would you support adding a --socket=journal option to `flatpak build`?
Comment 8 Adrian Perez 2020-03-19 03:22:14 PDT
Comment on attachment 393959 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=393959&action=review

> Tools/flatpak/flatpakutils.py:581
> +                           "--bind-mount=/run=/run",

Wouldn't it be enough to bind-mount only /run/systemd/journal?
I think that would be better than using the big hammer.
Comment 9 Philippe Normand 2020-03-19 03:55:03 PDT
Created attachment 393962 [details]
Patch
Comment 10 Carlos Alberto Lopez Perez 2020-03-19 07:50:31 PDT
Comment on attachment 393962 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=393962&action=review

> Tools/flatpak/flatpakutils.py:-579
> -                           # Workaround for https://webkit.org/b/187384 to have our own perl modules usable inside the sandbox
> -                           # as setting the PERL5LIB envvar won't work inside apache (and for scripts using `perl -T``).
> -                           "--bind-mount=/run/host/%s=%s" % (tempfile.gettempdir(), tempfile.gettempdir()),

the crash log code assumes /run/host its there, if you delete this you have to adapt that. grep for /run/host on Tools

> Tools/flatpak/flatpakutils.py:583
> +                           "--bind-mount=/run/systemd/journal=/run/systemd/journal",

I wonder about ICECC support. Doesn't it need to access /run/icecc/iceccd.socket from the host?
Comment 11 Philippe Normand 2020-03-19 07:56:18 PDT
Comment on attachment 393962 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=393962&action=review

>> Tools/flatpak/flatpakutils.py:-579
>> -                           "--bind-mount=/run/host/%s=%s" % (tempfile.gettempdir(), tempfile.gettempdir()),
> 
> the crash log code assumes /run/host its there, if you delete this you have to adapt that. grep for /run/host on Tools

Gotcha

>> Tools/flatpak/flatpakutils.py:583
>> +                           "--bind-mount=/run/systemd/journal=/run/systemd/journal",
> 
> I wonder about ICECC support. Doesn't it need to access /run/icecc/iceccd.socket from the host?

Access to the socket is already granted, you can check in this method a few lines below :)
Comment 12 Philippe Normand 2020-03-19 07:57:26 PDT
Created attachment 393977 [details]
Patch
Comment 13 Philippe Normand 2020-03-19 08:25:11 PDT
Committed r258699: <https://trac.webkit.org/changeset/258699>