NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/55658: rumpvfs:t_etfs triggers bug in ufs_balloc_range() for 16KB page
The following reply was made to PR kern/55658; it has been noted by GNATS.
From: Chuck Silvers <chuq%chuq.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: kern/55658: rumpvfs:t_etfs triggers bug in ufs_balloc_range()
for 16KB page
Date: Mon, 14 Sep 2020 10:42:40 -0700
This isn't the right fix for this problem. Pages which are only
partially backed by allocated blocks in the file system must not
be mapped writable (at the pmap level) for user mappings,
because the page fault that is taken by user code writing to
the mapping of such a partially-backed page is the point where
we are able to allocate the rest of the blocks for the page.
If we allow user code to modify the page without a page fault,
then when the page is cleaned, any modifications to the parts
of the page that have no blocks allocated will be discarded.
I think the right fix will be to continue setting PG_RDONLY as
we do currently so that user mappings will behave correctly,
and instead change ubc_fault_page() to ignore the PG_RDONLY flag
and always pmap_enter() the page with the permissions of the
original access_type. It is the file system's responsibility
to allocate blocks for any part of the file that is being modified
by write() before calling into UBC to fill the pages for that
range with the desired data.
Note that I haven't tested this and there may well be
other adjustments that need to be made elsewhere.
-Chuck
Home |
Main Index |
Thread Index |
Old Index