-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
[compiler-rt][rtsan] intercept accept4 syscall. #117278
Conversation
@llvm/pr-subscribers-compiler-rt-sanitizer Author: David CARLIER (devnexen) ChangesFull diff: https://github.com/llvm/llvm-project/pull/117278.diff 1 Files Affected:
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);
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a unit test for this in rtsan_test_interceptors_posix
1ec4aa2
to
d947f9f
Compare
✅ With the latest revision this PR passed the C/C++ code formatter. |
d947f9f
to
1f2f70d
Compare
@devnexen Thanks for the contribution. If you do any future work on rtsan please add me as a reviewer if you want eyes on it, otherwise I may miss it. |
roger ! |
No description provided.