GoogleChromeLabs / chromeos_smart_card_connector

Smart Card Connector App for Chrome OS
https://chrome.google.com/webstore/detail/smart-card-connector/khpfeaanjngmcnplbdlpegiifgpfgdco
Apache License 2.0
135 stars 49 forks source link

Fix potential data race in the PC/SC-based reader tracker #125

Open emaxx-google opened 4 years ago

emaxx-google commented 4 years ago

We have the functionality that tracks the list of currently available smart card readers based on the information exposed by the PC/SC API. This implementation has a potential data race that it can miss the changes if they happen between the completion of one PC/SC call and the beginning of the next one. In that case, the change would only be recognized after some time (60 seconds at worst with the current implementation). This bug tracks the fix of this data race.

After this data race gets fixed, we could actually make a small performance improvement by avoiding the need to make a periodic PC/SC call (every 60 seconds currently) from that code.

emaxx-google commented 3 weeks ago

Now this can be solved in a relatively simple way, using the recent improvement landed in PC/SC-Lite: https://blog.apdu.fr/posts/2024/08/improved-scardgetstatuschange-for-pnpnotification-special-reader/