[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c0fe95949d4f41449f17add8300270b9@AcuMS.aculab.com>
Date: Wed, 8 May 2024 11:51:40 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Christian König' <christian.koenig@....com>, "T.J.
Mercier" <tjmercier@...gle.com>, Charan Teja Kalla
<quic_charante@...cinc.com>, zhiguojiang <justinjiang@...o.com>, Sumit Semwal
<sumit.semwal@...aro.org>, "linux-media@...r.kernel.org"
<linux-media@...r.kernel.org>, "dri-devel@...ts.freedesktop.org"
<dri-devel@...ts.freedesktop.org>, "linaro-mm-sig@...ts.linaro.org"
<linaro-mm-sig@...ts.linaro.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "opensource.kernel@...o.com"
<opensource.kernel@...o.com>
Subject: RE: [PATCH] dmabuf: fix dmabuf file poll uaf issue
From: Christian König
> Sent: 07 May 2024 15:05
...
> I actually have been telling people to (ab)use the epoll behavior to
> check if two file descriptors point to the same underlying file when
> KCMP isn't available.
In what way?
You can add both fd to the same epoll fd.
Relying on the implicit EPOLL_CTL_DEL not happening until both fd are
closed is a recipe for disaster.
(And I can't see an obvious way of testing it.)
Q6/A6 on epoll(7) should always have had a caveat that it is an
'implementation detail' and shouldn't be relied on.
(it is written as a 'beware of' ...)
The other point is that there are two ways to get multiple fd that
reference the same underlying file.
dup() fork() etc share the file offset, but open("/dev/fd/n") adds
a reference count later and has a separate file offset.
I don't know which structure epoll is using, but I suspect it is
the former.
So it may not tell you what you want to know.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists