Index: lib/sanitizer_common/sanitizer_linux.cc =================================================================== --- lib/sanitizer_common/sanitizer_linux.cc +++ lib/sanitizer_common/sanitizer_linux.cc @@ -69,6 +69,7 @@ #endif #if SANITIZER_OPENBSD #include +extern char **environ; #endif #include @@ -310,21 +311,21 @@ return internal_syscall_ptr(SYSCALL(fstatat), AT_FDCWD, (uptr)path, (uptr)buf, 0); #elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS - return internal_syscall(SYSCALL(newfstatat), AT_FDCWD, (uptr)path, (uptr)buf, - 0); + return internal_syscall_ptr(SYSCALL(newfstatat), AT_FDCWD, (uptr)path, + (uptr)buf, 0); #elif SANITIZER_LINUX_USES_64BIT_SYSCALLS # if defined(__mips64) // For mips64, stat syscall fills buffer in the format of kernel_stat struct kernel_stat kbuf; - int res = internal_syscall(SYSCALL(stat), path, &kbuf); + int res = internal_syscall_ptr(SYSCALL(stat), path, &kbuf); kernel_stat_to_stat(&kbuf, (struct stat *)buf); return res; # else - return internal_syscall(SYSCALL(stat), (uptr)path, (uptr)buf); + return internal_syscall_ptr(SYSCALL(stat), (uptr)path, (uptr)buf); # endif #else struct stat64 buf64; - int res = internal_syscall(SYSCALL(stat64), path, &buf64); + int res = internal_syscall_ptr(SYSCALL(stat64), path, &buf64); stat64_to_stat(&buf64, (struct stat *)buf); return res; #endif @@ -394,8 +395,8 @@ uptr internal_readlink(const char *path, char *buf, uptr bufsize) { #if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS || SANITIZER_OPENBSD - return internal_syscall(SYSCALL(readlinkat), AT_FDCWD, (uptr)path, (uptr)buf, - bufsize); + return internal_syscall_ptr(SYSCALL(readlinkat), AT_FDCWD, (uptr)path, + (uptr)buf, bufsize); #else return internal_syscall_ptr(SYSCALL(readlink), path, buf, bufsize); #endif @@ -403,7 +404,7 @@ uptr internal_unlink(const char *path) { #if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS || SANITIZER_OPENBSD - return internal_syscall(SYSCALL(unlinkat), AT_FDCWD, (uptr)path, 0); + return internal_syscall_ptr(SYSCALL(unlinkat), AT_FDCWD, (uptr)path, 0); #else return internal_syscall_ptr(SYSCALL(unlink), (uptr)path); #endif @@ -411,8 +412,8 @@ uptr internal_rename(const char *oldpath, const char *newpath) { #if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS || SANITIZER_OPENBSD - return internal_syscall(SYSCALL(renameat), AT_FDCWD, (uptr)oldpath, AT_FDCWD, - (uptr)newpath); + return internal_syscall_ptr(SYSCALL(renameat), AT_FDCWD, (uptr)oldpath, + AT_FDCWD, (uptr)newpath); #else return internal_syscall_ptr(SYSCALL(rename), (uptr)oldpath, (uptr)newpath); #endif @@ -1749,7 +1750,11 @@ } static void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) { -#if SANITIZER_NETBSD +#if SANITIZER_OPENBSD + *pc = 0; + *bp = 0; + *sp = 0; +#elif SANITIZER_NETBSD // This covers all NetBSD architectures ucontext_t *ucontext = (ucontext_t *)context; *pc = _UC_MACHINE_PC(ucontext);