[PATCH] D18078: [Sanitizer][MIPS] internal lstat and fstat for mips64
Mohit Bhakkad via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 11 01:55:38 PST 2016
mohit.bhakkad created this revision.
mohit.bhakkad added reviewers: dvyukov, samsonov, kcc.
mohit.bhakkad added subscribers: jaydeep, sagar, llvm-commits.
mohit.bhakkad set the repository for this revision to rL LLVM.
For mips64, structure of the buffer after stat syscall is of kernel_stat, and we need to convert it to stat form.
Repository:
rL LLVM
http://reviews.llvm.org/D18078
Files:
lib/sanitizer_common/sanitizer_linux.cc
Index: lib/sanitizer_common/sanitizer_linux.cc
===================================================================
--- lib/sanitizer_common/sanitizer_linux.cc
+++ lib/sanitizer_common/sanitizer_linux.cc
@@ -244,7 +244,15 @@
return internal_syscall(SYSCALL(newfstatat), AT_FDCWD, (uptr)path,
(uptr)buf, AT_SYMLINK_NOFOLLOW);
#elif SANITIZER_LINUX_USES_64BIT_SYSCALLS
+# if SANITIZER_MIPS64
+ // For mips64, lstat syscall fills buffer in the format of kernel_stat
+ struct kernel_stat kbuf;
+ int res = internal_syscall(SYSCALL(lstat), path, &kbuf);
+ kernel_stat_to_stat(&kbuf, (struct stat *)buf);
+ return res;
+# else
return internal_syscall(SYSCALL(lstat), (uptr)path, (uptr)buf);
+# endif
#else
struct stat64 buf64;
int res = internal_syscall(SYSCALL(lstat64), path, &buf64);
@@ -255,7 +263,15 @@
uptr internal_fstat(fd_t fd, void *buf) {
#if SANITIZER_FREEBSD || SANITIZER_LINUX_USES_64BIT_SYSCALLS
+# if SANITIZER_MIPS64
+ // For mips64, fstat syscall fills buffer in the format of kernel_stat
+ struct kernel_stat kbuf;
+ int res = internal_syscall(SYSCALL(fstat), fd, &kbuf);
+ kernel_stat_to_stat(&kbuf, (struct stat *)buf);
+ return res;
+# else
return internal_syscall(SYSCALL(fstat), fd, (uptr)buf);
+# endif
#else
struct stat64 buf64;
int res = internal_syscall(SYSCALL(fstat64), fd, &buf64);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18078.50404.patch
Type: text/x-patch
Size: 1370 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160311/e9b60fc0/attachment.bin>
More information about the llvm-commits
mailing list