strace cant parse struct msghdr RHEL

Dmitry V. Levin ldv at altlinux.org
Tue Oct 4 21:29:40 UTC 2016


On Tue, Oct 04, 2016 at 09:00:17AM -0400, Al Gambardella wrote:
> I downloaded strace version 4.13 and was able to build the source code
> and produce the strace executable. I need to see the all of the
> payload in the recvmsg and sendmsg calls. including the iov style
> arrays
> 
> My system is RHEL Server 5.8 Tikanga. Kernel version 2.6.18-348.el5

There is at least one known problems with strace on this platform related
to your case: the version of GNU awk is too old, it doesn't support
mpers.awk, so there is no reliable x86 personality support on x86_64, in
particular, all parsers that need to decode struct msghdr won't be able to
do it properly on x86_64 for x86 personality processes, and this is exactly
what you see in the strace output.

So the recipe is to use a newer operating system or at least a newer
version of GNU awk, or just trace 32-bit processes with a 32-bit strace.

> When I run strace with the following command line: ./strace -p <mypid>
> -e 'trace=recvmsg,sendmsg' -e write=8 -e read=8
> 
> I am getting the following output (which contains errors). Can someone
> explain why and if this can be fixed?
> 
> sendmsg(8, {msg_name=NULL, msg_namelen=-7630976, msg_iov=NULL,
> msg_iovlen=92, msg_control=[{cmsg_len=2048, cmsg_level=SOL_IP,
> cmsg_type=0x8f800000 /* IP_??? */}, {cmsg_len=2565867895,
> cmsg_level=0xc26cff8b /* SOL_??? */, cmsg_type=0x8cacff8b}, ...],
> msg_controllen=38647074816,
> msg_flags=MSG_DONTROUTE|MSG_CTRUNC|MSG_DONTWAIT|MSG_WAITALL|MSG_FIN|MSG_SYN|MSG_CONFIRM|MSG_MORE|0xff8b0010},
> 0) = 12 sendmsg(8, {msg_name=NULL, msg_namelen=-7623584, msg_iov=NULL,
> msg_iovlen=33655230453052149, msg_control=./strace: umoven: short read
> (13250 < 20480) @0xff8bac3e: Input/output error 0x2ff8bac3e,
> msg_controllen=38647082208,
> msg_flags=MSG_DONTROUTE|MSG_CTRUNC|MSG_TRUNC|MSG_SYN|MSG_CONFIRM|MSG_ERRQUEUE|MSG_MORE|0xff8b0010},
> 0) = 12 ./strace: Out of memory recvmsg(8, {msg_name=NULL,
> msg_namelen=-7623488, msg_iov=NULL, msg_iovlen=0, msg_control=NULL,
> msg_controllen=17869443930177667072,
> msg_flags=MSG_CTRUNC|MSG_TRUNC|MSG_WAITALL|MSG_CONFIRM|0xbe00010},
> MSG_WAITALL) = 4188 sendmsg(8, {msg_name=NULL, msg_namelen=-7623584,
> msg_iov=NULL, msg_iovlen=33655230453052149, msg_control=./strace:
> umoven: short read (13250 < 20480) @0xff8bac3e: Input/output error
> 0x2ff8bac3e, msg_controllen=38647082208,
> msg_flags=MSG_DONTROUTE|MSG_CTRUNC|MSG_TRUNC|MSG_SYN|MSG_CONFIRM|MSG_ERRQUEUE|MSG_MORE|0xff8b0010},
> 0) = 12 ./strace: Out of memory recvmsg(8, {msg_name=NULL,
> msg_namelen=-7623488, msg_iov=NULL, msg_iovlen=0, msg_control=NULL,
> msg_controllen=17869443930177667072,
> msg_flags=MSG_CTRUNC|MSG_TRUNC|MSG_WAITALL|MSG_CONFIRM|0xbe00010},
> MSG_WAITALL) = 12 recvmsg(8, {msg_name=NULL, msg_namelen=-7623488,
> msg_iov=NULL, msg_iovlen=0, msg_control=NULL,
> msg_controllen=17869443930177667072,
> msg_flags=MSG_CTRUNC|MSG_TRUNC|MSG_WAITALL|MSG_CONFIRM|0xbe00010},
> MSG_WAITALL) = 12 recvmsg(8, {msg_name=NULL, msg_namelen=-7623488,
> msg_iov=NULL, msg_iovlen=0, msg_control=NULL,
> msg_controllen=17869443930177667072,
> msg_flags=MSG_CTRUNC|MSG_TRUNC|MSG_WAITALL|MSG_CONFIRM|0xbe00010},
> MSG_WAITALL) = 4188 sendmsg(8, {msg_name=NULL, msg_namelen=-7623584,
> msg_iov=NULL, msg_iovlen=33655230453052149, msg_control=./strace:
> umoven: short read (13250 < 20480) @0xff8bac3e: Input/output error
> 0x2ff8bac3e, msg_controllen=38647082208,
> msg_flags=MSG_DONTROUTE|MSG_CTRUNC|MSG_TRUNC|MSG_SYN|MSG_CONFIRM|MSG_ERRQUEUE|MSG_MORE|0xff8b0010},
> 0) = 12 ./strace: Out of memory recvmsg(8, {msg_name=NULL,
> msg_namelen=-7623488, msg_iov=NULL, msg_iovlen=0, msg_control=NULL,
> msg_controllen=17869443930177667072,
> msg_flags=MSG_CTRUNC|MSG_TRUNC|MSG_WAITALL|MSG_CONFIRM|0xbe00010},
> MSG_WAITALL) = 4188 sendmsg(8, {msg_name=NULL, msg_namelen=-7623584,
> msg_iov=NULL, msg_iovlen=33655230453052149, msg_control=./strace:
> umoven: short read (13250 < 20480) @0xff8bac3e: Input/output error
> 0x2ff8bac3e, msg_controllen=38647082208,
> msg_flags=MSG_DONTROUTE|MSG_CTRUNC|MSG_TRUNC|MSG_SYN|MSG_CONFIRM|MSG_ERRQUEUE|MSG_MORE|0xff8b0010},
> 0) = 12 ./strace: Out of memory recvmsg(8, {msg_name=NULL,
> msg_namelen=-7623488, msg_iov=NULL, msg_iovlen=0, msg_control=NULL,
> msg_controllen=17869443930177667072,
> msg_flags=MSG_CTRUNC|MSG_TRUNC|MSG_WAITALL|MSG_CONFIRM|0xbe00010},
> MSG_WAITALL) = 12 recvmsg(8, {msg_name=NULL, msg_namelen=-7623488,
> msg_iov=NULL, msg_iovlen=0, msg_control=NULL,
> msg_controllen=17869443930177667072,
> msg_flags=MSG_CTRUNC|MSG_TRUNC|MSG_WAITALL|MSG_CONFIRM|0xbe00010},
> MSG_WAITALL) = 4188 sendmsg(8, {msg_name=NULL, msg_namelen=-7623584,
> msg_iov=NULL, msg_iovlen=33655230453052149, msg_control=./strace:
> umoven: short read (13250 < 20480) @0xff8bac3e: Input/output error
> 0x2ff8bac3e, msg_controllen=38647082208,
> msg_flags=MSG_DONTROUTE|MSG_CTRUNC|MSG_TRUNC|MSG_SYN|MSG_CONFIRM|MSG_ERRQUEUE|MSG_MORE|0xff8b0010},
> 0) = 12 ./strace: Out of memory recvmsg(8, {msg_name=NULL,
> msg_namelen=-7623488, msg_iov=NULL, msg_iovlen=0, msg_control=NULL,
> msg_controllen=17869443930177667072,
> msg_flags=MSG_CTRUNC|MSG_TRUNC|MSG_WAITALL|MSG_CONFIRM|0xbe00010},
> MSG_WAITALL) = 4188 sendmsg(8, {msg_name=NULL, msg_namelen=-7631616,
> msg_iov=NULL, msg_iovlen=10, msg_control=[{cmsg_len=17920,
> cmsg_level=SOL_IP, cmsg_type=0x8d000000 /* IP_??? */},
> {cmsg_len=3158845, cmsg_level=0x5f534d4e /* SOL_??? */,
> cmsg_type=0x4e5f534f}, ...], msg_controllen=300847264664,
> msg_flags=MSG_DONTROUTE|MSG_CTRUNC|MSG_DONTWAIT|MSG_EOR|MSG_SYN|MSG_CONFIRM|MSG_MORE|0xff8b0010},
> 0) = 74 sendmsg(8, {msg_name=NULL, msg_namelen=-7631504, msg_iov=NULL,
> msg_iovlen=29510720283184520, msg_control=[{cmsg_len=2048,
> cmsg_level=SOL_IP, cmsg_type=0x8d700000 /* IP_??? */},
> {cmsg_len=3971745833, cmsg_level=0x7ff00bc7 /* SOL_??? */,
> cmsg_type=0xbda}, ...], msg_controllen=38647074288,
> msg_flags=MSG_DONTROUTE|MSG_CTRUNC|MSG_DONTWAIT|MSG_WAITALL|MSG_SYN|MSG_CONFIRM|MSG_MORE|0xff8b0000},
> 0) = 12 ./strace: Out of memory sendmsg(8, {msg_name=NULL,
> msg_namelen=-7623584, msg_iov=NULL, msg_iovlen=33655230453052149,
> msg_control=./strace: umoven: short read (13250 < 20480) @0xff8bac3e:
> Input/output error 0x2ff8bac3e, msg_controllen=38647082208,
> msg_flags=MSG_DONTROUTE|MSG_CTRUNC|MSG_TRUNC|MSG_SYN|MSG_CONFIRM|MSG_ERRQUEUE|MSG_MORE|0xff8b0010},
> 0) = 12 ./strace: Out of memory


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20161005/544c4b96/attachment.bin>


More information about the Strace-devel mailing list