https://bugs.kde.org/show_bug.cgi?id=362920

            Bug ID: 362920
           Summary: valgrind refuses to execute pkcs11-tool binary from
                    OpenSC: assertion 'tst->os_state.pthread - magic_delta
                    == self' failed
           Product: valgrind
           Version: 3.11.0
          Platform: MacPorts Packages
                OS: OS X
            Status: UNCONFIRMED
          Severity: crash
          Priority: NOR
         Component: memcheck
          Assignee: [email protected]
          Reporter: [email protected]

I have built OpenSC from master branch on Github.com/OpenSC/OpenSC. I am trying
to verify its memory usage with valgrind.  I am trying to execute command

valgrind pkcs11-tool -t -l  

to perform pkcs11 tests. It fails with this assertion:

valgrind: m_syswrap/syswrap-amd64-darwin.c:507 (void wqthread_hijack(Addr,
Addr, Addr, Addr, Int, Addr)): Assertion 'tst->os_state.pthread - magic_delta
== self' failed

Reproducible: Always

Steps to Reproduce:
1. On Mac OS X 10.11.4 with Xcode-7.3.1 install valgrind via Macports.
2. Clone, build and install https://Github.com/OpenSC/OpenSC.git
3. Run "valgrind pkcs11-tool -t -l"

Actual Results:  
$ valgrind pkcs11-tool -t -l
==23584== Memcheck, a memory error detector
==23584== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==23584== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==23584== Command: pkcs11-tool -t -l
==23584==
--23584-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option
--23584-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated 2
times)
--23584-- UNKNOWN mach_msg unhandled MACH_SEND_TRAILER option (repeated 4
times)

valgrind: m_syswrap/syswrap-amd64-darwin.c:507 (void wqthread_hijack(Addr,
Addr, Addr, Addr, Int, Addr)): Assertion 'tst->os_state.pthread - magic_delta
== self' failed.

host stacktrace:
==23584==    at 0x23803FC97: ???
==23584==    by 0x238040094: ???
==23584==    by 0x238040077: ???
==23584==    by 0x2380DE3E1: ???

sched status:
  running_tid=0

Thread 1: status = VgTs_WaitSys (lwpid 2567)
==23584==    at 0x1007C8FAE: semaphore_wait_trap (in
/usr/lib/system/libsystem_kernel.dylib)
==23584==    by 0x1005D7CB1: _dispatch_semaphore_wait_slow (in
/usr/lib/system/libdispatch.dylib)
==23584==    by 0x100986EA4: xpc_connection_send_message_with_reply_sync (in
/usr/lib/system/libxpc.dylib)
==23584==    by 0x1015877FD: transact (in
/System/Library/Frameworks/PCSC.framework/Versions/A/PCSC)
==23584==    by 0x1000806AC: pcsc_detect_readers (in
/Library/OpenSC/lib/libopensc.4.dylib)
==23584==    by 0x10003596D: sc_ctx_detect_readers (in
/Library/OpenSC/lib/libopensc.4.dylib)
==23584==    by 0x100035D80: sc_context_create (in
/Library/OpenSC/lib/libopensc.4.dylib)
==23584==    by 0x10154FBC4: C_Initialize (in
/Library/OpenSC/lib/opensc-pkcs11.so)
==23584==    by 0x100001CAF: main (in /usr/local/bin/pkcs11-tool)

Thread 2: status = VgTs_WaitSys (lwpid 3587)
==23584==    at 0x1007CF5E2: __workq_kernreturn (in
/usr/lib/system/libsystem_kernel.dylib)
==23584==    by 0x2380DE3E1: ???
==23584==    by 0x2382001AF: ???
==23584==    by 0x70000311EDAF: ???
==23584==    by 0x70000000BABF: ???

Thread 3: status = VgTs_WaitSys (lwpid 6147)
==23584==    at 0x1007C8F72: mach_msg_trap (in
/usr/lib/system/libsystem_kernel.dylib)
==23584==    by 0x1007C83B2: mach_msg (in
/usr/lib/system/libsystem_kernel.dylib)
==23584==    by 0x1007BE03B: _kernelrpc_mach_port_request_notification (in
/usr/lib/system/libsystem_kernel.dylib)
==23584==    by 0x1005D4FCC: _dispatch_kevent_mach_notify_resume (in
/usr/lib/system/libdispatch.dylib)
==23584==    by 0x1005D51BC: _dispatch_kevent_unregister (in
/usr/lib/system/libdispatch.dylib)
==23584==    by 0x1005D3FD1: _dispatch_mach_msg_send (in
/usr/lib/system/libdispatch.dylib)
==23584==    by 0x1005D3A20: _dispatch_mach_msg_send (in
/usr/lib/system/libdispatch.dylib)
==23584==    by 0x1005D4B23: _dispatch_mach_send_drain (in
/usr/lib/system/libdispatch.dylib)
==23584==    by 0x1005D3458: _dispatch_mach_invoke (in
/usr/lib/system/libdispatch.dylib)
==23584==    by 0x1005D11FF: _dispatch_queue_drain (in
/usr/lib/system/libdispatch.dylib)
==23584==    by 0x1005D21DE: _dispatch_mgr_queue_drain (in
/usr/lib/system/libdispatch.dylib)
==23584==    by 0x1005D20B9: _dispatch_mgr_invoke (in
/usr/lib/system/libdispatch.dylib)
==23584==    by 0x1005D1DCC: _dispatch_mgr_thread (in
/usr/lib/system/libdispatch.dylib)


Note: see also the FAQ in the source distribution.
It contains workarounds to several common problems.
In particular, if Valgrind aborted or crashed after
identifying problems in your program, there's a good chance
that fixing those problems will prevent Valgrind aborting or
crashing, especially if it happened in m_mallocfree.c.

If that doesn't help, please report this bug to: www.valgrind.org

In the bug report, send all the above text, the valgrind
version, and what OS and version you are using.  Thanks.

$

Expected Results:  
Valgrind analysis of memory usage by pkcs11-tool and dynamic libraries it
loads.

Mac OS X 10.11.4. Xcode-7.3.1. OpenSC master branch (probably less relevant).
Valgrind-3.11.0 installed by Macports.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to