Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deterministically wait for hotplug_libusb shutdown #2

Closed

Conversation

emaxx-google
Copy link
Owner

Change HPStopHotPluggables() to actually wait until the background hotplug thread exits.

This makes sure that the hotplug mechanism doesn't continue working throughout the daemon's shutdown process, and hence use-after-frees (if a reader is added/removed after the readerfactory is shut down), memory leaks etc. are prevented.

Note: this is expected to make the "SYS_Sleep(1)" trick in pcscdaemon.c unnecessary, replacing it with a more reliable alternative. We don't delete the sleep in the same commit in case it turns out to be crucial for some other reason.

Change HPStopHotPluggables() to actually wait until the background
hotplug thread exits.

This makes sure that the hotplug mechanism doesn't continue working
throughout the daemon's shutdown process, and hence use-after-frees
(if a reader is added/removed after the readerfactory is shut down),
memory leaks etc. are prevented.

Note: this is expected to make the "SYS_Sleep(1)" trick in pcscdaemon.c
unnecessary, replacing it with a more reliable alternative. We don't
delete the sleep in the same commit in case it turns out to be crucial
for some other reason.
@emaxx-google emaxx-google changed the title Deterministically wait on hotplug_libusb shutdown Deterministically wait for hotplug_libusb shutdown Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant