[RFC/PATCH v1 1/3] fix decoder of ioctl EVIOCGBIT

Zhibin Li haoyouab at gmail.com
Tue Aug 14 12:20:19 UTC 2018


On Tue, Aug 14, 2018 at 8:08 AM Eugene Syromiatnikov <esyr at redhat.com>
wrote:

> On Fri, Aug 10, 2018 at 07:12:42PM +0800, Zhibin Li wrote:
> > EV_SYN in EVIOCGBIT should be decoded to get other event types EV_*, not
> > the precise event codes SYN_*.
>
> It's not EV_SYN, it's just EVIOCGBIT(0, ...) that returns bitmask with
> supported event types, it has nothing with synchronous events.
>
Yes you're right.

>
> > @@ -259,8 +259,8 @@ bit_ioctl(struct tcb *const tcp, const unsigned int
> ev_nr,
> >  {
> >       switch (ev_nr) {
>
> >               case EV_SYN:
> That probably shoud be changed to "case 0".
>
I missed this one.

>
> > -                     return decode_bitset(tcp, arg, evdev_sync,
> > -                                          SYN_MAX, "SYN_???",
> XT_INDEXED);
> > +                     return decode_bitset(tcp, arg, evdev_ev,
> > +                                          EV_MAX, "EV_???", XT_NORMAL);
> Why not XT_SORTED?
>
Oh I don't know the detailed usage of these three flags. I should look into
xlat code.

>
> >               case EV_KEY:
> >                       return decode_bitset(tcp, arg, evdev_keycode,
> >                                            KEY_MAX, "KEY_???",
> XT_INDEXED);
> > diff --git a/ioctl.c b/ioctl.c
> > index 93fb5263..d56bf69e 100644
> > --- a/ioctl.c
> > +++ b/ioctl.c
> > @@ -99,7 +99,11 @@ evdev_decode_number(const unsigned int code)
> >
> >       if (nr >= 0x20 && nr <= 0x20 + 0x1f) {
> >               tprints("EVIOCGBIT(");
> > -             printxval(evdev_ev, nr - 0x20, "EV_???");
> > +             /* There is no EV_SYN in EVIOCGBIT */
> > +             if (nr == 0x20)
> > +                     tprintf("0");
> > +             else
> > +                     printxval(evdev_ev, nr - 0x20, "EV_???");
> That doesn't go well with the concept of xlat styles; however, as it is,
> it doesn't break anything, at least.

Any documentation or  references regarding this concept?  I'm looking into
xlat.c and those related commits now.

>

-- 
> Strace-devel mailing list
> Strace-devel at lists.strace.io
> https://lists.strace.io/mailman/listinfo/strace-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20180814/033d8d19/attachment.html>


More information about the Strace-devel mailing list