[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAG48ez2cTrD2_4iKo3+zrPH=e29znYOKLBkC4OLA3yhsu5oMNA@mail.gmail.com>
Date: Wed, 11 Dec 2024 00:11:54 +0100
From: Jann Horn <jannh@...gle.com>
To: Joel Fernandes <joel@...lfernandes.org>
Cc: Gerd Hoffmann <kraxel@...hat.com>, Vivek Kasireddy <vivek.kasireddy@...el.com>,
Sumit Semwal <sumit.semwal@...aro.org>, Christian König <christian.koenig@....com>,
Simona Vetter <simona.vetter@...ll.ch>, John Stultz <jstultz@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>, dri-devel@...ts.freedesktop.org,
linux-media@...r.kernel.org, linaro-mm-sig@...ts.linaro.org,
linux-kernel@...r.kernel.org, Julian Orth <ju.orth@...il.com>, stable@...r.kernel.org
Subject: Re: [PATCH v2 1/3] udmabuf: fix racy memfd sealing check
On Tue, Dec 10, 2024 at 11:51 PM Joel Fernandes <joel@...lfernandes.org> wrote:
> On Wed, Dec 4, 2024 at 11:27 AM Jann Horn <jannh@...gle.com> wrote:
> > The current check_memfd_seals() is racy: Since we first do
> > check_memfd_seals() and then udmabuf_pin_folios() without holding any
> > relevant lock across both, F_SEAL_WRITE can be set in between.
> > This is problematic because we can end up holding pins to pages in a
> > write-sealed memfd.
> >
> > Fix it using the inode lock, that's probably the easiest way.
> > In the future, we might want to consider moving this logic into memfd,
> > especially if anyone else wants to use memfd_pin_folios().
>
> I am curious, why is it not possible to have a reproducer for this
> issue, is it not reproducible and is theoretical?
Sorry, I think I must have forgotten about this part when I wrote the
cover letter: The original bug reporter (Julian) linked to a
reproducer that is linked in the bugzilla bug report, at
<https://github.com/mahkoh/udmabuf-seal>. I haven't tried running it
myself though.
> thanks,
>
> - Joel
>
> >
> > Reported-by: Julian Orth <ju.orth@...il.com>
> > Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219106
> > Closes: https://lore.kernel.org/r/CAG48ez0w8HrFEZtJkfmkVKFDhE5aP7nz=obrimeTgpD+StkV9w@mail.gmail.com
> > Fixes: fbb0de795078 ("Add udmabuf misc device")
> > Cc: stable@...r.kernel.org
> > Signed-off-by: Jann Horn <jannh@...gle.com>
Powered by blists - more mailing lists