Skip to content

Conversation

@devnexen
Copy link
Member

@devnexen devnexen commented Jan 6, 2024

…erception.

@llvmbot
Copy link
Member

llvmbot commented Jan 6, 2024

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: David CARLIER (devnexen)

Changes

…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 --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]; }; 
@github-actions
Copy link

github-actions bot commented Jan 6, 2024

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 3fb0d8dc808cb7f315670d76109edc9c57cb3d90 6598044906c6c47691dc378b5412ed6d6b99dc14 -- compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cpp compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
View the diff from clang-format here.
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc index a40a771bc3..5544fb9aeb 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc @@ -6376,7 +6376,8 @@ INTERCEPTOR(char *, getpass, const char *prompt) { #endif #if SANITIZER_INTERCEPT_TIMERFD -INTERCEPTOR(int, timerfd_settime, int fd, int flags, __sanitizer_itimerspec *new_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, @@ -6396,9 +6397,9 @@ INTERCEPTOR(int, timerfd_gettime, int fd, __sanitizer_itimerspec *curr_value) { COMMON_INTERCEPTOR_WRITE_RANGE(ctx, curr_value, struct_itimerspec_sz); return res; } -#define INIT_TIMERFD \ - COMMON_INTERCEPT_FUNCTION(timerfd_settime); \ - COMMON_INTERCEPT_FUNCTION(timerfd_gettime); +# define INIT_TIMERFD \ + COMMON_INTERCEPT_FUNCTION(timerfd_settime); \ + COMMON_INTERCEPT_FUNCTION(timerfd_gettime); #else #define INIT_TIMERFD #endif 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 189bbfe728..a9c3356f40 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_linux.cpp @@ -51,9 +51,9 @@ # include <linux/aio_abi.h> # if !SANITIZER_ANDROID -# include <sys/statfs.h> # include <linux/perf_event.h> # include <linux/time.h> +# include <sys/statfs.h> # endif using namespace __sanitizer; @@ -84,7 +84,7 @@ 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 +# endif COMPILER_CHECK(iocb_cmd_pread == IOCB_CMD_PREAD); COMPILER_CHECK(iocb_cmd_pwrite == IOCB_CMD_PWRITE); 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 d0679b8ede..473ee19dd8 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h @@ -406,7 +406,7 @@ struct __sanitizer_timeb { short dstflag; }; -#if SANITIZER_LINUX && !SANITIZER_ANDROID +# if SANITIZER_LINUX && !SANITIZER_ANDROID struct __sanitizer_timespec { __sanitizer_time_t tv_sec; long tv_nsec; @@ -416,7 +416,7 @@ struct __sanitizer_itimerspec { struct __sanitizer_timespec it_interval; struct __sanitizer_timespec it_value; }; -#endif +# endif struct __sanitizer_ether_addr { u8 octet[6]; 
@devnexen devnexen added this to the LLVM 18.0.X Release milestone Jan 6, 2024
@nikic nikic removed this from the LLVM 18.X Release milestone Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment