Revert "ANDROID: x86/mm: protect vm_file during speculative page fault handling"

This reverts commit 4fc18576ca.

File refcounting implemented in this patch is broken and needs to be
redone.

Bug: 258731892
Change-Id: Ibcefaf6aa72c60c9627d0ea7d473a3ec806535f4
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
Suren Baghdasaryan
2022-11-11 12:50:53 -08:00
parent e9a7e9f2ff
commit 24894a547e

View File

@@ -1227,7 +1227,6 @@ void do_user_addr_fault(struct pt_regs *regs,
vm_fault_t fault;
unsigned int flags = FAULT_FLAG_DEFAULT;
#ifdef CONFIG_SPECULATIVE_PAGE_FAULT
struct vm_area_struct *orig_vma = NULL;
struct vm_area_struct pvma;
unsigned long seq;
#endif
@@ -1354,29 +1353,17 @@ void do_user_addr_fault(struct pt_regs *regs,
count_vm_spf_event(SPF_ABORT_NO_SPECULATE);
goto spf_abort;
}
if (vma->vm_file) {
if (!vma_get_file_ref(vma)) {
rcu_read_unlock();
count_vm_spf_event(SPF_ABORT_UNMAPPED);
goto spf_abort;
}
orig_vma = vma;
}
pvma = *vma;
rcu_read_unlock();
if (!mmap_seq_read_check(mm, seq, SPF_ABORT_VMA_COPY)) {
vma_put_file_ref(orig_vma);
if (!mmap_seq_read_check(mm, seq, SPF_ABORT_VMA_COPY))
goto spf_abort;
}
vma = &pvma;
if (unlikely(access_error(error_code, vma))) {
count_vm_spf_event(SPF_ABORT_ACCESS_ERROR);
vma_put_file_ref(orig_vma);
goto spf_abort;
}
fault = do_handle_mm_fault(vma, address,
flags | FAULT_FLAG_SPECULATIVE, seq, regs);
vma_put_file_ref(orig_vma);
if (!(fault & VM_FAULT_RETRY))
goto done;