patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: devel@spectrum-os.org
Subject: [PATCH 10/13] img/app: pipewire: run as non-root
Date: Wed, 26 Nov 2025 22:34:03 +0100	[thread overview]
Message-ID: <20251126213407.1773744-10-hi@alyssa.is> (raw)
In-Reply-To: <20251126213407.1773744-1-hi@alyssa.is>

Set the real-time scheduling priority hard limit globally at boot, as
recommended by the s6-softlimit documentation.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
 img/app/image/etc/group              | 1 +
 img/app/image/etc/mdev.conf          | 4 +++-
 img/app/image/etc/passwd             | 1 +
 img/app/image/etc/s6-rc/pipewire/run | 4 ++++
 img/app/image/usr/bin/init           | 4 +++-
 5 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/img/app/image/etc/group b/img/app/image/etc/group
index 5eafb82..0bf6579 100644
--- a/img/app/image/etc/group
+++ b/img/app/image/etc/group
@@ -1,2 +1,3 @@
 wayland:x:1:wayland
 wireplumber:x:2:wireplumber
+pipewire:x:3:pipewire
diff --git a/img/app/image/etc/mdev.conf b/img/app/image/etc/mdev.conf
index b7c0c5b..d4cd825 100644
--- a/img/app/image/etc/mdev.conf
+++ b/img/app/image/etc/mdev.conf
@@ -5,7 +5,9 @@
 $INTERFACE=.* 0:0 0 ! +/etc/mdev/iface
 $MODALIAS=virtio:d0000001Av.* 0:0 0 ! +/etc/mdev/virtiofs
 dri/card0 wayland:wayland 660 +background { /etc/mdev/listen card0 }
-snd/controlC0 0:0 660 +background { /etc/mdev/listen controlC0 }
+
+-SUBSYSTEM=sound;.* pipewire:pipewire 660
+snd/controlC0 pipewire:pipewire 660 +background { /etc/mdev/listen controlC0 }
 
 # Don't change mode of other device nodes created by devtmpfs.
 .* 0:0 0 !
diff --git a/img/app/image/etc/passwd b/img/app/image/etc/passwd
index 5557240..631554c 100644
--- a/img/app/image/etc/passwd
+++ b/img/app/image/etc/passwd
@@ -1,3 +1,4 @@
 root:x:0:0:System administrator:/run/root:/bin/sh
 wayland:x:1:1:wayland-proxy-virtwl service user:/:/usr/bin/nologin
 wireplumber:x:2:2:WirePlumber service user:/:/usr/bin/nologin
+pipewire:x:3:3:PipeWire service user:/:/usr/bin/nologin
diff --git a/img/app/image/etc/s6-rc/pipewire/run b/img/app/image/etc/s6-rc/pipewire/run
index afaada1..3925f08 100644
--- a/img/app/image/etc/s6-rc/pipewire/run
+++ b/img/app/image/etc/s6-rc/pipewire/run
@@ -27,6 +27,10 @@ fdclose 5
 # Wait for sound devices to be available
 if { /etc/mdev/wait controlC0 }
 
+nice -n -11
+s6-softlimit -P 88
+s6-setuidgid pipewire
+
 export LISTEN_FDS 2
 getpid LISTEN_PID
 pipewire
diff --git a/img/app/image/usr/bin/init b/img/app/image/usr/bin/init
index 6424e22..aca6efa 100755
--- a/img/app/image/usr/bin/init
+++ b/img/app/image/usr/bin/init
@@ -1,5 +1,7 @@
 #!/bin/execlineb -s0
 # SPDX-License-Identifier: EUPL-1.2+
-# SPDX-FileCopyrightText: 2022 Alyssa Ross <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2022, 2025 Alyssa Ross <hi@alyssa.is>
+
+/bin/s6-softlimit -HP 88
 
 /bin/s6-linux-init -Bc /etc/s6-linux-init -- $@
-- 
2.51.0


  parent reply	other threads:[~2025-11-26 21:34 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-26 21:33 [PATCH 01/13] pkgs: gtk3: backport fix for unset XDG_RUNTIME_DIR Alyssa Ross
2025-11-26 21:33 ` [PATCH 02/13] pkgs: s6: backport s6-softlimit -P Alyssa Ross
2025-12-02 12:30   ` Alyssa Ross
2025-11-26 21:33 ` [PATCH 03/13] img/app: wayland-proxy-virtwl: move Wayland socket Alyssa Ross
2025-12-02 12:30   ` Alyssa Ross
2025-11-26 21:33 ` [PATCH 04/13] img/app: wayland-proxy-virtwl: run as non-root Alyssa Ross
2025-12-02 12:30   ` Alyssa Ross
2025-11-26 21:33 ` [PATCH 05/13] img/app: pipewire: move sockets out of XDG_RUNTIME_DIR Alyssa Ross
2025-12-02 12:30   ` Alyssa Ross
2025-11-26 21:33 ` [PATCH 06/13] img/app: remove XDG_RUNTIME_DIR Alyssa Ross
2025-12-01  5:55   ` Demi Marie Obenour
2025-12-01 11:24     ` Alyssa Ross
2025-12-01 19:05       ` Demi Marie Obenour
2025-12-02 12:30   ` Alyssa Ross
2025-11-26 21:34 ` [PATCH 07/13] img/app: wireplumber: run as non-root Alyssa Ross
2025-12-02 12:30   ` Alyssa Ross
2025-11-26 21:34 ` [PATCH 08/13] img/app: pipewire: disable D-Bus Alyssa Ross
2025-12-02 12:30   ` Alyssa Ross
2025-11-26 21:34 ` [PATCH 09/13] img/app: pipewire: stop fighting s6 over lockfiles Alyssa Ross
2025-12-02 12:30   ` Alyssa Ross
2025-11-26 21:34 ` Alyssa Ross [this message]
2025-12-02 12:30   ` [PATCH 10/13] img/app: pipewire: run as non-root Alyssa Ross
2025-11-26 21:34 ` [PATCH 11/13] img/app: dbus: create socket outside daemon Alyssa Ross
2025-12-02 12:30   ` Alyssa Ross
2025-11-26 21:34 ` [PATCH 12/13] img/app: add application user Alyssa Ross
2025-12-02 12:30   ` Alyssa Ross
2025-11-26 21:34 ` [PATCH 13/13] img/app: run applications as non-root Alyssa Ross
2025-12-01  5:58   ` Demi Marie Obenour
2025-12-01 11:31     ` Alyssa Ross
2025-12-02 12:30   ` Alyssa Ross
2025-12-02 12:30 ` [PATCH 01/13] pkgs: gtk3: backport fix for unset XDG_RUNTIME_DIR Alyssa Ross

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=20251126213407.1773744-10-hi@alyssa.is \
    --to=hi@alyssa.is \
    --cc=devel@spectrum-os.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 public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).