Re: [Qemu-devel] [PATCH 1/7] userfaultfd: require UFFDIO_API before other ioctls

2015-06-15 Thread Linus Torvalds
On Jun 15, 2015 11:43 AM, "Andrea Arcangeli" wrote: > > Several times I got very hardly reproducible bugs noticed purely > because of BUG_ON (not VM_BUG_ON) Feel free to use them while developing. Don't send me patches with your broken debug code, though. For users, a dead machine means that it

Re: [Qemu-devel] [PATCH 1/7] userfaultfd: require UFFDIO_API before other ioctls

2015-06-15 Thread Andrea Arcangeli
On Mon, Jun 15, 2015 at 08:11:50AM -1000, Linus Torvalds wrote: > On Jun 15, 2015 7:22 AM, "Andrea Arcangeli" wrote: > > > > + if (cmd != UFFDIO_API) { > > + if (ctx->state == UFFD_STATE_WAIT_API) > > + return -EINVAL; > > + BUG_ON(ctx->state

Re: [Qemu-devel] [PATCH 1/7] userfaultfd: require UFFDIO_API before other ioctls

2015-06-15 Thread Linus Torvalds
On Jun 15, 2015 7:22 AM, "Andrea Arcangeli" wrote: > > + if (cmd != UFFDIO_API) { > + if (ctx->state == UFFD_STATE_WAIT_API) > + return -EINVAL; > + BUG_ON(ctx->state != UFFD_STATE_RUNNING); > + } NAK. Once again: we don't add BUG_ON(

[Qemu-devel] [PATCH 1/7] userfaultfd: require UFFDIO_API before other ioctls

2015-06-15 Thread Andrea Arcangeli
UFFDIO_API was already forced before read/poll could work. This makes the code more strict to force it also for all other ioctls. All users would already have been required to call UFFDIO_API before invoking other ioctls but this makes it more explicit. This will ensure we can change all ioctls (