On 03/05/2018 12:22 PM, Dave Hansen wrote:
On 02/21/2018 09:15 AM, Khalid Aziz wrote:
+#define arch_validate_prot(prot, addr) sparc_validate_prot(prot, addr)
+static inline int sparc_validate_prot(unsigned long prot, unsigned long addr)
+{
+       if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM | PROT_ADI))
+               return 0;
+       if (prot & PROT_ADI) {
+               if (!adi_capable())
+                       return 0;
+
+               if (addr) {
+                       struct vm_area_struct *vma;
+
+                       vma = find_vma(current->mm, addr);
+                       if (vma) {
+                               /* ADI can not be enabled on PFN
+                                * mapped pages
+                                */
+                               if (vma->vm_flags & (VM_PFNMAP | VM_MIXEDMAP))
+                                       return 0;

You don't hold mmap_sem here.  How can this work?


Are you suggesting that vma returned by find_vma() could be split or merged underneath me if I do not hold mmap_sem and thus make the flag check invalid? If so, that is a good point.

Thanks,
Khalid
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to