On Tue, May 10, 2016 at 11:16:03AM +0100, Dr. David Alan Gilbert wrote: > * Dmitry V. Levin (l...@altlinux.org) wrote: > > On Fri, May 06, 2016 at 12:08:41PM +0100, Dr. David Alan Gilbert (git) > > wrote: [...] > > > + struct uffdio_api api_struct; > > > + /* With a bad fd */ > > > + memset(&api_struct, 0, sizeof(api_struct)); > > > + rc = ioctl(-1, UFFDIO_API, &api_struct); > > > > We have a function called tail_alloc: it allocates memory that ends on the > > page boundary; pages allocated by tail_alloc are preceded by an unmapped > > page and followed by another unmapped page. > > > > This method is used in many tests to check that strace parsers do not read > > beyond the end of structure they are supposed to parse, see e.g. > > tests/ioctl_v4l2.c. > > > > For example, > > (void) tail_alloc(1); /* initial memory hole just in case */ > > struct uffdio_api *api_struct = tail_alloc(sizeof(*api_struct)); > > memset(api_struct, 0, sizeof(*api_struct)); > > rc = ioctl(-1, UFFDIO_API, api_struct); > > OK, done. I'm not sure I understand the logic behind the tail_alloc(1)'s - > I've placed them at the start of each group.
I don't think the test really needs that many memory mapping holes, the first tail_alloc(1) is probably enough, but they won't harm. -- ldv
pgpofJCUYPEV8.pgp
Description: PGP signature
------------------------------------------------------------------------------ Mobile security can be enabling, not merely restricting. Employees who bring their own devices (BYOD) to work are irked by the imposition of MDM restrictions. Mobile Device Manager Plus allows you to control only the apps on BYO-devices by containerizing them, leaving personal data untouched! https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel