[RFC v2] Decode UFFDIO_* ioctls

Dmitry V. Levin ldv at altlinux.org
Wed May 4 14:50:58 UTC 2016


On Tue, May 03, 2016 at 08:23:43PM +0100, Dr. David Alan Gilbert wrote:
[...]
> > > --- /dev/null
> > > +++ b/xlat/uffd_register_ioctl_flags.in
> > > @@ -0,0 +1,5 @@
> > > +#val_type uint64_t
> > > +1<< _UFFDIO_WAKE
> > > +1<< _UFFDIO_COPY
> > > +1<< _UFFDIO_ZEROPAGE
> > > +
> > 
> > gen.sh doesn't handle space characters after 1<< properly (yet).
> > git am complains about empty line at EOF.
> 
> Fixed. Hmm, I've removed the spaces, but the output I'm getting is:
> [pid  9644] ioctl(20, UFFDIO_REGISTER{range={start=0x7ff674200000, len=0x40000}, mode=UFFDIO_REGISTER_MODE_MISSING, ioctls=_UFFDIO_WAKE|_UFFDIO_COPY|_UFFDIO_ZEROPAGE}) = 0
> 
> shouldn't I be seeing 1ull<<_UFFDIO_WAKE | 1ull << _UFFDIO_COPY etc?

We have just a few users of this feature, and these users seem to be OK
with the current behaviour, which means we probably need another syntax
for this case.

I'd also consider another representation of "ioctls" field, e.g.
ioctls=1<<(_UFFDIO_WAKE|_UFFDIO_COPY|_UFFDIO_ZEROPAGE)

> So the thing that I'm left with is the tests;  the cases I'm most worried about
> are how to handle the return data from the kernel in the case where the flags
> the kernel returns varies on kernel versions.
> Is the right thing for the test to do the decode manually and then
> print what it expects strace to print?

One way is to decode flags in the test, I've recently added printflags
and printxval to libtests exactly for this purpose.

Another way is to output a regexp for egrep match instead of expected
output for exact diff match.


-- 
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/20160504/4870f635/attachment.bin>


More information about the Strace-devel mailing list