diff options
| author | Sairamreddy Bojja <sbojja@qti.qualcomm.com> | 2026-03-09 14:23:56 +0530 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2026-03-17 13:25:17 -0700 |
| commit | 39318cebcbc2896e568b9ed108febbd623a4b664 (patch) | |
| tree | 3a019dc3893dba28f87a3a6493d912cc08894671 | |
| parent | 19af995bc185735d5d880682ce057599fd0698dc (diff) | |
| download | meta-openembedded-39318cebcbc2896e568b9ed108febbd623a4b664.tar.gz | |
pipewire: Fix socket activation
Backport an upstream PipeWire fix into meta-multimedia to correct
UNIX socket path comparison in is_socket_unix() and to preserve
LISTEN_FDS when using sd_listen_fds().
The previous behavior could mis-detect valid systemd-activated sockets
and break subsequent invocations because LISTEN_FDS was unset, even
though the code path can be executed more than once.
Link: https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/f4e174870eb8cbe60c922d3bf181f3eb2347523c
Signed-off-by: Sairamreddy Bojja <sbojja@qti.qualcomm.com>
Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-multimedia/recipes-multimedia/pipewire/pipewire/0001-module-protocol-native-Fix-socket-activation.patch | 86 | ||||
| -rw-r--r-- | meta-multimedia/recipes-multimedia/pipewire/pipewire_1.6.0.bb | 2 |
2 files changed, 87 insertions, 1 deletions
diff --git a/meta-multimedia/recipes-multimedia/pipewire/pipewire/0001-module-protocol-native-Fix-socket-activation.patch b/meta-multimedia/recipes-multimedia/pipewire/pipewire/0001-module-protocol-native-Fix-socket-activation.patch new file mode 100644 index 0000000000..c345067932 --- /dev/null +++ b/meta-multimedia/recipes-multimedia/pipewire/pipewire/0001-module-protocol-native-Fix-socket-activation.patch | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | From f4e174870eb8cbe60c922d3bf181f3eb2347523c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jonas Holmberg <jonashg@axis.com> | ||
| 3 | Date: Mon, 2 Mar 2026 10:28:26 +0100 | ||
| 4 | Subject: [PATCH] module-protocol-native: Fix socket activation | ||
| 5 | |||
| 6 | Fix path comparison in is_socket_unix() and don't unset LISTEN_FDS since | ||
| 7 | the function that uses it is called more than once and it was not unset | ||
| 8 | when sd_listen_fds() was used. | ||
| 9 | |||
| 10 | Fixes #5140 | ||
| 11 | Upstream-Status: Backport | ||
| 12 | [https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/f4e174870eb8cbe60c922d3bf181f3eb2347523c] | ||
| 13 | --- | ||
| 14 | src/modules/module-protocol-native.c | 2 +- | ||
| 15 | src/modules/module-protocol-pulse/server.c | 2 +- | ||
| 16 | src/modules/network-utils.h | 14 +++++--------- | ||
| 17 | 3 files changed, 7 insertions(+), 11 deletions(-) | ||
| 18 | |||
| 19 | diff --git a/src/modules/module-protocol-native.c b/src/modules/module-protocol-native.c | ||
| 20 | index 2be92a847..98a43829b 100644 | ||
| 21 | --- a/src/modules/module-protocol-native.c | ||
| 22 | +++ b/src/modules/module-protocol-native.c | ||
| 23 | @@ -907,7 +907,7 @@ static int add_socket(struct pw_protocol *protocol, struct server *s, struct soc | ||
| 24 | bool activated = false; | ||
| 25 | |||
| 26 | { | ||
| 27 | - int i, n = listen_fd(); | ||
| 28 | + int i, n = listen_fds(); | ||
| 29 | for (i = 0; i < n; ++i) { | ||
| 30 | if (is_socket_unix(LISTEN_FDS_START + i, SOCK_STREAM, | ||
| 31 | s->addr.sun_path) > 0) { | ||
| 32 | diff --git a/src/modules/module-protocol-pulse/server.c b/src/modules/module-protocol-pulse/server.c | ||
| 33 | index aeab710b0..637757dfd 100644 | ||
| 34 | --- a/src/modules/module-protocol-pulse/server.c | ||
| 35 | +++ b/src/modules/module-protocol-pulse/server.c | ||
| 36 | @@ -576,7 +576,7 @@ static bool is_stale_socket(int fd, const struct sockaddr_un *addr_un) | ||
| 37 | |||
| 38 | static int check_socket_activation(const char *path) | ||
| 39 | { | ||
| 40 | - const int n = listen_fd(); | ||
| 41 | + const int n = listen_fds(); | ||
| 42 | |||
| 43 | for (int i = 0; i < n; i++) { | ||
| 44 | const int fd = LISTEN_FDS_START + i; | ||
| 45 | diff --git a/src/modules/network-utils.h b/src/modules/network-utils.h | ||
| 46 | index a89b7d3bd..6ff80dd7a 100644 | ||
| 47 | --- a/src/modules/network-utils.h | ||
| 48 | +++ b/src/modules/network-utils.h | ||
| 49 | @@ -143,7 +143,7 @@ static inline bool pw_net_addr_is_any(struct sockaddr_storage *addr) | ||
| 50 | |||
| 51 | /* Returns the number of file descriptors passed for socket activation. | ||
| 52 | * Returns 0 if none, -1 on error. */ | ||
| 53 | -static inline int listen_fd(void) | ||
| 54 | +static inline int listen_fds(void) | ||
| 55 | { | ||
| 56 | uint32_t n; | ||
| 57 | int i, flags; | ||
| 58 | @@ -161,8 +161,6 @@ static inline int listen_fd(void) | ||
| 59 | return -1; | ||
| 60 | } | ||
| 61 | |||
| 62 | - unsetenv("LISTEN_FDS"); | ||
| 63 | - | ||
| 64 | return (int)n; | ||
| 65 | } | ||
| 66 | |||
| 67 | @@ -192,12 +190,10 @@ static inline int is_socket_unix(int fd, int type, const char *path) | ||
| 68 | if (addr.sun_family != AF_UNIX) | ||
| 69 | return 0; | ||
| 70 | size_t length = strlen(path); | ||
| 71 | - if (length > 0) { | ||
| 72 | - if (len < offsetof(struct sockaddr_un, sun_path) + length) | ||
| 73 | - return 0; | ||
| 74 | - if (memcmp(addr.sun_path, path, length) != 0) | ||
| 75 | - return 0; | ||
| 76 | - } | ||
| 77 | + if (len < offsetof(struct sockaddr_un, sun_path) + length + 1) | ||
| 78 | + return 0; | ||
| 79 | + if (memcmp(addr.sun_path, path, length + 1) != 0) | ||
| 80 | + return 0; | ||
| 81 | } | ||
| 82 | |||
| 83 | return 1; | ||
| 84 | -- | ||
| 85 | 2.34.1 | ||
| 86 | |||
diff --git a/meta-multimedia/recipes-multimedia/pipewire/pipewire_1.6.0.bb b/meta-multimedia/recipes-multimedia/pipewire/pipewire_1.6.0.bb index 444b3bd633..8a33e7f425 100644 --- a/meta-multimedia/recipes-multimedia/pipewire/pipewire_1.6.0.bb +++ b/meta-multimedia/recipes-multimedia/pipewire/pipewire_1.6.0.bb | |||
| @@ -16,7 +16,7 @@ SRCREV = "700cea78dbe7564131d51b21a7795e2567ee048a" | |||
| 16 | BRANCH = "${@oe.utils.trim_version('${PV}', 2)}" | 16 | BRANCH = "${@oe.utils.trim_version('${PV}', 2)}" |
| 17 | SRC_URI = "git://gitlab.freedesktop.org/pipewire/pipewire.git;branch=${BRANCH};protocol=https;tag=${PV} \ | 17 | SRC_URI = "git://gitlab.freedesktop.org/pipewire/pipewire.git;branch=${BRANCH};protocol=https;tag=${PV} \ |
| 18 | file://0001-treewide-fix-some-Wdiscarded-qualifiers.patch \ | 18 | file://0001-treewide-fix-some-Wdiscarded-qualifiers.patch \ |
| 19 | " | 19 | file://0001-module-protocol-native-Fix-socket-activation.patch" |
| 20 | 20 | ||
| 21 | inherit meson pkgconfig systemd gettext useradd | 21 | inherit meson pkgconfig systemd gettext useradd |
| 22 | 22 | ||
