Hello,
Le 09/09/2011 09:23, Martin Paljak a écrit : > On 31/08/11 20:01, Viktor Tarasov wrote: >> during the tests of minidriver on Windows Vista there was a problem related >> to the using of OpenSC in multi-threads. >> >> SC context create/release are not thread safe -- they allocate/release >> memory referenced by the pointers fromthe static 'struct sc_card_driver'. >> (It concerns also, if present, load/unload of dynamic card driver.) >> https://github.com/OpenSC/OpenSC/blob/master/src/libopensc/ctx.c#L749 >> >> Static 'struct sc_card_driver' is present in each card-xx. >> >> Currently, in minidriver-write-mode branch, there is a temporary hack, but I >> think that this problem has to be resolved on the OpenSC side. >> For example to introduce reference counter into 'sc_card_driver' and use it >> in the sc-context functions. > If we omit loadable modules, we could also take that ATR tables are > indeed static and do not need to be released? Is this correct? Exact. Only loadable module prevents the static ATR tables. > For minidriver we need to dump out programmatically ATR tables anyway, > to embed that in the installer. This also. But in my case I need to check the card specific opensc configuration -- that's where from this problem appeared. >> What would you say? >> Do you know other places in the OpenSC code, that needs to be revisited from >> the thread safe point of view? > For PKCS#11 it would be nice to remove the global lock of *all* > operations and introduce a slot (or internally, a reader based) lock > instead, so that multiple cards could be used simultaneously. But that's > a minor thing. Reasonable. Will be keeping it in mind. > _______________________________________________ > opensc-devel mailing list > opensc-devel@lists.opensc-project.org > http://www.opensc-project.org/mailman/listinfo/opensc-devel > _______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel