On Tue, Jun 14, 2022 at 11:31:48AM -0700, Dave Hansen wrote: > On 6/13/22 23:39, Hyeonggon Yoo wrote: > > @@ -1514,6 +1515,11 @@ static int __change_page_attr(struct cpa_data *cpa, int primary) > > pte_t *kpte, old_pte; > > > > address = __cpa_addr(cpa, cpa->curpage); > > + > > + if (WARN((IS_ENABLED(CONFIG_EFI) ? cpa->pgd != efi_mm.pgd : true) > > + && address <= TASK_SIZE_MAX, > > + KERN_WARNING "CPA: Got a user address")) > > + return -EINVAL; > > I was expecting this to actually go after _PAGE_USER, not necessarily > userspace addresses themselves. userspace ptes may not have _PAGE_USER set. (e.g. swap entry) I think it's more accurate to go after user addresses. > What does and should happen with the VDSO, for instance? It's a > _PAGE_USER mapping, but it's >TASK_SIZE. you mean vsyscall? AFAIK address of mapped vDSO image is < TASK_SIZE. (or please tell me I'm wrong) > Should set_page_attr() work on it? vsyscall does not need CPA functionalities. So I don't think it (__change_page_attr()) should work on vsyscall. I think renaming fault_in_kernel_space() and using it would be more robust than simply using the expression (address <= TASK_SIZE_MAX). -- Thanks, Hyeonggon