p11_library_mutex problems on W32
Stef Walter
stefw at redhat.com
Tue Apr 2 12:49:45 PDT 2013
Thanks for digging into the issue.
Typically I build mingw builds every so often before major releases,
and fix issues I see. So you may be seeing some win32 related code rot
related to some recent p11-kit refactoring.
On 04/01/2013 08:14 PM, LRN wrote:
> p11-kit.exe crashed on me.
What version? And what platform are you running on? Do the tests (ie:
make check) crash? Can you file a bug?
> Tried to debug it, discovered that it crashes in p11_lock().
> Debugged it further.
Hmmm, smells like a mutex is not being initialized on win32. Perhaps
being erroneously used by code that's not in a library.
> Turns out, the value gdb prints for &p11_library_mutex changes
> depending on which part of the code it's in. It's one value inside
> tool.c and any code called from the .exe file, and another in code
> called from DllMain.
The p11-kit library and trust module, each use their own locking and
their own 'big' global mutex, callable through p11_lock() and
p11_unlock().
These are all called the same thing (ie: p11_library_mutex) but are
different instances as they are in separate DLLs. Not meant to be shared.
> Looked up how p11-kit is linked and (oh, the horror!) discovered
> that it's linked to libp11-library.a (statically, obviously). The
> very file that does all these mutex-related things. And libp11-kit
> is linked to it too. Statically. Which is how they get two versions
> of everything.
Yes, the plan is to link common code statically into the various
modules that use it. But it was a regression (due to recent
refactoring) to link the mutex code into p11-kit.
So attached are three patches which I'd be interested if you could
test. If you would like to file a bug here, that's actually a better
way to iterate on these sorts of fixes:
https://bugs.freedesktop.org/enter_bug.cgi?product=p11-glue&component=p11-kit
My guess is that the first patch will fix your problem. The second
patch cleans up the way we build the code, and hopefully makes things
a bit clearer. The third patch fixes another WIN32 build problem.
Looking forward to hearing how it goes (on a newly filed bugzilla bug
if possible).
Cheers,
Stef
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Don-t-use-library-locks-from-p11-kit-tool.patch
Type: text/x-patch
Size: 1349 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/p11-glue/attachments/20130402/202c2a35/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Separate-library-init-from-message-code.patch
Type: text/x-patch
Size: 38318 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/p11-glue/attachments/20130402/202c2a35/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Fix-build-error-on-win32.patch
Type: text/x-patch
Size: 669 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/p11-glue/attachments/20130402/202c2a35/attachment-0005.bin>
More information about the p11-glue
mailing list