Wrong traces for connected sockets of socketpair with -ff option
Masatake YAMATO
yamato at redhat.com
Tue Sep 18 17:40:44 UTC 2018
Reproduced event with -f option.
It seems that strace failed to get the information for the sockets.
========================================================================
[jet at localhost]~/var/strace% ./strace -o /tmp/LOGX -f -yy -e socketpair /usr/bin/google-chrome
./strace -o /tmp/LOGX -f -yy -e socketpair /usr/bin/google-chrome
./strace: ERROR is received while getting socket info for 4718911
./strace: ERROR is received while getting socket info for 4718912
./strace: ERROR is received while getting socket info for 4718955
diff --git a/socketutils.c b/socketutils.c
index c3f28a1b..60bef756 100644
--- a/socketutils.c
+++ b/socketutils.c
@@ -240,6 +240,9 @@ receive_responses(struct tcb *tcp, const int fd, const unsigned long inode,
if (!is_nlmsg_ok(h, ret))
return false;
for (; is_nlmsg_ok(h, ret); h = NLMSG_NEXT(h, ret)) {
+ if (h->nlmsg_type == NLMSG_ERROR)
+ error_msg("ERROR is received while getting socket info for %lu",
+ inode);
if (h->nlmsg_type != expected_msg_type)
return false;
const int rc = parser(NLMSG_DATA(h),
========================================================================
The kernel may send more infomation about the error, printing it may be the
first step for fixing this.
Masatake YAMATO
> Hi everyone,
>
> I might come cross a bug for syscall 'socketpair' with option -ff.
>
> When using -ff, strace is supposed to display the ip:port associated with
> the sockfd.
>
> According to my understanding, connected sockets should look like:
> socketpair(AF_UNIX, SOCK_STREAM, 0, [27<UNIX:[7162769->7162770]>,
> 28<UNIX:[7162770->7162769]>]) = 0
>
> The syscall 'socketpair' always generates connected socket, but somehow,
> strace also generates the following trace:
> socketpair(AF_UNIX, SOCK_STREAM, 0, [223<UNIX:[7162686]>,
> 224<UNIX:[7162687]>]) = 0
> which looks like connectless sockets.
>
> This happens everytime.
> To triger this, by using $strace -f -yy -o chromium chromium-browser
>
> Best,
> Zhouyang
More information about the Strace-devel
mailing list