X-Git-Url: https://granicus.if.org/sourcecode?a=blobdiff_plain;f=socketutils.c;h=a646b5b2ce9ab0ad09bbc5ea846e47afb58c3ead;hb=ed29ac33bbe541cc10c51bef57cd76011df39e5d;hp=38b864cdf16919ca65b18f662550f24cdeeebda9;hpb=0b732f7e9dd0b3c6b7a5300c71b82ece3b2e3997;p=strace diff --git a/socketutils.c b/socketutils.c index 38b864cd..a646b5b2 100644 --- a/socketutils.c +++ b/socketutils.c @@ -252,6 +252,13 @@ receive_responses(struct tcb *tcp, const int fd, const unsigned long inode, static bool unix_send_query(struct tcb *tcp, const int fd, const unsigned long inode) { + /* + * The kernel bug was fixed in mainline by commit v4.5-rc6~35^2~11 + * and backported to stable/linux-4.4.y by commit v4.4.4~297. + */ + const uint16_t dump_flag = + os_release < KERNEL_VERSION(4, 4, 4) ? NLM_F_DUMP : 0; + struct { const struct nlmsghdr nlh; const struct unix_diag_req udr; @@ -259,13 +266,14 @@ unix_send_query(struct tcb *tcp, const int fd, const unsigned long inode) .nlh = { .nlmsg_len = sizeof(req), .nlmsg_type = SOCK_DIAG_BY_FAMILY, - .nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST + .nlmsg_flags = NLM_F_REQUEST | dump_flag }, .udr = { .sdiag_family = AF_UNIX, .udiag_ino = inode, .udiag_states = -1, - .udiag_show = UDIAG_SHOW_NAME | UDIAG_SHOW_PEER + .udiag_show = UDIAG_SHOW_NAME | UDIAG_SHOW_PEER, + .udiag_cookie = { ~0U, ~0U } } }; return send_query(tcp, fd, &req, sizeof(req)); @@ -363,8 +371,7 @@ netlink_send_query(struct tcb *tcp, const int fd, const unsigned long inode) }, .ndr = { .sdiag_family = AF_NETLINK, - .sdiag_protocol = NDIAG_PROTO_ALL, - .ndiag_show = NDIAG_SHOW_MEMINFO + .sdiag_protocol = NDIAG_PROTO_ALL } }; return send_query(tcp, fd, &req, sizeof(req));