Commit d172b1a
userfaultfd: provide properly masked address for huge-pages
Commit 824ddc6 ("userfaultfd: provide unmasked address on
page-fault") was introduced to fix an old bug, in which the offset in the
address of a page-fault was masked. Concerns were raised - although were
never backed by actual code - that some userspace code might break because
the bug has been around for quite a while. To address these concerns a
new flag was introduced, and only when this flag is set by the user,
userfaultfd provides the exact address of the page-fault.
The commit however had a bug, and if the flag is unset, the offset was
always masked based on a base-page granularity. Yet, for huge-pages, the
behavior prior to the commit was that the address is masked to the
huge-page granulrity.
While there are no reports on real breakage, fix this issue. If the flag
is unset, use the address with the masking that was done before.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 824ddc6 ("userfaultfd: provide unmasked address on page-fault")
Signed-off-by: Nadav Amit <[email protected]>
Reported-by: James Houghton <[email protected]>
Reviewed-by: Mike Rapoport <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
Reviewed-by: James Houghton <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Jan Kara <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>1 parent c80af0c commit d172b1a
1 file changed
+7
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| 195 | + | |
195 | 196 | | |
196 | 197 | | |
197 | 198 | | |
198 | 199 | | |
199 | 200 | | |
| 201 | + | |
200 | 202 | | |
201 | 203 | | |
202 | 204 | | |
203 | | - | |
204 | | - | |
205 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
206 | 208 | | |
207 | 209 | | |
208 | 210 | | |
| |||
488 | 490 | | |
489 | 491 | | |
490 | 492 | | |
491 | | - | |
492 | | - | |
| 493 | + | |
| 494 | + | |
493 | 495 | | |
494 | 496 | | |
495 | 497 | | |
| |||
0 commit comments