<div dir="ltr"><div class="gmail_extra"><div class="gmail_extra">On Tue, Mar 28, 2017 at 10:37 AM, Dmitry V. Levin wrote:</div><div class="gmail_extra">>On Mon, Mar 27, 2017 at 10:40:05PM +0800, JingPiao Chen wrote:</div><div class="gmail_extra">>> 2017-03-27 6:16 GMT+08:00 Dmitry V. Levin <ldv@...> wrote:</div><div class="gmail_extra">>> >On Sun, Mar 19, 2017 at 12:25:11PM +0800, JingPiao Chen wrote:</div><div class="gmail_extra">>> >> Hello strace-developers:</div><div class="gmail_extra">>> >> My name is JingPiao Chen. I'am a Computer Science sophomore from</div><div class="gmail_extra">>> >> Guangdong Pharmaceutical University. I am interested in Netlink socket</div><div class="gmail_extra">>> >> parsers suggested by Gabriel Laskar and Dmitry V. Levin. I am familiar</div><div class="gmail_extra">>> >> with C, git, shell script, and gdb.</div><div class="gmail_extra">>> >></div><div class="gmail_extra">>> >> My current work base on the code by Fabien Siron</div><div class="gmail_extra">>> >> (<a href="https://github.com/Saruta/strace/tree/netlink">https://github.com/Saruta/strace/tree/netlink</a>)</div><div class="gmail_extra">>> ></div><div class="gmail_extra">>> >btw, there was a short conversation on #strace a month ago about this code:</div><div class="gmail_extra">>> ><a href="https://strace.io/logs/strace/2017-02-28">https://strace.io/logs/strace/2017-02-28</a></div><div class="gmail_extra">>> ></div><div class="gmail_extra">>> >> The work I do:</div><div class="gmail_extra">>> >> (master:<a href="https://github.com/ppiao/strace/tree/master">https://github.com/ppiao/strace/tree/master</a>)</div><div class="gmail_extra">>> >> 1.Merge it into latest main tree.</div><div class="gmail_extra">>> >> 2.Fix coding style.</div><div class="gmail_extra">>> >> 3.Rewrite decode_netlink_flags() and decode_netlink_type().</div><div class="gmail_extra">>> >> 4.Rewrite and rename decode_inet_diag_sockid().</div><div class="gmail_extra">>> >> 5.Rewrite decode_nlattr_data().</div><div class="gmail_extra">>> >> 6.Decode some nested attributes.</div><div class="gmail_extra">>> ></div><div class="gmail_extra">>> >Why have you squashed all commits made by Fabien into a single commit?</div><div class="gmail_extra">>> >Do you think it's easier to review a big commit rather than a series of</div><div class="gmail_extra">>> >small commits?</div><div class="gmail_extra">>> </div><div class="gmail_extra">>> No, I don't know a big commit not easy to review.</div><div class="gmail_extra">></div><div class="gmail_extra">>Sorry, I don't understand.  Do you mean that you haven't seen a commit big</div><div class="gmail_extra">>enough to make review a herculean job?</div><div class="gmail_extra"><br></div><div class="gmail_extra">No, I lack of the experience of code review, don't know review a big commit</div><div class="gmail_extra">is a herculean job, sorry.</div><div class="gmail_extra"><br></div><div class="gmail_extra">></div><div class="gmail_extra">>> I think all this commits</div><div class="gmail_extra">>> implement enhance netlink socket decode.</div><div class="gmail_extra">>> Do you think separate three commits, or can you give me some advice?</div><div class="gmail_extra">></div><div class="gmail_extra">>The general idea is that every logically separate change goes</div><div class="gmail_extra">>to an individual commit.</div><div class="gmail_extra">>The netlink branch made by Fabien follows this approach.</div><div class="gmail_extra">>Can you follow it, too?</div><div class="gmail_extra">Ok.</div><div class="gmail_extra">></div><div class="gmail_extra">>> 1.Add support for NLMSG_ERROR and NLMSG_DONE.</div><div class="gmail_extra">>> 2.Introduce getfdnlproto and enhanced decoding of struct nlmsghdr</div><div class="gmail_extra">>> nlmsg_type and nlmsg_flags.</div><div class="gmail_extra">>> 3.Introduce a dummy netlink attributes parser and decoding of</div><div class="gmail_extra">>> NETLINK_SOCK_DIAG protocol.</div><div class="gmail_extra">></div><div class="gmail_extra">>Sorry, I don't understand, is it something you've done already,</div><div class="gmail_extra">>or are you going to implement this?</div><div class="gmail_extra">></div><div class="gmail_extra">>> >> (netlink branch:<a href="https://github.com/ppiao/strace/tree/netlink">https://github.com/ppiao/strace/tree/netlink</a>)</div><div class="gmail_extra">>> >> 7.Rewrite getfdnlproto().</div><div class="gmail_extra">>> >> 8.Do not use optional_data in struct print_iovec_config,</div><div class="gmail_extra">>> >> when call print_iovec, pass tcp->u_arg[0] as fd.</div><div class="gmail_extra">>> >> Is this right? Like this:</div><div class="gmail_extra">>> >></div><div class="gmail_extra">>> >> diff --git a/io.c b/io.c</div><div class="gmail_extra">>> >> index a4f6b8e..6b43d7d 100644</div><div class="gmail_extra">>> >> --- a/io.c</div><div class="gmail_extra">>> >> +++ b/io.c</div><div class="gmail_extra">>> >> @@ -94,7 +94,7 @@ print_iovec(struct tcb *tcp, void *elem_buf, size_t</div><div class="gmail_extra">>> >> elem_size, void *data)</div><div class="gmail_extra">>> >>   len = c->data_size;</div><div class="gmail_extra">>> >>   if (c->data_size != (kernel_ulong_t) -1)</div><div class="gmail_extra">>> >>   c->data_size -= len;</div><div class="gmail_extra">>> >> - decode_netlink(tcp, iov[0], iov[1]);</div><div class="gmail_extra">>> >> + decode_netlink(tcp, tcp->u_arg[0], iov[0], iov[1]);</div><div class="gmail_extra">>> ></div><div class="gmail_extra">>> >Why tcp->u_arg[0]?  It doesn't look correct.</div><div class="gmail_extra">>> </div><div class="gmail_extra">>> Because send, sendto, recv, recvfrom, sendmsg, sendmmsg, recvmsg and</div><div class="gmail_extra">>> recvmmsg</div><div class="gmail_extra">>> the first argument are fd.</div><div class="gmail_extra">></div><div class="gmail_extra">>Are you absolutely sure that in *all* cases the descriptor is passed</div><div class="gmail_extra">>via the 1st syscall argument?</div><div class="gmail_extra">></div><div class="gmail_extra">>The common rule is not to make such assumptions unless you are 100% sure.</div><div class="gmail_extra">></div><div class="gmail_extra">>> >> I want to know the goal of Netlink socket parsers project.</div><div class="gmail_extra">>> ></div><div class="gmail_extra">>> >Obviously, the goal is to implement parsers for assigned netlink families.</div><div class="gmail_extra">>> I upload a draft of my proposal[1]. Please provide some feedback.</div><div class="gmail_extra">>> Thank you.</div><div class="gmail_extra">>> </div><div class="gmail_extra">>> [1]</div><div class="gmail_extra">>> <a href="https://docs.google.com/document/d/15cVdpdBP6jzEGP74tSG18ymi278_P2uv8MhRus-CuPI/edit?usp=sharing">https://docs.google.com/document/d/15cVdpdBP6jzEGP74tSG18ymi278_P2uv8MhRus-CuPI/edit?usp=sharing</a></div><div class="gmail_extra">></div><div class="gmail_extra">>Why do you want to rewrite getfdnlproto?</div><div class="gmail_extra">>What's wrong with optional_data?</div><div class="gmail_extra"><br></div><div class="gmail_extra">They are right. I rewirte them because they changed a lot of previous code,</div><div class="gmail_extra">not easy to review.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Thank you.</div><div class="gmail_extra">--</div><div class="gmail_extra">JingPiao Chen</div></div></div>