From 752d6256e5204b958b0ef7905675a940b5e9172f Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Thu, 12 May 2022 16:42:50 +0300 Subject: gentoo resync : 12.05.2022 --- .../pipewire/files/99-pipewire-default-hook.conf | 17 ++ .../pipewire-0.3.43-systemd-user-unit-dir.patch | 30 ---- .../files/pipewire-0.3.44-musl-build.patch | 33 ---- ...7-pulse-server-pending-sample-reply-crash.patch | 101 ----------- ....3.47-revert-loop-remove-destroy-list-mpd.patch | 187 --------------------- .../pipewire/files/pipewire-0.3.49-x86-cast.patch | 20 +++ ...pewire-0.3.50-treewide-retain-sections-to.patch | 70 ++++++++ 7 files changed, 107 insertions(+), 351 deletions(-) create mode 100644 media-video/pipewire/files/99-pipewire-default-hook.conf delete mode 100644 media-video/pipewire/files/pipewire-0.3.43-systemd-user-unit-dir.patch delete mode 100644 media-video/pipewire/files/pipewire-0.3.44-musl-build.patch delete mode 100644 media-video/pipewire/files/pipewire-0.3.47-pulse-server-pending-sample-reply-crash.patch delete mode 100644 media-video/pipewire/files/pipewire-0.3.47-revert-loop-remove-destroy-list-mpd.patch create mode 100644 media-video/pipewire/files/pipewire-0.3.49-x86-cast.patch create mode 100644 media-video/pipewire/files/pipewire-0.3.50-treewide-retain-sections-to.patch (limited to 'media-video/pipewire/files') diff --git a/media-video/pipewire/files/99-pipewire-default-hook.conf b/media-video/pipewire/files/99-pipewire-default-hook.conf new file mode 100644 index 000000000000..7145accea809 --- /dev/null +++ b/media-video/pipewire/files/99-pipewire-default-hook.conf @@ -0,0 +1,17 @@ +# Load pipewire configuration at conf hook processing time. This allows to +# override pulseaudio defaults configuration which is also applied via hook. +# +# Note since hooks are run after @GENTOO_PORTAGE_EPREFIX@/etc/asound.conf and ~/.asoundrc are applied, +# we load these again here make sure that user configuration takes precedence. + +@hooks [ + { + func load + files [ + "@GENTOO_PORTAGE_EPREFIX@/usr/share/alsa/alsa.conf.d/99-pipewire-default.conf" + "@GENTOO_PORTAGE_EPREFIX@/etc/asound.conf" + "~/.asoundrc" + ] + errors false + } +] diff --git a/media-video/pipewire/files/pipewire-0.3.43-systemd-user-unit-dir.patch b/media-video/pipewire/files/pipewire-0.3.43-systemd-user-unit-dir.patch deleted file mode 100644 index 93c3ffe3e053..000000000000 --- a/media-video/pipewire/files/pipewire-0.3.43-systemd-user-unit-dir.patch +++ /dev/null @@ -1,30 +0,0 @@ -https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/814d409501aca3e044ad53063eb3f433b8aff6f9.patch - -From 814d409501aca3e044ad53063eb3f433b8aff6f9 Mon Sep 17 00:00:00 2001 -From: Timo Gurr -Date: Thu, 6 Jan 2022 12:17:10 +0000 -Subject: [PATCH] systemd: Add systemd-system-unit-dir override - ---- a/meson_options.txt -+++ b/meson_options.txt -@@ -179,6 +179,9 @@ option('udev', - option('udevrulesdir', - type : 'string', - description : 'Directory for udev rules (defaults to /lib/udev/rules.d)') -+option('systemd-system-unit-dir', -+ type : 'string', -+ description : 'Directory for system systemd units (defaults to /usr/lib/systemd/system)') - option('systemd-user-unit-dir', - type : 'string', - description : 'Directory for user systemd units (defaults to /usr/lib/systemd/user)') ---- a/src/daemon/systemd/system/meson.build -+++ b/src/daemon/systemd/system/meson.build -@@ -1,4 +1,7 @@ - systemd_system_services_dir = systemd.get_variable(pkgconfig: 'systemdsystemunitdir', pkgconfig_define : [ 'rootprefix', prefix]) -+if get_option('systemd-system-unit-dir') != '' -+ systemd_system_services_dir = get_option('systemd-system-unit-dir') -+endif - - install_data(sources : 'pipewire.socket', - install_dir : systemd_system_services_dir) -GitLab diff --git a/media-video/pipewire/files/pipewire-0.3.44-musl-build.patch b/media-video/pipewire/files/pipewire-0.3.44-musl-build.patch deleted file mode 100644 index 6ebcc5db8feb..000000000000 --- a/media-video/pipewire/files/pipewire-0.3.44-musl-build.patch +++ /dev/null @@ -1,33 +0,0 @@ -https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/3256c6e5e7e2cef1f765dc05a001114359cc3134 - -From: Wim Taymans -Date: Thu, 27 Jan 2022 14:59:11 +0100 -Subject: [PATCH] tools: fix compilation with musl - ---- a/src/tools/pw-cli.c -+++ b/src/tools/pw-cli.c -@@ -36,6 +36,10 @@ - #include - #include - -+#if !defined(FNM_EXTMATCH) -+#define FNM_EXTMATCH 0 -+#endif -+ - #define spa_debug(...) fprintf(stdout,__VA_ARGS__);fputc('\n', stdout) - - #include ---- a/src/tools/pw-dump.c -+++ b/src/tools/pw-dump.c -@@ -32,6 +32,10 @@ - #include - #include - -+#if !defined(FNM_EXTMATCH) -+#define FNM_EXTMATCH 0 -+#endif -+ - #include - #include - #include -GitLab diff --git a/media-video/pipewire/files/pipewire-0.3.47-pulse-server-pending-sample-reply-crash.patch b/media-video/pipewire/files/pipewire-0.3.47-pulse-server-pending-sample-reply-crash.patch deleted file mode 100644 index d4f74a5abcc5..000000000000 --- a/media-video/pipewire/files/pipewire-0.3.47-pulse-server-pending-sample-reply-crash.patch +++ /dev/null @@ -1,101 +0,0 @@ -https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/d7793501fd012de37fcc8bf09003c60bc4624341.patch - -From d7793501fd012de37fcc8bf09003c60bc4624341 Mon Sep 17 00:00:00 2001 -From: Wim Taymans -Date: Sun, 20 Feb 2022 21:34:53 +0100 -Subject: [PATCH] pulse-server: free pending sample reply - -If the sample finished playing before we finished the roundtrip to -get the sink_index, it will be destroyed. When the roundtrip completes, -it will try to use invalid memoryy and crash. - -Make sure we destroy all pending replies before destroying the sample -to avoid this problem. - -Fixes #2151 ---- - src/modules/module-protocol-pulse/operation.c | 10 ++++++++++ - src/modules/module-protocol-pulse/operation.h | 1 + - src/modules/module-protocol-pulse/pending-sample.c | 5 +++++ - src/modules/module-protocol-pulse/pulse-server.c | 4 ++++ - 4 files changed, 20 insertions(+) - -diff --git a/src/modules/module-protocol-pulse/operation.c b/src/modules/module-protocol-pulse/operation.c -index e0e67b374..b1e0eb08d 100644 ---- a/src/modules/module-protocol-pulse/operation.c -+++ b/src/modules/module-protocol-pulse/operation.c -@@ -66,6 +66,16 @@ void operation_free(struct operation *o) - free(o); - } - -+struct operation *operation_find(struct client *client, uint32_t tag) -+{ -+ struct operation *o; -+ spa_list_for_each(o, &client->operations, link) { -+ if (o->tag == tag) -+ return o; -+ } -+ return NULL; -+} -+ - void operation_complete(struct operation *o) - { - struct client *client = o->client; -diff --git a/src/modules/module-protocol-pulse/operation.h b/src/modules/module-protocol-pulse/operation.h -index d282ee5e5..1fa07cc7b 100644 ---- a/src/modules/module-protocol-pulse/operation.h -+++ b/src/modules/module-protocol-pulse/operation.h -@@ -43,6 +43,7 @@ int operation_new(struct client *client, uint32_t tag); - int operation_new_cb(struct client *client, uint32_t tag, - void (*callback) (void *data, struct client *client, uint32_t tag), - void *data); -+struct operation *operation_find(struct client *client, uint32_t tag); - void operation_free(struct operation *o); - void operation_complete(struct operation *o); - -diff --git a/src/modules/module-protocol-pulse/pending-sample.c b/src/modules/module-protocol-pulse/pending-sample.c -index 6e5d04fbb..399fc3b54 100644 ---- a/src/modules/module-protocol-pulse/pending-sample.c -+++ b/src/modules/module-protocol-pulse/pending-sample.c -@@ -29,6 +29,7 @@ - #include "client.h" - #include "internal.h" - #include "log.h" -+#include "operation.h" - #include "pending-sample.h" - #include "sample-play.h" - -@@ -36,10 +37,14 @@ void pending_sample_free(struct pending_sample *ps) - { - struct client * const client = ps->client; - struct impl * const impl = client->impl; -+ struct operation *o; - - spa_list_remove(&ps->link); - spa_hook_remove(&ps->listener); - pw_work_queue_cancel(impl->work_queue, ps, SPA_ID_INVALID); - -+ if ((o = operation_find(client, ps->tag)) != NULL) -+ operation_free(o); -+ - sample_play_destroy(ps->play); - } -diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c -index 182c3db99..c035840d1 100644 ---- a/src/modules/module-protocol-pulse/pulse-server.c -+++ b/src/modules/module-protocol-pulse/pulse-server.c -@@ -2353,6 +2353,10 @@ static void on_sample_done(void *obj, void *data, int res, uint32_t id) - { - struct pending_sample *ps = obj; - struct client *client = ps->client; -+ struct operation *o; -+ -+ if ((o = operation_find(client, ps->tag)) != NULL) -+ operation_complete(o); - - pending_sample_free(ps); - client_unref(client); --- -GitLab - - diff --git a/media-video/pipewire/files/pipewire-0.3.47-revert-loop-remove-destroy-list-mpd.patch b/media-video/pipewire/files/pipewire-0.3.47-revert-loop-remove-destroy-list-mpd.patch deleted file mode 100644 index 0e27d65fdb3a..000000000000 --- a/media-video/pipewire/files/pipewire-0.3.47-revert-loop-remove-destroy-list-mpd.patch +++ /dev/null @@ -1,187 +0,0 @@ -Fixes mpd crash. - -https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/16f63a3c8fa227625bade5a9edea22354b347d18.patch -https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/d1f7e96f821089224ddcacf8e8f506f99c54eb5c.patch - -From 16f63a3c8fa227625bade5a9edea22354b347d18 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= -Date: Fri, 18 Feb 2022 18:36:36 +0100 -Subject: [PATCH] Revert "loop: remove destroy list" - -This reverts commit c474846c42967c44db069a23b76a29da6f496f33. -In addition, `s->loop` is also checked before dispatching a source. - -The destroy list is needed in the presence of threads. The -issue is that a source may be destroyed between `epoll_wait()` -returning and thread loop lock being acquired. If this -source is active, then a use-after-free will be triggered -when the thread loop acquires the lock and starts dispatching -the sources. - - thread 1 thread 2 - ---------- ---------- - loop_iterate - spa_loop_control_hook_before - // release lock - - pw_thread_loop_lock - - spa_system_pollfd_wait - // assume it returns with source A - - pw_loop_destroy_source(..., A) - // frees storage of A - - pw_thread_loop_unlock - spa_loop_control_hook_after - // acquire the lock - - for (...) { - struct spa_source *s = ep[i].data; - s->rmask = ep[i].events; - // use-after-free if `s` refers to - // the previously freed `A` - -Fixes #2147 ---- - spa/plugins/support/loop.c | 19 +++++++++++++++++-- - 1 file changed, 17 insertions(+), 2 deletions(-) - -diff --git a/spa/plugins/support/loop.c b/spa/plugins/support/loop.c -index 0588ce770..04739eb2a 100644 ---- a/spa/plugins/support/loop.c -+++ b/spa/plugins/support/loop.c -@@ -75,6 +75,7 @@ struct impl { - struct spa_system *system; - - struct spa_list source_list; -+ struct spa_list destroy_list; - struct spa_hook_list hooks_list; - - int poll_fd; -@@ -325,6 +326,14 @@ static void loop_leave(void *object) - impl->thread = 0; - } - -+static inline void process_destroy(struct impl *impl) -+{ -+ struct source_impl *source, *tmp; -+ spa_list_for_each_safe(source, tmp, &impl->destroy_list, link) -+ free(source); -+ spa_list_init(&impl->destroy_list); -+} -+ - static int loop_iterate(void *object, int timeout) - { - struct impl *impl = object; -@@ -354,11 +363,14 @@ static int loop_iterate(void *object, int timeout) - } - for (i = 0; i < nfds; i++) { - struct spa_source *s = ep[i].data; -- if (SPA_LIKELY(s && s->rmask)) { -+ if (SPA_LIKELY(s && s->rmask && s->loop)) { - s->priv = NULL; - s->func(s); - } - } -+ if (SPA_UNLIKELY(!spa_list_is_empty(&impl->destroy_list))) -+ process_destroy(impl); -+ - return nfds; - } - -@@ -712,7 +724,7 @@ static void loop_destroy_source(void *object, struct spa_source *source) - spa_system_close(impl->impl->system, source->fd); - source->fd = -1; - } -- free(source); -+ spa_list_insert(&impl->impl->destroy_list, &impl->link); - } - - static const struct spa_loop_methods impl_loop = { -@@ -783,6 +795,8 @@ static int impl_clear(struct spa_handle *handle) - spa_list_consume(source, &impl->source_list, link) - loop_destroy_source(impl, &source->source); - -+ process_destroy(impl); -+ - spa_system_close(impl->system, impl->ack_fd); - spa_system_close(impl->system, impl->poll_fd); - -@@ -844,6 +858,7 @@ impl_init(const struct spa_handle_factory *factory, - impl->poll_fd = res; - - spa_list_init(&impl->source_list); -+ spa_list_init(&impl->destroy_list); - spa_hook_list_init(&impl->hooks_list); - - impl->buffer_data = SPA_PTR_ALIGN(impl->buffer_mem, MAX_ALIGN, uint8_t); --- -GitLab - - -From d1f7e96f821089224ddcacf8e8f506f99c54eb5c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= -Date: Fri, 18 Feb 2022 19:27:13 +0100 -Subject: [PATCH] test: loop: add test for destroying source of thread loop - -Add test which tries to destroy an active source precisely -after the loop has returned from polling but has not yet -acquired the thread loop lock. ---- - test/test-loop.c | 34 ++++++++++++++++++++++++++++++++++ - 1 file changed, 34 insertions(+) - -diff --git a/test/test-loop.c b/test/test-loop.c -index 98b2add09..81f7a117c 100644 ---- a/test/test-loop.c -+++ b/test/test-loop.c -@@ -227,11 +227,45 @@ PWTEST(pwtest_loop_recurse2) - return PWTEST_PASS; - } - -+PWTEST(thread_loop_destroy_between_poll_and_lock) -+{ -+ pw_init(NULL, NULL); -+ -+ struct pw_thread_loop *thread_loop = pw_thread_loop_new("uaf", NULL); -+ pwtest_ptr_notnull(thread_loop); -+ -+ struct pw_loop *loop = pw_thread_loop_get_loop(thread_loop); -+ pwtest_ptr_notnull(loop); -+ -+ int evfd = eventfd(0, 0); -+ pwtest_errno_ok(evfd); -+ -+ struct spa_source *source = pw_loop_add_io(loop, evfd, SPA_IO_IN, true, NULL, NULL); -+ pwtest_ptr_notnull(source); -+ -+ pw_thread_loop_start(thread_loop); -+ -+ pw_thread_loop_lock(thread_loop); -+ { -+ write(evfd, &(uint64_t){1}, sizeof(uint64_t)); -+ sleep(1); -+ pw_loop_destroy_source(loop, source); -+ } -+ pw_thread_loop_unlock(thread_loop); -+ -+ pw_thread_loop_destroy(thread_loop); -+ -+ pw_deinit(); -+ -+ return PWTEST_PASS; -+} -+ - PWTEST_SUITE(support) - { - pwtest_add(pwtest_loop_destroy2, PWTEST_NOARG); - pwtest_add(pwtest_loop_recurse1, PWTEST_NOARG); - pwtest_add(pwtest_loop_recurse2, PWTEST_NOARG); -+ pwtest_add(thread_loop_destroy_between_poll_and_lock, PWTEST_NOARG); - - return PWTEST_PASS; - } --- -GitLab - diff --git a/media-video/pipewire/files/pipewire-0.3.49-x86-cast.patch b/media-video/pipewire/files/pipewire-0.3.49-x86-cast.patch new file mode 100644 index 000000000000..58b4b331e03e --- /dev/null +++ b/media-video/pipewire/files/pipewire-0.3.49-x86-cast.patch @@ -0,0 +1,20 @@ +https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/5a023c8c84fb053d452983a64a33a41b931fc99b +https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2271 + +From: Wim Taymans +Date: Thu, 21 Apr 2022 22:12:38 +0200 +Subject: [PATCH] alsa: fix argument type for Long + +Fixes #2271 +--- a/spa/plugins/alsa/alsa-pcm.c ++++ b/spa/plugins/alsa/alsa-pcm.c +@@ -311,7 +311,7 @@ struct spa_pod *spa_alsa_enum_propinfo(struct state *state, + SPA_PROP_INFO_name, SPA_POD_String("latency.internal.ns"), + SPA_PROP_INFO_description, SPA_POD_String("Internal latency in nanoseconds"), + SPA_PROP_INFO_type, SPA_POD_CHOICE_RANGE_Long(state->process_latency.ns, +- 0, 2 * SPA_NSEC_PER_SEC), ++ 0LL, 2 * SPA_NSEC_PER_SEC), + SPA_PROP_INFO_params, SPA_POD_Bool(true)); + break; + case 15: +GitLab diff --git a/media-video/pipewire/files/pipewire-0.3.50-treewide-retain-sections-to.patch b/media-video/pipewire/files/pipewire-0.3.50-treewide-retain-sections-to.patch new file mode 100644 index 000000000000..1e1a8198ef26 --- /dev/null +++ b/media-video/pipewire/files/pipewire-0.3.50-treewide-retain-sections-to.patch @@ -0,0 +1,70 @@ +https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/e28a052105f8ef35b3f469d3b85e1fcb25106f26 + +From e28a052105f8ef35b3f469d3b85e1fcb25106f26 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= +Date: Wed, 13 Apr 2022 18:13:12 +0200 +Subject: [PATCH] treewide: retain sections to prevent linker garbage + collection + +The linker may remove sections that are actually used when +"--gc-sections" and "-z start-stop-gc" is set. Add the `retain` +attribute to prevent that. + +Furthermore, fix the alignment for `pwtest_suite_decl` objects. + +See: #2292 +See: https://lld.llvm.org/ELF/start-stop-gc.html +See: https://github.com/systemd/systemd/issues/21847 +See: https://github.com/systemd/systemd/pull/21855 +--- + src/modules/module-protocol-pulse/module.h | 1 + + test/pwtest-implementation.h | 2 +- + test/pwtest.h | 6 ++++-- + 3 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/src/modules/module-protocol-pulse/module.h b/src/modules/module-protocol-pulse/module.h +index c1153640e..f75d8786c 100644 +--- a/src/modules/module-protocol-pulse/module.h ++++ b/src/modules/module-protocol-pulse/module.h +@@ -47,6 +47,7 @@ struct module_info { + + #define DEFINE_MODULE_INFO(name) \ + __attribute__((used)) \ ++ __attribute__((retain)) \ + __attribute__((section("pw_mod_pulse_modules"))) \ + __attribute__((aligned(__alignof__(struct module_info)))) \ + const struct module_info name +diff --git a/test/pwtest-implementation.h b/test/pwtest-implementation.h +index 7bfad01cf..1525d2056 100644 +--- a/test/pwtest-implementation.h ++++ b/test/pwtest-implementation.h +@@ -131,7 +131,7 @@ void _pwtest_add(struct pwtest_context *ctx, + struct pwtest_suite_decl { + const char *name; + enum pwtest_result (*setup)(struct pwtest_context *, struct pwtest_suite *); +-} __attribute__((aligned(16))); ++}; + + + #endif /* PWTEST_IMPLEMENTATION_H */ +diff --git a/test/pwtest.h b/test/pwtest.h +index 9c0737523..6d3070b79 100644 +--- a/test/pwtest.h ++++ b/test/pwtest.h +@@ -494,9 +494,11 @@ enum pwtest_arg { + */ + #define PWTEST_SUITE(cname) \ + static enum pwtest_result (cname##__setup)(struct pwtest_context *ctx, struct pwtest_suite *suite); \ +- static const struct pwtest_suite_decl _test_suite \ + __attribute__((used)) \ +- __attribute((section("pwtest_suite_section"))) = { \ ++ __attribute__((retain)) \ ++ __attribute__((section("pwtest_suite_section"))) \ ++ __attribute__((aligned(__alignof__(struct pwtest_suite_decl)))) \ ++ static const struct pwtest_suite_decl _test_suite = { \ + .name = #cname, \ + .setup = cname##__setup, \ + }; \ +-- +GitLab + -- cgit v1.2.3