Fix reliability, security, and performance issues across clients - #18
Merged
Conversation
BlueZ game controllers (xbox/ps5/horipad): - Run the hidraw read loop on an owned thread joined in the destructor and interruptible via epoll+eventfd, instead of a blocking coroutine that ran inline and never returned. Fixes a use-after-free when a controller is unplugged and a hang that blocked shutdown and the D-Bus event loop. - Guard input_reader_ with a mutex; it is created on the D-Bus thread and reset on the udev thread. - Clamp the report memcpy to the bytes actually read, size the PS5 buffer to the largest report so report 0x31 is not truncated, and dump each HoriPad report array by its own size to stop a one-byte over-read. Data races: - Guard connman services_/technologies_ with a mutex across the constructor and the async callbacks. - Guard udisks2 manager_nvme_ with a mutex on add and remove. Error handling: - geoclue2: bail out when the manager returns no client object. - login1: contain sdbus errors from ListSeats/ListSessions/ListUsers in the async reply so they cannot terminate the process. - packagekit: wrap main() in try/catch. - timedate1: guard against a null localtime_r result before put_time. Performance: - Dispatch PropertiesChanged by iterating the changed properties once instead of scanning every known property with two map lookups and a per-property allocation (device1, adapter1, upower, gatt*, le_advertising_manager1). - Extract each Variant container once in the utils formatters. Resource use: - De-duplicate and cap systemd1 activeUnits_ growth. Signed-off-by: Joel Winarske <[email protected]>
This was referenced Jul 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes reliability, security, and performance issues found across the clients. Builds clean (gcc 16 / clang 19), passes clang-format
--Werror, and introduces no new clang-tidy warnings.BlueZ game controllers (xbox / ps5 / horipad)
epoll+eventfd, instead of a blocking coroutine that ran inline and never returned. Fixes a use-after-free when a controller is unplugged (the udev thread freed the reader while the read loop was still blocked inread()) and a hang that blocked shutdown and the D-Bus event loop.input_reader_with a mutex; it is created on the D-Bus thread and reset on the udev thread.memcpyto the bytes actually read, size the PS5 buffer to the largest report so report0x31is no longer truncated, and dump each HoriPad report array by its own size to stop a one-byte over-read.Data races
services_/technologies_with a mutex across the constructor and the async callbacks.manager_nvme_with a mutex on add and remove.Error handling
shared_ptrderef).ListSeats/ListSessions/ListUsersin the async reply so they cannot escape the event loop and terminate the process.main()in try/catch.localtime_rresult beforeput_time.Performance
PropertiesChangedby iterating the changed properties once instead of scanning every known property with two map lookups and a per-propertyMemberNameallocation (device1, adapter1, upower, gatt*, le_advertising_manager1).Resource use
activeUnits_growth.