Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The problem is (in part) with the switch() that may read the variable more than once. ================== WARNING: ThreadSanitizer: data race (pid=10828) Write of size 8 at 0x7b040000ae78 by thread T6 (mutexes: write M0): #0 RFSetReaderEventState PCSC/src/readerfactory.c:1321:32 (pcscd+0x4c45ce) #1 EHStatusHandlerThread PCSC/src/eventhandler.c:382:11 (pcscd+0x4bee54) Previous read of size 8 at 0x7b040000ae78 by thread T8: #0 RFCheckReaderEventState PCSC/src/readerfactory.c:1350:24 (pcscd+0x4c46c6) #1 SCardStatus PCSC/src/winscard.c:1286:7 (pcscd+0x4ce7b5) #2 ContextThread PCSC/src/winscard_svc.c:635:16 (pcscd+0x4d0cc1) Location is heap block of size 16 at 0x7b040000ae70 allocated by thread T8: #0 malloc <null> (pcscd+0x42a65c) #1 RFAddReaderHandle PCSC/src/readerfactory.c:1249:14 (pcscd+0x4c43b4) #2 SCardConnect PCSC/src/winscard.c:491:7 (pcscd+0x4ccc16) #3 ContextThread PCSC/src/winscard_svc.c:502:16 (pcscd+0x4d0a70) Mutex M0 (0x7b4c000000a0) created at: #0 pthread_mutex_init <null> (pcscd+0x42d2fd) #1 RFAddReader PCSC/src/readerfactory.c:329:8 (pcscd+0x4c1d18) #2 HPAddDevice PCSC/src/hotplug_libudev.c:534:8 (pcscd+0x4cba1c) #3 HPEstablishUSBNotifications PCSC/src/hotplug_libudev.c:668:6 (pcscd+0x4cb4d4) Thread T6 (tid=11122, running) created by thread T2 at: #0 pthread_create <null> (pcscd+0x42be8b) #1 ThreadCreate PCSC/src/utils.c:184:8 (pcscd+0x4cc2dc) #2 EHSpawnEventHandler PCSC/src/eventhandler.c:237:7 (pcscd+0x4beb59) #3 RFAddReader PCSC/src/readerfactory.c:426:8 (pcscd+0x4c21b9) #4 HPAddDevice PCSC/src/hotplug_libudev.c:534:8 (pcscd+0x4cba1c) #5 HPEstablishUSBNotifications PCSC/src/hotplug_libudev.c:668:6 (pcscd+0x4cb4d4) Thread T8 (tid=11173, running) created by main thread at: #0 pthread_create <null> (pcscd+0x42be8b) #1 ThreadCreate PCSC/src/utils.c:184:8 (pcscd+0x4cc2dc) #2 CreateContextThread PCSC/src/winscard_svc.c:236:7 (pcscd+0x4cfd8b) #3 SVCServiceRunLoop PCSC/src/pcscdaemon.c:134:9 (pcscd+0x4c1082) #4 main PCSC/src/pcscdaemon.c:786:2 (pcscd+0x4c09c4) SUMMARY: ThreadSanitizer: data race PCSC/src/readerfactory.c:1321:32 in RFSetReaderEventState ==================
- Loading branch information