lkml.org 
[lkml]   [2022]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V2 19/32] x86/sgx: Support adding of pages to an initialized enclave
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@kernel.org/T/#u

BR, Jarkko

\
 
 \ /
  Last update: 2022-03-07 17:18    [W:0.321 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site