[PATCH] D33600: Adjust sanitizers for FreeBSD 64-bit inode update
Dimitry Andric via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 3 04:12:02 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL304658: Adjust sanitizers for FreeBSD 64-bit inode update (authored by dim).
Changed prior to commit:
https://reviews.llvm.org/D33600?vs=100437&id=101312#toc
Repository:
rL LLVM
https://reviews.llvm.org/D33600
Files:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
@@ -62,8 +62,6 @@
#if SANITIZER_FREEBSD
#include <sys/exec.h>
#include <sys/sysctl.h>
-#include <vm/vm_param.h>
-#include <vm/pmap.h>
#include <machine/atomic.h>
extern "C" {
// <sys/umtx.h> must be included after <errno.h> and <sys/types.h> on
@@ -227,7 +225,8 @@
uptr internal_stat(const char *path, void *buf) {
#if SANITIZER_FREEBSD
- return internal_syscall(SYSCALL(stat), path, buf);
+ return internal_syscall(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);
@@ -251,7 +250,8 @@
uptr internal_lstat(const char *path, void *buf) {
#if SANITIZER_FREEBSD
- return internal_syscall(SYSCALL(lstat), path, buf);
+ return internal_syscall(SYSCALL(fstatat), AT_FDCWD, (uptr)path,
+ (uptr)buf, AT_SYMLINK_NOFOLLOW);
#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
return internal_syscall(SYSCALL(newfstatat), AT_FDCWD, (uptr)path,
(uptr)buf, AT_SYMLINK_NOFOLLOW);
@@ -594,7 +594,9 @@
}
uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count) {
-#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
+#if SANITIZER_FREEBSD
+ return internal_syscall(SYSCALL(getdirentries), fd, (uptr)dirp, count, NULL);
+#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS
return internal_syscall(SYSCALL(getdents64), fd, (uptr)dirp, count);
#else
return internal_syscall(SYSCALL(getdents), fd, (uptr)dirp, count);
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -23,6 +23,9 @@
// incorporates the map structure.
# define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) \
((link_map*)((handle) == nullptr ? nullptr : ((char*)(handle) + 544)))
+// Get sys/_types.h, because that tells us whether 64-bit inodes are
+// used in struct dirent below.
+#include <sys/_types.h>
#else
# define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) ((link_map*)(handle))
#endif // !SANITIZER_FREEBSD
@@ -485,7 +488,12 @@
};
#elif SANITIZER_FREEBSD
struct __sanitizer_dirent {
+#if defined(__INO64)
+ unsigned long long d_fileno;
+ unsigned long long d_off;
+#else
unsigned int d_fileno;
+#endif
unsigned short d_reclen;
// more fields that we don't care about
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33600.101312.patch
Type: text/x-patch
Size: 2845 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170603/c889ef3b/attachment.bin>
More information about the llvm-commits
mailing list