Package: flatpak
Version: 1.16.6-1~deb13u3
Severity: important
Tags: patch trixie

Dear Maintainer,

since the security backport for GHSA-w69g-9x8j-7p8f (1.16.6-1~deb13u2,
d/p/GHSA-w69g-9x8j-7p8f/run-Use-RESOLVE_BENEATH-for-host-side-extension-file-acce.patch)
`flatpak run` sometimes fails right at the start of a desktop session with:

error: Extension org.freedesktop.Platform.GL.default has invalid merge-dirs

The app is not started. Running the very same command again a bit later
works fine. Nothing in the installation changes between a failing and a
working run.

* System

- Debian 13 (trixie), aarch64 (Raspberry Pi 4), kernel 6.18.60+rpt-rpi-v8
  - flatpak 1.16.6-1~deb13u3 (system installation)
  - App: io.github.qtox.qTox 1.18.6, runtime org.kde.Platform 6.10
  - Extension: org.freedesktop.Platform.GL.default, branches 25.08 and
    25.08-extra
  - XFCE session with LightDM autologin; the app is started from
~/.config/autostart/*.desktop with `Exec=flatpak run io.github.qtox.qTox` - The machine reboots daily at 04:00, so the app is autostarted once a day

* Observed frequency

  The autostart failed on 2 of the last 7 boots (2026-11-27 and
  2026-11-29); on the other 5 boots the app started normally. On
  2026-11-29 the error above is in ~/.xsession-errors; a manual start of
  the same command later that day succeeded.

* Analysis

  The message comes from the backported hunk in
  flatpak_run_add_extension_args() (common/flatpak-run.c):

      source_dfd = glnx_chaseat (files_dfd, ext->merge_dirs[i],
                                 GLNX_CHASE_RESOLVE_BENEATH |
                                 GLNX_CHASE_MUST_BE_DIRECTORY, NULL);
      if (source_dfd < 0)
        {
          if (errno == ENOENT || errno == ENOTDIR)
            continue;
          return flatpak_fail_error (error, FLATPAK_ERROR,
"Extension %s has invalid merge-dirs", ...);
        }

  glnx_chaseat() in the bundled subprojects/libglnx/glnx-chase.c calls
  openat2() with RESOLVE_BENEATH and treats every error except
  ENOSYS/EPERM as fatal. openat2(2) documents that with RESOLVE_BENEATH
it may return EAGAIN if a rename or mount happened concurrently while a
  ".." component was being resolved, and that the caller may retry.

  The GL extension does contain such ".." symlinks inside merge-dirs,
  e.g. in both branches:

      vulkan/icd.d            -> ../lib/vulkan/icd.d
      vulkan/explicit_layer.d -> ../share/vulkan/explicit_layer.d
      vulkan/implicit_layer.d -> ../share/vulkan/implicit_layer.d

  At session start several mounts happen at the same time (for example
  the document portal FUSE mount /run/user/1000/doc is set up by
  xdg-document-portal, which is activated by this very `flatpak run`),
so a spurious EAGAIN is plausible. I could not capture the actual errno
  (flatpak does not log it), but EAGAIN is the only error in this code
  path that is transient; all other ones would make every start fail.

* Upstream fix

  libglnx already fixed this:

      commit eef7f14c344723cb20bebd04dcc79be77363c3be
      "chase: Handle EAGAIN from openat2" (2026-08-18)
https://gitlab.gnome.org/GNOME/libglnx/-/commit/eef7f14c344723cb20bebd04dcc79be77363c3be

  It simply retries openat2() while it returns EAGAIN. This commit is
  not in 1.16.6-1~deb13u3, and judging by debian/patches/series it is
  not in 1.16.6-1~deb13u4 either.

* Request

  Please consider adding this libglnx commit to the next trixie update
  of flatpak, next to the already backported
  d/p/libglnx/chase-*.patch.

* Workaround

  Delaying the autostart and retrying once, e.g.

Exec=sh -c "sleep 15; flatpak run io.github.qtox.qTox || { sleep 30; flatpak run io.github.qtox.qTox; }"

Thank you!

Reply via email to