[compiler-rt] dcefbce - [Sanitizer] Fix the implementation of internal_fstat on LoongArch

Weining Lu via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 22 06:16:41 PST 2022


Author: Youling Tang
Date: 2022-11-22T22:16:11+08:00
New Revision: dcefbce28109716803e8c83db1bd8d1bd0b6f369

URL: https://github.com/llvm/llvm-project/commit/dcefbce28109716803e8c83db1bd8d1bd0b6f369
DIFF: https://github.com/llvm/llvm-project/commit/dcefbce28109716803e8c83db1bd8d1bd0b6f369.diff

LOG: [Sanitizer] Fix the implementation of internal_fstat on LoongArch

If `pathname` is an empty string and the AT_EMPTY_PATH flag is specified in `flags`,
statx `pathname` argument is of type `const char *restrict`, so it should be `""`
instead of `0`.

Reviewed By: SixWeining, xen0n, xry111, lixing-star

Differential Revision: https://reviews.llvm.org/D138414

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
index f23ea9da37149..83d688af9267d 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
@@ -440,7 +440,7 @@ uptr internal_fstat(fd_t fd, void *buf) {
   return res;
 #      elif SANITIZER_LINUX && defined(__loongarch__)
   struct statx bufx;
-  int res = internal_syscall(SYSCALL(statx), fd, 0, AT_EMPTY_PATH,
+  int res = internal_syscall(SYSCALL(statx), fd, "", AT_EMPTY_PATH,
                              STATX_BASIC_STATS, (uptr)&bufx);
   statx_to_stat(&bufx, (struct stat *)buf);
   return res;


        


More information about the llvm-commits mailing list