[Pcsclite-muscle] About SHARED/EXCLUSIVE and starvation Was: Portable way to detect when a smart card is inserted

Ludovic Rousseau ludovic.rousseau at gmail.com
Wed Sep 17 12:58:10 UTC 2014


2014-09-17 14:48 GMT+02:00 helpcrypto helpcrypto <helpcrypto at gmail.com>:
> On Wed, Sep 17, 2014 at 2:34 PM, Sebastien Lorquet <sebastien at lorquet.fr>
> wrote:
>>
>> Hello,
>>
>> The evil process might block access to the reader, but in that case, the
>> legitimate process will likely timeout while waiting for the card
>
> Not true if timeout = INFINITE

Then do not use timeout = INFINITE if you want to timeout :-)

> I have seen
>     while(1){
>         SCardConnect(exclusive)...
>     }
> in some smartcard applications. Thats EVIL! xD

Oh. Bad design indeed.


>> > If A dies then the lock will be released automatically. If that does
>> > not occur then it is a bug in pcsc-lite and you should report it.
>
> What locking system are you using? Flock? Mutex?
> Can you link any source where using it? I'm very interested in this!

MSGCleanupClient() (from winscard_svc.c [1]) is called when the client
application closes (intentionally or not) the socket communication
with pcscd.
MSGCleanupClient() then does the cleanup (calls SCardReleaseContext).

Bye

[1] http://anonscm.debian.org/viewvc/pcsclite/trunk/PCSC/src/winscard_svc.c?view=markup
line 968

-- 
 Dr. Ludovic Rousseau



More information about the Pcsclite-muscle mailing list