[compiler-rt] [compiler-rt] using more precise type for the Linux's timerfd api int… (PR #77197)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 6 05:20:41 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: David CARLIER (devnexen)
<details>
<summary>Changes</summary>
…erception.
---
Full diff: https://github.com/llvm/llvm-project/pull/77197.diff
3 Files Affected:
- (modified) compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc (+3-3)
- (modified) compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cpp (+3)
- (modified) compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h (+12)
``````````diff
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
index 77fa1b4965a7a4..a40a771bc301bd 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -6376,8 +6376,8 @@ INTERCEPTOR(char *, getpass, const char *prompt) {
#endif
#if SANITIZER_INTERCEPT_TIMERFD
-INTERCEPTOR(int, timerfd_settime, int fd, int flags, void *new_value,
- void *old_value) {
+INTERCEPTOR(int, timerfd_settime, int fd, int flags, __sanitizer_itimerspec *new_value,
+ __sanitizer_itimerspec *old_value) {
void *ctx;
COMMON_INTERCEPTOR_ENTER(ctx, timerfd_settime, fd, flags, new_value,
old_value);
@@ -6388,7 +6388,7 @@ INTERCEPTOR(int, timerfd_settime, int fd, int flags, void *new_value,
return res;
}
-INTERCEPTOR(int, timerfd_gettime, int fd, void *curr_value) {
+INTERCEPTOR(int, timerfd_gettime, int fd, __sanitizer_itimerspec *curr_value) {
void *ctx;
COMMON_INTERCEPTOR_ENTER(ctx, timerfd_gettime, fd, curr_value);
int res = REAL(timerfd_gettime)(fd, curr_value);
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cpp
index bf0f355847cb13..189bbfe7283d3d 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cpp
@@ -53,6 +53,7 @@
# if !SANITIZER_ANDROID
# include <sys/statfs.h>
# include <linux/perf_event.h>
+# include <linux/time.h>
# endif
using namespace __sanitizer;
@@ -81,6 +82,8 @@ COMPILER_CHECK(sizeof(struct __sanitizer_perf_event_attr) <=
sizeof(struct perf_event_attr));
CHECK_SIZE_AND_OFFSET(perf_event_attr, type);
CHECK_SIZE_AND_OFFSET(perf_event_attr, size);
+COMPILER_CHECK(sizeof(struct __sanitizer_itimerspec) ==
+ sizeof(struct itimerspec));
#endif
COMPILER_CHECK(iocb_cmd_pread == IOCB_CMD_PREAD);
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
index 34bfef1f7ef456..d0679b8ede5174 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -406,6 +406,18 @@ struct __sanitizer_timeb {
short dstflag;
};
+#if SANITIZER_LINUX && !SANITIZER_ANDROID
+struct __sanitizer_timespec {
+ __sanitizer_time_t tv_sec;
+ long tv_nsec;
+};
+
+struct __sanitizer_itimerspec {
+ struct __sanitizer_timespec it_interval;
+ struct __sanitizer_timespec it_value;
+};
+#endif
+
struct __sanitizer_ether_addr {
u8 octet[6];
};
``````````
</details>
https://github.com/llvm/llvm-project/pull/77197
More information about the llvm-commits
mailing list