pipewire/src/modules/module-protocol-pulse
Barnabás Pőcze 0f45d784d8 pulse-server: update client::name on UPDATE_CLIENT_PROPLIST command
`client::name` points to a string that is owned by `client::props`,
so when the property list is updated, it needs to be refreshed as well.
Otherwise, various use-after-frees can be triggered, for example:

==1471586==ERROR: AddressSanitizer: heap-use-after-free on address 0x60200007e7d0 at pc 0x7f14390755d0 bp 0x7ffe23edee30 sp 0x7ffe23ede5a8
READ of size 3 at 0x60200007e7d0 thread T0
    #0 0x7f14390755cf in printf_common /usr/src/debug/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors_format.inc:553
    #1 0x7f1439077215 in __interceptor_vsnprintf /usr/src/debug/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:1665
    #2 0x7f1434ead47d in spa_vscnprintf ../spa/include/spa/utils/string.h:239
    #3 0x7f1434eae2ae in impl_log_logtv ../spa/plugins/support/logger.c:138
    #4 0x7f14385cacc7 in pw_log_logt ../src/pipewire/log.c:135
    #5 0x7f1433aef8e9 in do_set_profile ../src/modules/module-protocol-pulse/pulse-server.c:4656
    #6 0x7f1433b0af4d in handle_packet ../src/modules/module-protocol-pulse/server.c:109
    #7 0x7f1433b0e747 in do_read ../src/modules/module-protocol-pulse/server.c:276
    #8 0x7f1433b0eb04 in on_client_data ../src/modules/module-protocol-pulse/server.c:306
    #9 0x7f1434ec56a0 in source_io_func ../spa/plugins/support/loop.c:442
    #10 0x7f1434ec4a21 in loop_iterate ../spa/plugins/support/loop.c:430
    #11 0x7f14385dc23d in pw_main_loop_run ../src/pipewire/main-loop.c:148
    #12 0x55b065d73722 in main ../src/daemon/pipewire.c:131
    #13 0x7f143742928f  (/usr/lib/libc.so.6+0x2928f)
    #14 0x7f1437429349 in __libc_start_main (/usr/lib/libc.so.6+0x29349)
    #15 0x55b065d722a4 in _start (./src/daemon/pipewire-pulse+0x42a4)

0x60200007e7d0 is located 0 bytes inside of 16-byte region [0x60200007e7d0,0x60200007e7e0)
freed by thread T0 here:
    #0 0x7f14390be672 in __interceptor_free /usr/src/debug/gcc/libsanitizer/asan/asan_malloc_linux.cpp:52
    #1 0x7f14386a775a in do_replace ../src/pipewire/properties.c:414
    #2 0x7f14386a785e in pw_properties_set ../src/pipewire/properties.c:441
    #3 0x7f14386a658b in pw_properties_update ../src/pipewire/properties.c:309
    #4 0x7f1433adb055 in do_update_proplist ../src/modules/module-protocol-pulse/pulse-server.c:3246
    #5 0x7f1433b0af4d in handle_packet ../src/modules/module-protocol-pulse/server.c:109
    #6 0x7f1433b0e747 in do_read ../src/modules/module-protocol-pulse/server.c:276
    #7 0x7f1433b0eb04 in on_client_data ../src/modules/module-protocol-pulse/server.c:306
    #8 0x7f1434ec56a0 in source_io_func ../spa/plugins/support/loop.c:442
    #9 0x7f1434ec4a21 in loop_iterate ../spa/plugins/support/loop.c:430
    #10 0x7f14385dc23d in pw_main_loop_run ../src/pipewire/main-loop.c:148
    #11 0x55b065d73722 in main ../src/daemon/pipewire.c:131
    #12 0x7f143742928f  (/usr/lib/libc.so.6+0x2928f)

previously allocated by thread T0 here:
    #0 0x7f1439072faa in __interceptor_strdup /usr/src/debug/gcc/libsanitizer/asan/asan_interceptors.cpp:439
    #1 0x7f14386a6fe2 in do_replace ../src/pipewire/properties.c:394
    #2 0x7f14386a785e in pw_properties_set ../src/pipewire/properties.c:441
    #3 0x7f1433a6c52d in read_props ../src/modules/module-protocol-pulse/message.c:147
    #4 0x7f1433a6f467 in message_get ../src/modules/module-protocol-pulse/message.c:359
    #5 0x7f1433ab3191 in do_set_client_name ../src/modules/module-protocol-pulse/pulse-server.c:1030
    #6 0x7f1433b0af4d in handle_packet ../src/modules/module-protocol-pulse/server.c:109
    #7 0x7f1433b0e747 in do_read ../src/modules/module-protocol-pulse/server.c:276
    #8 0x7f1433b0eb04 in on_client_data ../src/modules/module-protocol-pulse/server.c:306
    #9 0x7f1434ec56a0 in source_io_func ../spa/plugins/support/loop.c:442
    #10 0x7f1434ec4a21 in loop_iterate ../spa/plugins/support/loop.c:430
    #11 0x7f14385dc23d in pw_main_loop_run ../src/pipewire/main-loop.c:148
    #12 0x55b065d73722 in main ../src/daemon/pipewire.c:131
    #13 0x7f143742928f  (/usr/lib/libc.so.6+0x2928f)
