[compiler-rt] fd0aa70 - [sanitizer] use the right type for sizeof for interceptor hook

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 23 20:12:43 PDT 2023


Author: Wu, Yingcong
Date: 2023-07-23T20:12:39-07:00
New Revision: fd0aa70528e425fe192d3eb0c5c1e32b4b1ccbf5

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

LOG: [sanitizer] use the right type for sizeof for interceptor hook

`PRE_READ` is called with a pointer and the size of the object
the pointer points to. But there is one line of code not calling
`PRE_READ` correctly(likely missing a dereference).
This patch fixes the problem.

Reviewed By: MaskRay

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

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc
index 3900bcf22b7a15..c10943b3e48793 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_syscalls.inc
@@ -2135,7 +2135,7 @@ PRE_SYSCALL(epoll_pwait2)
  const sanitizer_kernel_timespec *timeout, const kernel_sigset_t *sigmask,
  long sigsetsize) {
   if (timeout)
-    PRE_READ(timeout, sizeof(timeout));
+    PRE_READ(timeout, sizeof(*timeout));
   if (sigmask)
     PRE_READ(sigmask, sigsetsize);
 }


        


More information about the llvm-commits mailing list