File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
tools/testing/selftests/vm Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -774,7 +774,27 @@ static void uffd_handle_page_fault(struct uffd_msg *msg,
774
774
continue_range (uffd , msg -> arg .pagefault .address , page_size );
775
775
stats -> minor_faults ++ ;
776
776
} else {
777
- /* Missing page faults */
777
+ /*
778
+ * Missing page faults.
779
+ *
780
+ * Here we force a write check for each of the missing mode
781
+ * faults. It's guaranteed because the only threads that
782
+ * will trigger uffd faults are the locking threads, and
783
+ * their first instruction to touch the missing page will
784
+ * always be pthread_mutex_lock().
785
+ *
786
+ * Note that here we relied on an NPTL glibc impl detail to
787
+ * always read the lock type at the entry of the lock op
788
+ * (pthread_mutex_t.__data.__type, offset 0x10) before
789
+ * doing any locking operations to guarantee that. It's
790
+ * actually not good to rely on this impl detail because
791
+ * logically a pthread-compatible lib can implement the
792
+ * locks without types and we can fail when linking with
793
+ * them. However since we used to find bugs with this
794
+ * strict check we still keep it around. Hopefully this
795
+ * could be a good hint when it fails again. If one day
796
+ * it'll break on some other impl of glibc we'll revisit.
797
+ */
778
798
if (msg -> arg .pagefault .flags & UFFD_PAGEFAULT_FLAG_WRITE )
779
799
err ("unexpected write fault" );
780
800
You can’t perform that action at this time.
0 commit comments