[compiler-rt] [compiler-rt][rtsan] intercept accept4 syscall. (PR #117278)
David CARLIER via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 21 18:49:11 PST 2024
https://github.com/devnexen created https://github.com/llvm/llvm-project/pull/117278
None
>From 1ec4aa255e9025e5f2f97c8f8d21bd5b85a8f1aa Mon Sep 17 00:00:00 2001
From: David Carlier <devnexen at gmail.com>
Date: Fri, 22 Nov 2024 02:48:11 +0000
Subject: [PATCH] [compiler-rt][rtsan] intercept accept4 syscall.
---
compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp b/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp
index 91d023e858ba3b..47dd94852ff3c2 100644
--- a/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp
+++ b/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp
@@ -643,6 +643,14 @@ INTERCEPTOR(int, shutdown, int socket, int how) {
return REAL(shutdown)(socket, how);
}
+#if SANITIZER_INTERCEPT_ACCEPT4
+INTERCEPTOR(int, accept4, int socket, struct sockaddr *address,
+ socklen_t *address_len, int flags) {
+ __rtsan_notify_intercepted_call("accept4");
+ return REAL(accept4)(socket, address, address_len, flags);
+}
+#endif
+
// I/O Multiplexing
INTERCEPTOR(int, poll, struct pollfd *fds, nfds_t nfds, int timeout) {
@@ -840,6 +848,9 @@ void __rtsan::InitializeInterceptors() {
INTERCEPT_FUNCTION(sendto);
INTERCEPT_FUNCTION(shutdown);
INTERCEPT_FUNCTION(socket);
+#if SANITIZER_INTERCEPT_ACCEPT4
+ INTERCEPT_FUNCTION(accept4);
+#endif
RTSAN_MAYBE_INTERCEPT_SELECT;
INTERCEPT_FUNCTION(pselect);
More information about the llvm-commits
mailing list