Skip to content

Commit 619a006

Browse files
authored
[compiler-rt] eventfd api interception on freebsd. (llvm#76564)
1 parent 273aefe commit 619a006

5 files changed

+11
-4
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6785,7 +6785,7 @@ INTERCEPTOR(SSIZE_T, sendto, int fd, void *buf, SIZE_T len, int flags,
67856785
#endif
67866786

67876787
#if SANITIZER_INTERCEPT_EVENTFD_READ_WRITE
6788-
INTERCEPTOR(int, eventfd_read, int fd, u64 *value) {
6788+
INTERCEPTOR(int, eventfd_read, int fd, __sanitizer_eventfd_t *value) {
67896789
void *ctx;
67906790
COMMON_INTERCEPTOR_ENTER(ctx, eventfd_read, fd, value);
67916791
COMMON_INTERCEPTOR_FD_ACCESS(ctx, fd);
@@ -6796,7 +6796,7 @@ INTERCEPTOR(int, eventfd_read, int fd, u64 *value) {
67966796
}
67976797
return res;
67986798
}
6799-
INTERCEPTOR(int, eventfd_write, int fd, u64 value) {
6799+
INTERCEPTOR(int, eventfd_write, int fd, __sanitizer_eventfd_t value) {
68006800
void *ctx;
68016801
COMMON_INTERCEPTOR_ENTER(ctx, eventfd_write, fd, value);
68026802
if (fd >= 0) {

compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@
463463
(SI_LINUX || SI_MAC || SI_WINDOWS || SI_FREEBSD || SI_NETBSD || SI_SOLARIS)
464464
#define SANITIZER_INTERCEPT_RECV_RECVFROM SI_POSIX
465465
#define SANITIZER_INTERCEPT_SEND_SENDTO SI_POSIX
466-
#define SANITIZER_INTERCEPT_EVENTFD_READ_WRITE SI_LINUX
466+
#define SANITIZER_INTERCEPT_EVENTFD_READ_WRITE (SI_LINUX || SI_FREEBSD)
467467

468468
#define SI_STAT_LINUX (SI_LINUX && __GLIBC_PREREQ(2, 33))
469469
#define SANITIZER_INTERCEPT_STAT \

compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,8 @@ struct __sanitizer_cpuset {
726726

727727
typedef struct __sanitizer_cpuset __sanitizer_cpuset_t;
728728
extern unsigned struct_cpuset_sz;
729+
730+
typedef unsigned long long __sanitizer_eventfd_t;
729731
} // namespace __sanitizer
730732

731733
# define CHECK_TYPE_SIZE(TYPE) \

compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,8 @@ struct __sanitizer_cookie_io_functions_t {
938938
__sanitizer_cookie_io_seek seek;
939939
__sanitizer_cookie_io_close close;
940940
};
941+
942+
typedef unsigned long long __sanitizer_eventfd_t;
941943
#endif
942944

943945
#define IOC_NRBITS 8

compiler-rt/test/msan/Linux/eventfd.cpp renamed to compiler-rt/test/msan/eventfd.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// RUN: %clangxx_msan -O0 %s -o %t && %run %t 2>&1
1+
/* RUN: %clangxx_msan -O0 %s -o %t && %run %t 2>&1
2+
3+
REQUIRES: target={{.*(linux|freebsd).*}}
4+
*/
25

36
#include <assert.h>
47
#include <sys/eventfd.h>

0 commit comments

Comments
 (0)