@@ -535,6 +535,42 @@ INTERCEPTOR(int, shm_unlink, const char *name) {
535
535
}
536
536
537
537
// Sockets
538
+ INTERCEPTOR (int , getaddrinfo, const char *node, const char *service,
539
+ const struct addrinfo *hints, struct addrinfo **res) {
540
+ __rtsan_notify_intercepted_call (" getaddrinfo" );
541
+ return REAL (getaddrinfo)(node, service, hints, res);
542
+ }
543
+
544
+ INTERCEPTOR (int , getnameinfo, const struct sockaddr *sa, socklen_t salen,
545
+ char *host, socklen_t hostlen, char *serv, socklen_t servlen,
546
+ int flags) {
547
+ __rtsan_notify_intercepted_call (" getnameinfo" );
548
+ return REAL (getnameinfo)(sa, salen, host, hostlen, serv, servlen, flags);
549
+ }
550
+
551
+ INTERCEPTOR (int , bind, int socket, const struct sockaddr *address,
552
+ socklen_t address_len) {
553
+ __rtsan_notify_intercepted_call (" bind" );
554
+ return REAL (bind)(socket, address, address_len);
555
+ }
556
+
557
+ INTERCEPTOR (int , listen, int socket, int backlog) {
558
+ __rtsan_notify_intercepted_call (" listen" );
559
+ return REAL (listen)(socket, backlog);
560
+ }
561
+
562
+ INTERCEPTOR (int , accept, int socket, struct sockaddr *address,
563
+ socklen_t *address_len) {
564
+ __rtsan_notify_intercepted_call (" accept" );
565
+ return REAL (accept)(socket, address, address_len);
566
+ }
567
+
568
+ INTERCEPTOR (int , connect, int socket, const struct sockaddr *address,
569
+ socklen_t address_len) {
570
+ __rtsan_notify_intercepted_call (" connect" );
571
+ return REAL (connect)(socket, address, address_len);
572
+ }
573
+
538
574
INTERCEPTOR (int , socket, int domain, int type, int protocol) {
539
575
__rtsan_notify_intercepted_call (" socket" );
540
576
return REAL (socket)(domain, type, protocol);
@@ -648,14 +684,20 @@ void __rtsan::InitializeInterceptors() {
648
684
INTERCEPT_FUNCTION (usleep);
649
685
INTERCEPT_FUNCTION (nanosleep);
650
686
651
- INTERCEPT_FUNCTION (socket);
687
+ INTERCEPT_FUNCTION (accept);
688
+ INTERCEPT_FUNCTION (bind);
689
+ INTERCEPT_FUNCTION (connect);
690
+ INTERCEPT_FUNCTION (getaddrinfo);
691
+ INTERCEPT_FUNCTION (getnameinfo);
692
+ INTERCEPT_FUNCTION (listen);
693
+ INTERCEPT_FUNCTION (recv);
694
+ INTERCEPT_FUNCTION (recvfrom);
695
+ INTERCEPT_FUNCTION (recvmsg);
652
696
INTERCEPT_FUNCTION (send);
653
697
INTERCEPT_FUNCTION (sendmsg);
654
698
INTERCEPT_FUNCTION (sendto);
655
- INTERCEPT_FUNCTION (recv);
656
- INTERCEPT_FUNCTION (recvmsg);
657
- INTERCEPT_FUNCTION (recvfrom);
658
699
INTERCEPT_FUNCTION (shutdown);
700
+ INTERCEPT_FUNCTION (socket);
659
701
}
660
702
661
703
#endif // SANITIZER_POSIX
0 commit comments