]> git.baikalelectronics.ru Git - kernel.git/commit
mm: gup: make fault_in_safe_writeable() use fixup_user_fault()
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 8 Mar 2022 19:55:48 +0000 (11:55 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 10 Mar 2022 18:48:53 +0000 (10:48 -0800)
commitb104fd5c19f8ea36681db331b16ed280722c96f9
tree992a7514dee0aeacfc5d133837ba90fafd3047b6
parent1febcc4c13efca732a23581d7d428bac2ad65edc
mm: gup: make fault_in_safe_writeable() use fixup_user_fault()

Instead of using GUP, make fault_in_safe_writeable() actually force a
'handle_mm_fault()' using the same fixup_user_fault() machinery that
futexes already use.

Using the GUP machinery meant that fault_in_safe_writeable() did not do
everything that a real fault would do, ranging from not auto-expanding
the stack segment, to not updating accessed or dirty flags in the page
tables (GUP sets those flags on the pages themselves).

The latter causes problems on architectures (like s390) that do accessed
bit handling in software, which meant that fault_in_safe_writeable()
didn't actually do all the fault handling it needed to, and trying to
access the user address afterwards would still cause faults.

Reported-and-tested-by: Andreas Gruenbacher <agruenba@redhat.com>
Fixes: 099724b1e175 ("iov_iter: Introduce fault_in_iov_iter_writeable")
Link: https://lore.kernel.org/all/CAHc6FU5nP+nziNGG0JAF1FUx-GV7kKFvM7aZuU_XD2_1v4vnvg@mail.gmail.com/
Acked-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/gup.c