Re: [PATCH v1 06/11] mm: support GUP-triggered unsharing via FAULT_FLAG_UNSHARE (!hugetlb)

From
Jan Kara <jack@suse.cz>
Date
2021-12-23 12:54:45
Also in
linux-kselftest, linux-mm, lkml
Reply to
Linus Torvalds, 2021-12-22
On Wed 22-12-21 10:40:18, Linus Torvalds wrote:
On Wed, Dec 22, 2021 at 8:08 AM Jan Kara [off-list ref] wrote:
quoted
Well, but O_DIRECT reads must use FOLL_PIN in any case because they modify
page data (and so we need to detect them both for COW and filesystem needs).
Well, O_DIRECT reads do, but not necessarily writes.
I agree.
And hey, even reads have been dodgy in the past when we didn't really
have the pinning logic - there's been a lot of users that just wanted
it to work for their particular use-case rather than in general and in
all situations..
Yes, but currently a malicious user can take the system down (BUG_ON) or
cause DIF/DIX failures if he is nasty and tries hard enough with O_DIRECT
reads (practically, the window is small so I haven't really seen a report
that I could trace to O_DIRECT reads but in principle the problem is the
same as with pinning & dirtying done e.g. by video capture drivers and
there we've seen these problem happen). So forcing pinning for O_DIRECT
reads is IMO mandatory.

								Honza

-- 
Jan Kara [off-list ref]
SUSE Labs, CR
Thread (137 messages) 137 messages, 11 authors, last reply 2022-01-04
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help