On Wed, Sep 23, 2015 at 01:45:52AM +0200, Gabriel Laskar wrote: > When a command number was decoded through ioctl_decode_command_number(), > there was no check for conflicts with other potential ioctls numbers. > > For example: > ioctl(fd, MCE_GET_RECORD_LEN, &i); > output: > ioctl(3, MIXER_READ(1), 0x7ffddce74a58) = 0 > instead of: > ioctl(3, MIXER_READ(1) or MCE_GET_RECORD_LEN, 0x7ffee435ce08) = 0
Indeed. > --- a/ioctl.c > +++ b/ioctl.c > @@ -277,15 +277,16 @@ SYS_FUNC(ioctl) > if (entering(tcp)) { > printfd(tcp, tcp->u_arg[0]); > tprints(", "); > - if (!ioctl_decode_command_number(tcp)) { > - iop = ioctl_lookup(tcp->u_arg[1]); > - if (iop) { > - tprints(iop->symbol); > - while ((iop = ioctl_next_match(iop))) > - tprintf(" or %s", iop->symbol); > - } else { > + ret = ioctl_decode_command_number(tcp); > + iop = ioctl_lookup(tcp->u_arg[1]); > + if (!iop && !ret) { > ioctl_print_code(tcp->u_arg[1]); > - } > + } else { > + if (ret) > + tprints(" or "); > + tprints(iop->symbol); What if iop == NULL? Please check your patch with tests/ioctl.c -- the test should pass. > + while ((iop = ioctl_next_match(iop))) > + tprintf(" or %s", iop->symbol); > } > ret = ioctl_decode(tcp); > } else { Please add a case for this to the test, e.g. --- tests/ioctl.c +++ tests/ioctl.c @@ -38,6 +38,7 @@ ioctl(-1, HIDIOCGVERSION, &data) != -1 || ioctl(-1, HIDIOCGPHYS(8), &data) != -1 || ioctl(-1, EVIOCGBIT(EV_KEY, 8), &data) != -1 || + ioctl(-1, _IOW('M', 14, int), &data) != -1 || ioctl(-1, _IOR(0xde, 0xad, data), &data) != -1) return 77; -- ldv
pgpLrlsdicSnL.pgp
Description: PGP signature
------------------------------------------------------------------------------ Monitor Your Dynamic Infrastructure at Any Scale With Datadog! Get real-time metrics from all of your servers, apps and tools in one place. SourceForge users - Click here to start your Free Trial of Datadog now! http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel