Bug 366131 - Illegal opcode in OS X 11.0 when using function getpwuid()
Summary: Illegal opcode in OS X 11.0 when using function getpwuid()
Status: REPORTED
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (show other bugs)
Version: 3.11.0
Platform: MacPorts macOS
: NOR normal
Target Milestone: ---
Assignee: Rhys Kidd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-26 13:33 UTC by cquike
Modified: 2016-11-30 05:27 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cquike 2016-07-26 13:33:02 UTC
The following code snippet:

#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
int main()
{
    struct passwd *pw = getpwuid(getuid());
}

 generates the following error message:
==88748== valgrind: Unrecognised instruction at address 0x10043bb34.
...

 and raises SIGILL signal. The full stacktrace is as follows:
==88782==    at 0x10043BB34: OSAtomicEnqueue (in /usr/lib/system/libsystem_platform.dylib)
==88782==    by 0x1004ABFD7: _xpc_dictionary_apply_node_f_wire_apply (in /usr/lib/system/libxpc.dylib)
==88782==    by 0x1004AB43B: _xpc_dictionary_apply_wire_f (in /usr/lib/system/libxpc.dylib)
==88782==    by 0x1004AA69A: _xpc_dictionary_apply_node_f (in /usr/lib/system/libxpc.dylib)
==88782==    by 0x1004ABF6F: xpc_dictionary_apply (in /usr/lib/system/libxpc.dylib)
==88782==    by 0x1002A3689: _extract_user (in /usr/lib/system/libsystem_info.dylib)
==88782==    by 0x1002A32C9: _ds_item (in /usr/lib/system/libsystem_info.dylib)
==88782==    by 0x1002A3064: ds_user_byuid (in /usr/lib/system/libsystem_info.dylib)
==88782==    by 0x1002A2DFB: search_item_bynumber (in /usr/lib/system/libsystem_info.dylib)
==88782==    by 0x1002A24CA: getpwuid (in /usr/lib/system/libsystem_info.dylib)
==88782==    by 0x100000F7F: main (in ./test_getpwuid)

 Valgrind has been installed from macports, and the code snippet has been compiled simply as 
 gcc -o test_getpwuid test_getpwuid.c

 Regards,
 Enrique
Comment 1 cquike 2016-07-26 13:34:13 UTC
 Forgot to mention that the valgrind command is also as simple as
 # valgrind ./test_getpwuid
Comment 2 Rhys Kidd 2016-08-10 06:56:32 UTC
Hello Enrique,
Thanks for the repro code. Although, it appears my development laptop doesn't use that specific instruction or it has been already fixed in SVN valgrind.

Can you please provide the output lines you deleted immediately are:

  ==88748== valgrind: Unrecognised instruction at address 0x10043bb34.

they will contain further details to help me triage the problem.
Comment 3 Rhys Kidd 2016-11-30 05:27:22 UTC
Ping?