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

Eugene Syromiatnikov esyr at redhat.com
Tue Aug 14 00:09:15 UTC 2018


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.

> @@ -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".

> -			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?

>  		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.


More information about the Strace-devel mailing list