Re: [PATCH] mm/userfaultfd: selftests: Fix memory corruption with thp enabled

From: Peter Xu
Date: Fri Sep 24 2021 - 10:14:28 EST

On Thu, Sep 23, 2021 at 07:19:41PM -0700, Andrew Morton wrote:
> On Thu, 23 Sep 2021 19:25:12 -0400 Peter Xu <peterx@xxxxxxxxxx> wrote:
> > In RHEL's gating selftests we've encountered memory corruption in the uffd
> > event test even with upstream kernel:
> >
> > ...
> >
> >
> > We can mark the Fixes tag upon 0db282ba2c12 as it's reported to only happen
> > there, however the real "Fixes" IMHO should be 8ba6e8640844, as before that
> > commit we'll always do explicit release_pages() before registration of uffd,
> > and 8ba6e8640844 changed that logic by adding extra unmap/map and we didn't
> > release the pages at the right place. Meanwhile I don't have a solid glue
> > anyway on whether posix_memalign() could always avoid triggering this bug,
> > hence it's safer to attach this fix to commit 8ba6e8640844.
> >
> Thanks. I added a cc:stable to this. I don't think we want selftests
> in older kernels to be falsely reporting kernel bugs?

Not sure how we normally handle such case for selftests, but I agree.

Btw, 8ba6e8640844 is merged in 5.14, so the only stable branch that will need
it will be 5.14.y; it can be applied cleanly there.


Peter Xu