[PATCH v8 3/4] Netlink: handle multi netlink messages
Dmitry V. Levin
ldv at altlinux.org
Tue Jul 5 12:54:19 UTC 2016
On Tue, Jul 05, 2016 at 12:03:53PM +0000, Fabien Siron wrote:
> Quoting Dmitry V. Levin (2016-07-04 22:14:40)
> > On Wed, Jun 29, 2016 at 12:20:00PM +0000, Fabien Siron wrote:
[...]
> > > +void
> > > +decode_netlink(struct tcb *tcp, unsigned long addr, unsigned long total_size) {
> > > + struct nlmsghdr nlmsghdr;
> > > + unsigned long elt, size = total_size;
> > > + int print_array = 0;
> > > +
> > > + for (elt = 0; fetch_nlmsg(tcp, &nlmsghdr, addr, size);
> > > + addr = next_nlmsg(&nlmsghdr, addr, &size), elt++) {
> > > + if (elt == max_strlen && abbrev(tcp)) {
> > > + tprints("...");
> > > + break;
> > > + }
> > > + if (nlmsghdr.nlmsg_len < sizeof(struct nlmsghdr))
> > > + break;
> >
> > This edition of decode_netlink will print nothing if addr == NULL,
> > or if the first nlmsghdr.nlmsg_len < sizeof(struct nlmsghdr).
>
> What should be printed in these cases?
If decode_netlink is called with addr == NULL, it should print
printaddr(addr); if nlmsghdr.nlmsg_len < sizeof(struct nlmsghdr),
it should print this faulty nlmsghdr.
> > Please add to the test all pathological cases we discussed so far.
> >
>
> So let's add a test where nlmsghdr->nlmsg_len is 0 and a test with
> nlmsghdr->nlmsg_len is greater than len. Do you have other pathological cases
> in mind?
- addr == NULL
- total_size == 0
- the first/next nlmsghdr is unfetchable
- the first/next nlmsghdr has nlmsg_len < sizeof(struct nlmsghdr)
- the first/next nlmsghdr has nlmsg_len > total_size
--
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/20160705/e28bb738/attachment.bin>
More information about the Strace-devel
mailing list