2022-06-20 17:30:05 +00:00
..
extensions spa: add locale independent spa_dtoa 2022-03-21 10:41:44 +01:00
modules pulse-server: module-switch-on-connect: remove dead code and one allocation 2022-06-05 18:04:03 +00:00
client.c pulse-server: message: store pointer to impl directly 2022-06-16 18:38:30 +00:00
client.h pulse-server: update client::name on UPDATE_CLIENT_PROPLIST command 2022-06-20 17:30:05 +00:00
collect.c pulse-server: optimize link finding 2022-06-03 15:48:08 +02:00
collect.h pulse-server: optimize link finding 2022-06-03 15:48:08 +02:00
commands.h pulse-server: add command access control 2021-12-31 02:11:59 +01:00
dbus-name.c modules: add log topics to module-protocol-pulse 2021-09-28 09:35:39 +02:00
dbus-name.h pulse-server: split out D-Bus parts 2021-06-25 03:23:09 +02:00
defs.h pulse-server: set also metadata target.object when moving streams 2022-02-28 18:36:26 +00:00
extension.c pulse-server: make separate index 2022-01-17 12:01:13 +01:00
extension.h pulse-server: make separate index 2022-01-17 12:01:13 +01:00
format.c pulse-server: use 8 channels internally for TrueHD and DTSHD 2022-05-23 18:54:18 +02:00
format.h pulse-server: fix IEC958 passthrough again 2022-02-21 16:53:03 +01:00
internal.h pulse-server: use quantum_limit 2022-01-14 16:45:41 +01:00
log.h modules: add log topics to module-protocol-pulse 2021-09-28 09:35:39 +02:00
manager.c pulse-server: implement temporary data attached to manager objects 2022-05-15 17:14:52 +00:00
manager.h pulse-server: implement temporary data attached to manager objects 2022-05-15 17:14:52 +00:00
message-handler.c handle open_memstream errors 2022-03-02 11:48:31 +01:00
message-handler.h pulse-server: split out message-handler 2021-06-25 03:23:41 +02:00
message.c pulse-server: message: improve resizing logic 2022-06-16 18:38:30 +00:00
message.h pulse-server: message: store pointer to impl directly 2022-06-16 18:38:30 +00:00
module.c pulse-server: rename module_info::prepare() to create() 2022-06-02 23:56:55 +02:00
module.h pulse-server: rename module_info::prepare() to create() 2022-06-02 23:56:55 +02:00
operation.c pulse-server: unlink operation before callback 2022-02-21 08:54:50 +01:00
operation.h pulse-server: free pending sample reply 2022-02-20 21:34:53 +01:00
pending-sample.c pulse-server: free pending sample reply 2022-02-20 21:34:53 +01:00
pending-sample.h pulse-server: wait for pending_sample to complete 2022-02-21 08:57:15 +01:00
pulse-server.c pulse-server: update client::name on UPDATE_CLIENT_PROPLIST command 2022-06-20 17:30:05 +00:00
pulse-server.h pulse-server: add missing forward declarations 2021-06-25 03:24:00 +02:00
quirks.c conf: move rule matching to config 2022-02-04 10:43:31 +01:00
quirks.h pipewire-pulse: implement simple quirk database 2021-06-30 17:17:36 +02:00
remap.c pulse-server: also remap module property keys and values 2022-02-04 15:15:42 +01:00
remap.h pulse-server: also remap module property keys and values 2022-02-04 15:15:42 +01:00
reply.c modules: add log topics to module-protocol-pulse 2021-09-28 09:35:39 +02:00
reply.h pulse-server: split out reply, operation, client, stream 2021-06-25 03:23:27 +02:00
sample-play.c remove the rate_match io 2022-03-29 09:57:49 +02:00
sample-play.h remove the rate_match io 2022-03-29 09:57:49 +02:00
sample.c modules: add log topics to module-protocol-pulse 2021-09-28 09:35:39 +02:00
sample.h pulse-server: improve reference counting of samples 2021-12-26 19:37:41 +00:00
server.c pulse-server: message: store pointer to impl directly 2022-06-16 18:38:30 +00:00
server.h pulse-server: support server config 2022-01-04 14:30:33 +01:00
stream.c pulse-server: send STREAM_MOVED messages 2022-06-03 16:59:08 +02:00
stream.h pulse-server: send STREAM_MOVED messages 2022-06-03 16:59:08 +02:00
utils.c Add support for MidnightBSD 2022-06-19 18:22:47 +00:00
utils.h pulse-server: don't append "/pulse" to PULSE_RUNTIME_PATH 2022-06-09 17:06:07 +02:00
volume.c modules: add log topics to module-protocol-pulse 2021-09-28 09:35:39 +02:00
volume.h pulse-server: split out volume handling 2021-06-25 03:23:01 +02:00