On Tue, Jun 04, 2019 at 03:10:22PM -0700, Xing, Cedric wrote: > A bit off topic here. This mmap()/mprotect() discussion reminds me a question > (guess for Jarkko): Now that vma->vm_file->private_data keeps a pointer to > the enclave, why do we store it again in vma->vm_private? It isn't a big deal > but non-NULL vm_private does prevent mprotect() from merging adjacent VMAs. vma->vm_ops->close also prevents merging, and we need that to refcount the enclave and mm. We also rely on nullifying vma->vm_private_data in the unlikely event that adding a new mm to the enclave fails on kzalloc().