strace cant parse struct msghdr RHEL

Eugene Syromyatnikov evgsyr at gmail.com
Fri Feb 10 21:47:14 UTC 2017


On Fri, Feb 10, 2017 at 9:20 PM, Al Gambardella <agam.email at gmail.com> wrote:
> I attached strace to a running process and I am trying to understand
> what strace is telling me regarding the select system call. Here are
> two lines of the strace output below:
>
>  _newselect(17, NULL, NULL, [16], {0, 0}) = 0 (Timeout)
>  _newselect(9, [8], NULL, NULL, {0, 0}) = 1 (in [8], left {0, 0})
>
> I know you can pass a timeval struct of all zeros indicating don't
> block at all just check the descriptors and return immediately.
>
> Treating each line above as a separate case:
> Is it possible to determine if the caller passed a timeval struct with
> an actual > 0 timeout value versus an all zero timeval struct?
The last argument of _newselect call is struct timeval, and strace
decodes it. Note that since 4.15, strace prints field values for this
type (it was decided that consistency and readability are more
important than brevity of the output in this case).

> I am assuming that strace is showing the timeval struct after the
> kernel updates it
> and is not showing the timeval struct value the caller passed into
> select. Is this correct?
Yes, auxstr contains information regarding result of select syscall,
namedly fds in in/out/except state and the updated value of the fourth
argument.

> Thanks for any help
>
> On Tue, Oct 4, 2016 at 9:00 AM, Al Gambardella <agam.email at gmail.com> 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
>>
>> 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
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Strace-devel mailing list
> Strace-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/strace-devel



-- 
Eugene Syromyatnikov
mailto:evgsyr at gmail.com
xmpp:esyr at jabber.{ru|org}




More information about the Strace-devel mailing list