Skip to content

Commit

Permalink
vm_insert_pfn replaced by vmf_insert_pfn from kernel 4.20
Browse files Browse the repository at this point in the history
Signed-off-by: Serge Ayoun <serge.ayoun@intel.com>
  • Loading branch information
sergeay committed Jan 24, 2019
1 parent b738060 commit d617da1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sgx_encl.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,11 @@ static bool sgx_process_add_page_req(struct sgx_add_page_req *req,
return false;
}

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0))
ret = vmf_insert_pfn(vma, encl_page->addr, PFN_DOWN(epc_page->pa));
#else
ret = vm_insert_pfn(vma, encl_page->addr, PFN_DOWN(epc_page->pa));
#endif
if (ret) {
sgx_put_backing(backing, 0);
return false;
Expand Down
4 changes: 4 additions & 0 deletions sgx_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,11 @@ static struct sgx_encl_page *sgx_do_fault(struct vm_area_struct *vma,
epc_page = NULL;
list_add_tail(&entry->epc_page->list, &encl->load_list);

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0))
rc = vmf_insert_pfn(vma, entry->addr, PFN_DOWN(entry->epc_page->pa));
#else
rc = vm_insert_pfn(vma, entry->addr, PFN_DOWN(entry->epc_page->pa));
#endif
if (rc) {
/* Kill the enclave if vm_insert_pfn fails; failure only occurs
* if there is a driver bug or an unrecoverable issue, e.g. OOM.
Expand Down

0 comments on commit d617da1

Please sign in to comment.