On Mon, Feb 07, 2022 at 04:45:41PM -0800, Reinette Chatre wrote: > + encl_page = kzalloc(sizeof(*encl_page), GFP_KERNEL); > + if (!encl_page) > + return VM_FAULT_OOM; > + > + encl_page->desc = addr; > + encl_page->encl = encl; > + > + /* > + * Adding a regular page that is architecturally allowed to only > + * be created with RW permissions. > + * TBD: Interface with user space policy to support max permissions > + * of RWX. > + */ > + prot = PROT_READ | PROT_WRITE; > + encl_page->vm_run_prot_bits = calc_vm_prot_bits(prot, 0); > + encl_page->vm_max_prot_bits = encl_page->vm_run_prot_bits; You should use sgx_encl_page_alloc() here and not reinvent wheel. I wrote a patch that exports it: https://lore.kernel.org/linux-sgx/20220306053211.135762-3-jarkko@xxxxxxxxxx/T/#u BR, Jarkko