From aaf03dd58cbef07e89dacd0b3784bcbda99691c7 Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Sun, 27 Nov 2022 09:18:39 -0800 Subject: [PATCH] ANDROID: mm: fix build issue in spf when CONFIG_USERFAULTFD=n When CONFIG_USERFAULTFD=n __VM_UFFD_FLAGS mask is undefined and produces build error. Fix it by making the check conditional on CONFIG_USERFAULTFD. Fixes: ("ANDROID: mm: prevent speculative page fault handling for userfaults") Bug: 257443051 Change-Id: Ie9ff98b840032eb18183b49e3566cf178359948f Signed-off-by: Suren Baghdasaryan --- mm/memory.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/memory.c b/mm/memory.c index e37dfad032ed..cdd492d7f980 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5021,11 +5021,13 @@ static vm_fault_t ___handle_speculative_fault(struct mm_struct *mm, vmf.vma_flags = READ_ONCE(vmf.vma->vm_flags); vmf.vma_page_prot = READ_ONCE(vmf.vma->vm_page_prot); +#ifdef CONFIG_USERFAULTFD /* Can't call userland page fault handler in the speculative path */ if (unlikely(vmf.vma_flags & __VM_UFFD_FLAGS)) { trace_spf_vma_notsup(_RET_IP_, vmf.vma, address); return VM_FAULT_RETRY; } +#endif if (vmf.vma_flags & VM_GROWSDOWN || vmf.vma_flags & VM_GROWSUP) { /*