DynamoRIO / DynamoRIO/drmemory

add High Sierra Mac OSX support

Open
#2,132 5 comments 0 reactions 0 assignees View on GitHub
help wanted OpSys-OSX
Dominant language
C
Stars
2.7k
Forks
290
PR merge metrics
No merged PRs in 30d

Description

This is an issue covering both build and execution issues on High Sierra.

The cmake through brew is now 3.12.3 which hits a new policy warning I added to #1375.



We have some build errors:

```
/Users/derek/drmemory/git/src/drsyscall/table_macos_bsd.c:43:10: fatal error: 'security/mac.h' file not found
#include
^~~~~~~~~~~~~~~~

/Users/derek/drmemory/git/src/tests/syscalls_unix.c:172:5: warning: 'syscall' is deprecated: first deprecated in
macOS 10.12 - syscall(2) is unsupported; please switch to a supported interface. For SYS_kdebug_trace use
kdebug_signpost(). [-Wdeprecated-declarations]
syscall(SYS_finit_module, fd, stack_str.str, 0);
^
/usr/include/unistd.h:745:6: note: 'syscall' has been explicitly marked deprecated here
int syscall(int, ...);
^
/Users/derek/drmemory/git/src/tests/syscalls_unix.c:184:5: warning: 'syscall' is deprecated: first deprecated in
macOS 10.12 - syscall(2) is unsupported; please switch to a supported interface. For SYS_kdebug_trace use
kdebug_signpost(). [-Wdeprecated-declarations]
syscall(SYS_finit_module, -1, dangling_ptr->str, 0);
^
/usr/include/unistd.h:745:6: note: 'syscall' has been explicitly marked deprecated here
int syscall(int, ...);
^
/Users/derek/drmemory/git/src/tests/syscalls_unix.c:236:13: warning: 'syscall' is deprecated: first deprecated in
macOS 10.12 - syscall(2) is unsupported; please switch to a supported interface. For SYS_kdebug_trace use
kdebug_signpost(). [-Wdeprecated-declarations]
n = syscall(SYS_process_vm_readv, getpid(), local, 2, remote, 1, 0);
^
/usr/include/unistd.h:745:6: note: 'syscall' has been explicitly marked deprecated here
int syscall(int, ...);
^
/Users/derek/drmemory/git/src/tests/syscalls_unix.c:238:13: warning: 'syscall' is deprecated: first deprecated in
macOS 10.12 - syscall(2) is unsupported; please switch to a supported interface. For SYS_kdebug_trace use
kdebug_signpost(). [-Wdeprecated-declarations]
n = syscall(SYS_process_vm_writev, getpid(), local, 2, remote, 1, 0);
^
/usr/include/unistd.h:745:6: note: 'syscall' has been explicitly marked deprecated here
int syscall(int, ...);
```



32-bit is deprecated in xcode. Still works but get a link warning:
```
ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)
```



Need to add MACOS_VERSION_HIGH_SIERRA to os.c

```

```



HANG on exit in debug build of plain DR

After Stopping message when running 1.11.0-2/dynamorio/bin32/drrun on
hello,world it hangs.

lldb shows it's hung on read_lock(&callback_registration_lock) b/c the
lock_requests is a bogus value:
```
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
* frame #0: 0xa73e14fe libsystem_kernel.dylib`swtch_pri + 10
frame #1: 0x7156edd7 libdynamorio.dylib`os_thread_yield at os.c:2981
frame #2: 0x715871e1 libdynamorio.dylib`rwlock_wait_contended_reader(rwlock=0x71676c1c) at os.c:8864
frame #3: 0x71253110 libdynamorio.dylib`read_lock(rw=0x71676c1c) at utils.c:1155
frame #4: 0x7140ccd5 libdynamorio.dylib`instrument_exit at instrument.c:765
frame #5: 0x71096eb8 libdynamorio.dylib`dynamo_shared_exit at dynamo.c:974
frame #6: 0x71097ec9 libdynamorio.dylib`dynamo_process_exit_cleanup at dynamo.c:1241
frame #7: 0x7109785e libdynamorio.dylib`dynamo_process_exit at dynamo.c:1297
frame #8: 0x71542bc4 libdynamorio.dylib`cat_done_saving_dstack + 25
(lldb) frame select 3
frame #3: 0x71253110 libdynamorio.dylib`read_lock(rw=0x71676c1c) at utils.c:1155
(lldb) fr v -f x *rw
(read_write_lock_t) *rw = {
lock = {
lock_requests = 0x205c85f5
contended_event = (sem = 0x00000a28, value = 0x00000000)
name = 0x71625b76 "callback_registration_lock(readwrite)@/drmemory_package/dynamorio/core/lib/instrument.c:120"
rank = 0x0000002b
owner = 0x0000000000000000
owning_dcontext = 0x00000000
prev_owned_lock = 0x00000000
count_times_acquired = 0x00000002
count_times_contended = 0x1b3cb505
count_times_spin_pause = 0x00000000
max_contended_requests = 0x00000000
count_times_spin_only = 0x00000000
prev_process_lock = 0x71676158
next_process_lock = 0x4c51f58c
callstack = ([0] = 0x00000000, [1] = 0x00000000, [2] = 0x00000000, [3] = 0x00000000)
app_lock = 0x00
deleted = 0x00
}
num_readers = 0x00000000
writer = 0x0000000000000000
num_pending_readers = 0x00000001
writer_waiting_readers = (sem = 0x00000000, value = 0x00000000)
readers_waiting_writer = (sem = 0x00000000, value = 0x00000000)
}
```



Garbage output in timestamp notes:

```
Error #1: UNADDRESSABLE ACCESS of freed memory: reading 0x0041f0f3-0x0041f0f4 1 byte(s)
# 0 main [/Users/derek/drmemory/git/src/tests/free.c:81]
Note: 0:00:00.000 in thread 100688
Note: 0x0041f0f3-0x0041f0f4 overlaps memory 0x0041f0f0-0x0041f104 that was freed here:
Note: # 0 replace_free
Note: # 1 main [/Users/derek/drmemory/git/src/tests/free.c:77]
Note: instruction: mov 0x03(%eax) -> %cl
```



Can repro https://github.com/DynamoRIO/dynamorio/issues/3127

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.