Bug 521013 - kwin_wayland_wrapper leaks ambient capabilities (CAP_SYS_NICE) to child processes, breaking bwrap
Summary: kwin_wayland_wrapper leaks ambient capabilities (CAP_SYS_NICE) to child proce...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (other bugs)
Version First Reported In: 6.6.5
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-06-03 17:19 UTC by adam
Modified: 2026-06-11 15:38 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 6.6.6
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description adam 2026-06-03 17:19:50 UTC
DESCRIPTION
When running KWin as a standalone Wayland compositor via kwin_wayland_wrapper, KWin is leaking its ambient capabilities (specifically CAP_SYS_NICE) down to the child processes it spawns.

This creates a critical environment breakage for unprivileged sandboxing tools like Bubblewrap (bwrap), which instantly terminate when they detect unexpected high-level ambient capabilities.

STEPS TO REPRODUCE

Launch a minimal Wayland session from a TTY using the wrapper:
/usr/bin/kwin_wayland_wrapper --xwayland 'es-de --no-splash'

Attempt to launch any application from within that session that relies on bwrap (e.g., Proton, umu-launcher, or Steam Linux Runtime).

The child process instantly crashes.

OBSERVED RESULT
Capturing the stderr from the crashed child process reveals:
pressure-vessel-wrap[772]: E: Child process exited with code 1: bwrap: Unexpected capabilities but not setuid, old file caps config?

EXPECTED RESULT
Child processes spawned by the wrapper should inherit a clean, unprivileged environment without KWin's elevated ambient capabilities.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 6.6.5
KDE Frameworks Version: 6.26.0
Qt Version: 6.11.1

ADDITIONAL INFORMATION
Workaround Proof:
If I manually strip the ambient capabilities before executing the frontend, the environment is sanitised and all bwrap containers launch perfectly:
/usr/bin/kwin_wayland_wrapper --xwayland 'setpriv --ambient-caps="-all" es-de --no-splash'

Testing Context:
This was reproduced on a completely re-imaged, fresh, bare-metal installation to strictly rule out local system state corruption.
Comment 1 Bug Janitor Service 2026-06-08 09:02:58 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/9346
Comment 2 Vlad Zahorodnii 2026-06-08 10:39:40 UTC
Git commit 95394f6399963e167ec88d1083475eca5818900e by Vlad Zahorodnii.
Committed on 08/06/2026 at 08:42.
Pushed by vladz into branch 'master'.

Lower ambient CAP_SYS_NICE

To avoid leaking it to child processes.

M  +11   -0    src/main_wayland.cpp

https://invent.kde.org/plasma/kwin/-/commit/95394f6399963e167ec88d1083475eca5818900e
Comment 3 Vlad Zahorodnii 2026-06-08 12:30:25 UTC
Git commit db76e66fb97713aaecec4a6b03eb00c24d60dad0 by Vlad Zahorodnii.
Committed on 08/06/2026 at 10:42.
Pushed by vladz into branch 'Plasma/6.7'.

Lower ambient CAP_SYS_NICE

To avoid leaking it to child processes.


(cherry picked from commit 95394f6399963e167ec88d1083475eca5818900e)

Co-authored-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>

M  +11   -0    src/main_wayland.cpp

https://invent.kde.org/plasma/kwin/-/commit/db76e66fb97713aaecec4a6b03eb00c24d60dad0
Comment 4 Vlad Zahorodnii 2026-06-09 13:19:19 UTC
Git commit 2f4b8c8a1303139f6985823d9ec72ff84f23b916 by Vlad Zahorodnii.
Committed on 09/06/2026 at 12:53.
Pushed by vladz into branch 'Plasma/6.6'.

Lower ambient CAP_SYS_NICE

To avoid leaking it to child processes.


(cherry picked from commit 95394f6399963e167ec88d1083475eca5818900e)

Co-authored-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>

M  +11   -0    src/main_wayland.cpp

https://invent.kde.org/plasma/kwin/-/commit/2f4b8c8a1303139f6985823d9ec72ff84f23b916