Skip to contentSkip to conversation

Extracting the payload from select, poll, epoll_ctl and epoll_wait

RFC Mathieu Desnoyers 1 participant 1 message Mar 24, 2016 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20160322224832.GJ29041@sinkpad

#1 lore raw
Quoted 10 lines · ----- On Mar 22, 2016, at 6:48 PM, Julien Desfossez [email protected]…

Hi,

Currently with these system calls, we only have the address of a user-space pointer containing the interesting data, so we cannot do any analysis.

For LTTng 2.9, we want to extract the content of these system calls to get more insights. We try to stay as close as possible to the layout received in order to avoid long processing in the critical path.

Quoted 6 lines

Here are the proposed outputs:
- select: bitmask of FDs represented as a sequence of long, so the position of each bit set is the number of a FD. Only extract the necessary fields (select already receives the maximum FD set). select is limited at 1024 FDs, so we output at most 16 longs on 64-bits and 32 on 32-bits architectures.

I would be tempted to represent the bitmask as a sequence of bytes, making it perhaps a bit more visually clobbered, but simplify interpretation of mapping from bit number to sequence offset compared to a sequence of unsigned long, which length differ depending on the architecture bitness.

Thanks,

Mathieu

Quoted 33 lines

- poll: for each FD in the poll set, output the FD and the flags (events), each possible event is a bit. On exit, only extract the relevant FDs.
- epoll_ctl: output the FD, flags (events) and the data. The data is a union that can contain anything, we propose to output it twice: as a "uint64_t" in hexadecimal (for the u64 fields) and as a signed "int" in decimal (for the "fd" field).
- epoll_wait: on return, if FDs are returned, extract the list in the same format as in epoll_ctl.

Here is an example output:
https://paste.debian.net/plain/418248

For those interested in the CTF metadata, here it is:
https://paste.debian.net/plain/418245

You will notice, that this output can be very verbose with long list of FDs. To address that, we plan to add pretty priting hints in the next version of CTF (CTF2) to inform the viewers that the fields are bitmasks (in this case, we only care about the position of the bits set), or that the structures have bit-sized fields (in this case, we only want to output the name of the fields where the bit is set).

This formatting decision has an impact on the analysis tools, so if you have any comments on the proposed output, now is the time.

Thanks,

Julien
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Signature · 7 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev