On Wed, Jan 19, 2022 at 2:03 PM Axel Rasmussen <axelrasmussen@xxxxxxxxxx> wrote: > > On Wed, Jan 19, 2022 at 1:19 PM Suren Baghdasaryan <surenb@xxxxxxxxxx> wrote: > > > > On Wed, Jan 19, 2022 at 12:39 PM Axel Rasmussen > > <axelrasmussen@xxxxxxxxxx> wrote: > > > > > > Lokesh, I only spent a few moments looking, but my suspicion is that > > > this is the result of an incomplete backport of these patches to the > > > Android kernel? > > > > > > The UFFDIO_CONTINUE patches introduced ioctls_out since the > > > computation of it got more complicated, and those same patches also > > > modified the put_user() on line 1533 here to use ioctls_out. I think > > > Android backported the first part, but left out the second? > > > > The backport https://android-review.googlesource.com/c/kernel/common/+/1652718 > > looks like a mixture of > > 14819305e09fe4 ("userfaultfd: wp: declare _UFFDIO_WRITEPROTECT > > conditionally") and f619147104c8 ("userfaultfd: add UFFDIO_CONTINUE > > ioctl"). > > Not sure why it was done this way, maybe to minimize code changes > > while backporting. > > Simplest fix is probably to add __maybe_unused to ioctls_out declaration. > > Unfortunately, that doesn't quite do it. That would fix the warning, > but the code in the original e-mail is still wrong: we incorrectly > don't report the _UFFDIO_CONTINUE bit, unless we use the value we > computed in ioctls_out. I think what happened is that Axel's patch [1] depends on the patch from Peter [2]. [1] was backported without the dependency and the conflict resolutions aren't quite correct. [1] https://lore.kernel.org/lkml/20210301222728.176417-5-axelrasmussen@xxxxxxxxxx/ [2] https://lore.kernel.org/lkml/20200220163112.11409-18-peterx@xxxxxxxxxx/ - Kalesh