[PATCH v3] Add decoding for evdev ioctls.
Dmitry V. Levin
ldv at altlinux.org
Fri Feb 13 16:51:27 UTC 2015
On Fri, Feb 13, 2015 at 04:41:25PM +0100, Etienne Gemsa wrote:
[...]
> Oops, the last patch was not the one I intended to send. Please check this one instead,
> thank you.
This one fails to build, too.
> > > + if (_IOC_DIR(code) != _IOC_WRITE)
> > > + return 0;
>
> > It's not easy to implement correctly this way.
> > sys_ioctl() uses return code of this function only on exit of syscall,
> > so extra case should be taken to return proper code on exit of _IOW ioctls.
> >
> > I'd invert the checks for syscall state and ioctl direction:
>
> Sorry, I do not understand why it would be better to invert the checks.
Inverted checks are easier to implement correctly: there is no much
difference with _IOR ioctls that are decoded on exit, but it's a bit more
tricky with _IOW ioctls - they are decoded on enter but the return code that
matters is the one that is returned on exit.
[...]
> + /* On exiting, we should only decode _IOR ioctls */
> + if (syserror(tcp)) {
> + if (_IOC_DIR(code) != _IOC_READ)
> + return 1;
> + else
> + return 0;
> + }
> + /* Write ioctls are already decoded */
> + if (_IOC_DIR(code) != _IOC_READ)
> + return 1;
This is a good illustration: evdev_ioctl returns 1 on exit of any
non-_IOR ioctl, including those ioctls for which it returned 0 on enter.
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20150213/3181ca52/attachment.bin>
More information about the Strace-devel
mailing list