* [bluez/bluez] 3e7f7a: shared: mainloop: Skip removed mainloop events
@ 2026-09-27 20:11 Pauli Virtanen
0 siblings, 0 replies; only message in thread
From: Pauli Virtanen @ 2026-09-27 20:11 UTC (permalink / raw)
To: linux-bluetooth
Branch: refs/heads/1174578
Home: https://github.com/bluez/bluez
Commit: 3e7f7a4d265fa3e7ef3f9224cd3acb9c22491f9b
https://github.com/bluez/bluez/commit/3e7f7a4d265fa3e7ef3f9224cd3acb9c22491f9b
Author: Pauli Virtanen <pav@iki.fi>
Date: 2026-09-27 (Sun, 27 Sep 2026)
Changed paths:
M src/shared/mainloop.c
Log Message:
-----------
shared: mainloop: Skip removed mainloop events
mainloop_remove_fd() on an fd that occurs in the same epoll_wait batch
as the current callback, causes ASan crash.
Several callsites do this, crash is sporadic since it requires suitable
timing.
Fix by adding registration ID in each event and dispatching only if that
registration is still active.
Fixes random btvirt crashes.
Log:
ERROR: AddressSanitizer: heap-use-after-free on address 0x7b7576be3f18
READ of size 8 at 0x7b7576be3f18 thread T0
#0 0x5637f7b4014f in mainloop_run src/shared/mainloop.c:104
#1 0x5637f7b41f79 in mainloop_run_with_signal src/shared/mainloop-notify.c:196
#2 0x5637f7aa598b in main emulator/main.c:310
freed by thread T0 here:
#0 0x7f45788ee4cf in free.part.0 (/lib64/libasan.so.8+0xee4cf)
#1 0x5637f7b40d05 in mainloop_remove_fd src/shared/mainloop.c:213
previously allocated by thread T0 here:
#0 0x7f45788ef24f in calloc (/lib64/libasan.so.8+0xef24f)
#1 0x5637f7b4034b in mainloop_add_fd src/shared/mainloop.c:142
Assisted-by: opencode:gpt-6-sol
Commit: 8178da05c017372532ee7ca1d47891bd747728e8
https://github.com/bluez/bluez/commit/8178da05c017372532ee7ca1d47891bd747728e8
Author: Pauli Virtanen <pav@iki.fi>
Date: 2026-09-27 (Sun, 27 Sep 2026)
Changed paths:
M .gitignore
M Makefile.am
A unit/test-mainloop.c
Log Message:
-----------
unit: test-mainloop: add basic mainloop test
Exercise basic mainloop fd add / remove / modify and timeouts.
src/shared/tester.h depends on mainloop and cannot be used here, so
write tests without the framework.
Add tests:
Test Modify File Descriptor
Test Re-Add Other Callback
Test Timeout
Assisted-by: opencode:gpt-6-sol
Compare: https://github.com/bluez/bluez/compare/3e7f7a4d265f%5E...8178da05c017
To unsubscribe from these emails, change your notification settings at https://github.com/bluez/bluez/settings/notifications
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-27 20:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-27 20:11 [bluez/bluez] 3e7f7a: shared: mainloop: Skip removed mainloop events Pauli Virtanen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox