Skip to content

[compiler-rt] eventfd api interception on freebsd. #76564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6785,7 +6785,7 @@ INTERCEPTOR(SSIZE_T, sendto, int fd, void *buf, SIZE_T len, int flags,
#endif

#if SANITIZER_INTERCEPT_EVENTFD_READ_WRITE
INTERCEPTOR(int, eventfd_read, int fd, u64 *value) {
INTERCEPTOR(int, eventfd_read, int fd, __sanitizer_eventfd_t *value) {
void *ctx;
COMMON_INTERCEPTOR_ENTER(ctx, eventfd_read, fd, value);
COMMON_INTERCEPTOR_FD_ACCESS(ctx, fd);
Expand All @@ -6796,7 +6796,7 @@ INTERCEPTOR(int, eventfd_read, int fd, u64 *value) {
}
return res;
}
INTERCEPTOR(int, eventfd_write, int fd, u64 value) {
INTERCEPTOR(int, eventfd_write, int fd, __sanitizer_eventfd_t value) {
void *ctx;
COMMON_INTERCEPTOR_ENTER(ctx, eventfd_write, fd, value);
if (fd >= 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@
(SI_LINUX || SI_MAC || SI_WINDOWS || SI_FREEBSD || SI_NETBSD || SI_SOLARIS)
#define SANITIZER_INTERCEPT_RECV_RECVFROM SI_POSIX
#define SANITIZER_INTERCEPT_SEND_SENDTO SI_POSIX
#define SANITIZER_INTERCEPT_EVENTFD_READ_WRITE SI_LINUX
#define SANITIZER_INTERCEPT_EVENTFD_READ_WRITE (SI_LINUX || SI_FREEBSD)

#define SI_STAT_LINUX (SI_LINUX && __GLIBC_PREREQ(2, 33))
#define SANITIZER_INTERCEPT_STAT \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,8 @@ struct __sanitizer_cpuset {

typedef struct __sanitizer_cpuset __sanitizer_cpuset_t;
extern unsigned struct_cpuset_sz;

typedef unsigned long long __sanitizer_eventfd_t;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it's the same time as posix, can you have just a single typedef there in part enabled for freebsd as well?

} // namespace __sanitizer

# define CHECK_TYPE_SIZE(TYPE) \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,8 @@ struct __sanitizer_cookie_io_functions_t {
__sanitizer_cookie_io_seek seek;
__sanitizer_cookie_io_close close;
};

typedef unsigned long long __sanitizer_eventfd_t;
#endif

#define IOC_NRBITS 8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// RUN: %clangxx_msan -O0 %s -o %t && %run %t 2>&1
/* RUN: %clangxx_msan -O0 %s -o %t && %run %t 2>&1

REQUIRES: target={{.*(linux|freebsd).*}}
*/

#include <assert.h>
#include <sys/eventfd.h>
Expand Down