~kamalmostafa/ubuntu/+source/linux-aws/+git/groovy:nitro-enclaves
- Git
- lp:~kamalmostafa/ubuntu/+source/linux-aws/+git/groovy
- nitro-enclaves
- Get this branch:
-
git clone
-b nitro-enclaves
https://git.launchpad.net/~kamalmostafa/ubuntu/+source/linux-aws/+git/groovy
Branch merges
Related source package recipes
Branch information
- Name:
- nitro-enclaves
Recent commits
- 477b616... by Andra Paraschiv <email address hidden>
-
MAINTAINERS: Add entry for the Nitro Enclaves driver
BugLink: https:/
/bugs.launchpad .net/bugs/ 1903087 Add entry in the MAINTAINERS file for the Nitro Enclaves files such as
the documentation, the header files, the driver itself and the user
space sample.Changelog
v9 -> v10
* Update commit message to include the changelog before the SoB tag(s).
v8 -> v9
* Update the location of the documentation, as it has been moved to the
"virt" directory.v7 -> v8
* No changes.
v6 -> v7
* No changes.
v5 -> v6
* No changes.
v4 -> v5
* No changes.
v3 -> v4
* No changes.
v2 -> v3
* Update file entries to be in alphabetical order.
v1 -> v2
* No changes.
Reviewed-by: Alexander Graf <email address hidden>
Signed-off-by: Andra Paraschiv <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Greg Kroah-Hartman <email address hidden>
(cherry picked from commit e82ed736ad2d2dddf1384fc4c8a0f2 6021af04fe)
Signed-off-by: Kamal Mostafa <email address hidden> - a7cc7fa... by Andra Paraschiv <email address hidden>
-
nitro_enclaves: Add overview documentation
BugLink: https:/
/bugs.launchpad .net/bugs/ 1903087 Add documentation on the overview of Nitro Enclaves. Include it in the
virtualization specific directory.Changelog
v9 -> v10
* Update commit message to include the changelog before the SoB tag(s).
v8 -> v9
* Move the Nitro Enclaves documentation to the "virt" directory and add
an entry for it in the corresponding index file.v7 -> v8
* Add info about the primary / parent VM CID value.
* Update reference link for huge pages.
* Add reference link for the x86 boot protocol.
* Add license mention and update doc title / chapter formatting.v6 -> v7
* No changes.
v5 -> v6
* No changes.
v4 -> v5
* No changes.
v3 -> v4
* Update doc type from .txt to .rst.
* Update documentation based on the changes from v4.v2 -> v3
* No changes.
v1 -> v2
* New in v2.
Reviewed-by: Alexander Graf <email address hidden>
Signed-off-by: Andra Paraschiv <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Greg Kroah-Hartman <email address hidden>
(cherry picked from commit bf15d79ce142fe1d01eb88bdad9636 7a3887648c)
Signed-off-by: Kamal Mostafa <email address hidden> - ffef392... by Andra Paraschiv <email address hidden>
-
nitro_enclaves: Add sample for ioctl interface usage
BugLink: https:/
/bugs.launchpad .net/bugs/ 1903087 Add a user space sample for the usage of the ioctl interface provided by
the Nitro Enclaves driver.Changelog
v9 -> v10
* Update commit message to include the changelog before the SoB tag(s).
v8 -> v9
* No changes.
v7 -> v8
* Track NE custom error codes for invalid page size, invalid flags and
enclave CID.
* Update the heartbeat logic to have a listener fd first, then start the
enclave and then accept connection to get the heartbeat.
* Update the reference link to the hugetlb documentation.v6 -> v7
* Track POLLNVAL as poll event in addition to POLLHUP.
v5 -> v6
* Remove "rc" mentioning when printing errno string.
* Remove the ioctl to query API version.
* Include usage info for NUMA-aware hugetlb configuration.
* Update documentation to kernel-doc format.
* Add logic for enclave image loading.v4 -> v5
* Print enclave vCPU ids when they are created.
* Update logic to map the modified vCPU ioctl call.
* Add check for the path to the enclave image to be less than PATH_MAX.
* Update the ioctl calls error checking logic to match the NE specific
error codes.v3 -> v4
* Update usage details to match the updates in v4.
* Update NE ioctl interface usage.v2 -> v3
* Remove the include directory to use the uapi from the kernel.
* Remove the GPL additional wording as SPDX-License-Identifier is
already in place.v1 -> v2
* New in v2.
Reviewed-by: Alexander Graf <email address hidden>
Signed-off-by: Alexandru Vasile <email address hidden>
Signed-off-by: Andra Paraschiv <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Greg Kroah-Hartman <email address hidden>
(cherry picked from commit acc4229c39903dfaf97512f5738490 d3bdafcd0a)
Signed-off-by: Kamal Mostafa <email address hidden> - 6739593... by Andra Paraschiv <email address hidden>
-
nitro_enclaves: Add Makefile for the Nitro Enclaves driver
BugLink: https:/
/bugs.launchpad .net/bugs/ 1903087 Add Makefile for the Nitro Enclaves driver, considering the option set
in the kernel config.Changelog
v9 -> v10
* Update commit message to include the changelog before the SoB tag(s).
v8 -> v9
* Remove -Wall flags, could use W=1 as an option for this.
v7 -> v8
* No changes.
v6 -> v7
* No changes.
v5 -> v6
* No changes.
v4 -> v5
* No changes.
v3 -> v4
* No changes.
v2 -> v3
* Remove the GPL additional wording as SPDX-License-
Identifier is
already in place.v1 -> v2
* Update path to Makefile to match the drivers/
virt/nitro_ enclaves
directory.Reviewed-by: Alexander Graf <email address hidden>
Signed-off-by: Andra Paraschiv <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Greg Kroah-Hartman <email address hidden>
(cherry picked from commit 0f5c7b7484394e26afc07c063290fb 43c4ba42c7)
Signed-off-by: Kamal Mostafa <email address hidden> - d1dbaba... by Andra Paraschiv <email address hidden>
-
nitro_enclaves: Add Kconfig for the Nitro Enclaves driver
BugLink: https:/
/bugs.launchpad .net/bugs/ 1903087 Add kernel config entry for Nitro Enclaves, including dependencies.
Changelog
v9 -> v10
* Update commit message to include the changelog before the SoB tag(s).
v8 -> v9
* No changes.
v7 -> v8
* No changes.
v6 -> v7
* Remove, for now, the dependency on ARM64 arch. x86 is currently
supported, with Arm to come afterwards. The NE kernel driver can be
built for aarch64 arch.v5 -> v6
* No changes.
v4 -> v5
* Add arch dependency for Arm / x86.
v3 -> v4
* Add PCI and SMP dependencies.
v2 -> v3
* Remove the GPL additional wording as SPDX-License-
Identifier is
already in place.v1 -> v2
* Update path to Kconfig to match the drivers/
virt/nitro_ enclaves
directory.
* Update help in Kconfig.Reviewed-by: Alexander Graf <email address hidden>
Signed-off-by: Andra Paraschiv <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Greg Kroah-Hartman <email address hidden>
(cherry picked from commit 07499cc661a926eb4ca19604502e3f 0bda2aa4bf)
Signed-off-by: Kamal Mostafa <email address hidden> - 18285e0... by Andra Paraschiv <email address hidden>
-
nitro_enclaves: Add logic for terminating an enclave
BugLink: https:/
/bugs.launchpad .net/bugs/ 1903087 An enclave is associated with an fd that is returned after the enclave
creation logic is completed. This enclave fd is further used to setup
enclave resources. Once the enclave needs to be terminated, the enclave
fd is closed.Add logic for enclave termination, that is mapped to the enclave fd
release callback. Free the internal enclave info used for bookkeeping.Changelog
v9 -> v10
* Update commit message to include the changelog before the SoB tag(s).
v8 -> v9
* Use the ne_devs data structure to get the refs for the NE PCI device.
v7 -> v8
* No changes.
v6 -> v7
* Remove the pci_dev_put() call as the NE misc device parent field is
used now to get the NE PCI device.
* Update the naming and add more comments to make more clear the logic
of handling full CPU cores and dedicating them to the enclave.v5 -> v6
* Update documentation to kernel-doc format.
* Use directly put_page() instead of unpin_user_pages(), to match the
get_user_pages() calls.v4 -> v5
* Release the reference to the NE PCI device on enclave fd release.
* Adapt the logic to cpumask enclave vCPU ids and CPU cores.
* Remove sanity checks for situations that shouldn't happen, only if
buggy system or broken logic at all.v3 -> v4
* Use dev_err instead of custom NE log pattern.
v2 -> v3
* Remove the WARN_ON calls.
* Update static calls sanity checks.
* Update kzfree() calls to kfree().v1 -> v2
* Add log pattern for NE.
* Remove the BUG_ON calls.
* Update goto labels to match their purpose.
* Add early exit in release() if there was a slot alloc error in the fd
creation path.Reviewed-by: Alexander Graf <email address hidden>
Signed-off-by: Alexandru Vasile <email address hidden>
Signed-off-by: Andra Paraschiv <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Greg Kroah-Hartman <email address hidden>
(cherry picked from commit 9c8eb50fe9e2bb8a2e725979e052fb f592b6b799)
Signed-off-by: Kamal Mostafa <email address hidden> - 2141beb... by Andra Paraschiv <email address hidden>
-
nitro_enclaves: Add logic for starting an enclave
BugLink: https:/
/bugs.launchpad .net/bugs/ 1903087 After all the enclave resources are set, the enclave is ready for
beginning to run.Add ioctl command logic for starting an enclave after all its resources,
memory regions and CPUs, have been set.The enclave start information includes the local channel addressing -
vsock CID - and the flags associated with the enclave.Changelog
v9 -> v10
* Update commit message to include the changelog before the SoB tag(s).
v8 -> v9
* Use the ne_devs data structure to get the refs for the NE PCI device.
v7 -> v8
* Add check for invalid enclave CID value e.g. well-known CIDs and
parent VM CID.
* Add custom error code for incorrect flag in enclave start info and
invalid enclave CID.v6 -> v7
* Update the naming and add more comments to make more clear the logic
of handling full CPU cores and dedicating them to the enclave.v5 -> v6
* Check for invalid enclave start flags.
* Update documentation to kernel-doc format.v4 -> v5
* Add early exit on enclave start ioctl function call error.
* Move sanity checks in the enclave start ioctl function, outside of the
switch-case block.
* Remove log on copy_from_user() / copy_to_user() failure.v3 -> v4
* Use dev_err instead of custom NE log pattern.
* Update the naming for the ioctl command from metadata to info.
* Check for minimum enclave memory size.v2 -> v3
* Remove the WARN_ON calls.
* Update static calls sanity checks.v1 -> v2
* Add log pattern for NE.
* Check if enclave state is init when starting an enclave.
* Remove the BUG_ON calls.Reviewed-by: Alexander Graf <email address hidden>
Signed-off-by: Alexandru Vasile <email address hidden>
Signed-off-by: Andra Paraschiv <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Greg Kroah-Hartman <email address hidden>
(cherry picked from commit 111c775a5f0dc8c509c31ccfbf2209 ec545107a0)
Signed-off-by: Kamal Mostafa <email address hidden> - ea9ef62... by Andra Paraschiv <email address hidden>
-
nitro_enclaves: Add logic for setting an enclave memory region
BugLink: https:/
/bugs.launchpad .net/bugs/ 1903087 Another resource that is being set for an enclave is memory. User space
memory regions, that need to be backed by contiguous memory regions,
are associated with the enclave.One solution for allocating / reserving contiguous memory regions, that
is used for integration, is hugetlbfs. The user space process that is
associated with the enclave passes to the driver these memory regions.The enclave memory regions need to be from the same NUMA node as the
enclave CPUs.Add ioctl command logic for setting user space memory region for an
enclave.Changelog
v9 -> v10
* Update commit message to include the changelog before the SoB tag(s).
v8 -> v9
* Use the ne_devs data structure to get the refs for the NE PCI device.
v7 -> v8
* Add early check, while getting user pages, to be multiple of 2 MiB for
the pages that back the user space memory region.
* Add custom error code for incorrect user space memory region flag.
* Include in a separate function the sanity checks for each page of the
user space memory region.v6 -> v7
* Update check for duplicate user space memory regions to cover
additional possible scenarios.v5 -> v6
* Check for max number of pages allocated for the internal data
structure for pages.
* Check for invalid memory region flags.
* Check for aligned physical memory regions.
* Update documentation to kernel-doc format.
* Check for duplicate user space memory regions.
* Use directly put_page() instead of unpin_user_pages(), to match the
get_user_pages() calls.v4 -> v5
* Add early exit on set memory region ioctl function call error.
* Remove log on copy_from_user() failure.
* Exit without unpinning the pages on NE PCI dev request failure as
memory regions from the user space range may have already been added.
* Add check for the memory region user space address to be 2 MiB
aligned.
* Update logic to not have a hardcoded check for 2 MiB memory regions.v3 -> v4
* Check enclave memory regions are from the same NUMA node as the
enclave CPUs.
* Use dev_err instead of custom NE log pattern.
* Update the NE ioctl call to match the decoupling from the KVM API.v2 -> v3
* Remove the WARN_ON calls.
* Update static calls sanity checks.
* Update kzfree() calls to kfree().v1 -> v2
* Add log pattern for NE.
* Update goto labels to match their purpose.
* Remove the BUG_ON calls.
* Check if enclave max memory regions is reached when setting an enclave
memory region.
* Check if enclave state is init when setting an enclave memory region.Reviewed-by: Alexander Graf <email address hidden>
Signed-off-by: Alexandru Vasile <email address hidden>
Signed-off-by: Andra Paraschiv <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Greg Kroah-Hartman <email address hidden>
(cherry picked from commit 7dc9d4309fdb7773df13a17e203c16 966676f21a)
Signed-off-by: Kamal Mostafa <email address hidden> - 90fe7fc... by Andra Paraschiv <email address hidden>
-
nitro_enclaves: Add logic for getting the enclave image load info
BugLink: https:/
/bugs.launchpad .net/bugs/ 1903087 Before setting the memory regions for the enclave, the enclave image
needs to be placed in memory. After the memory regions are set, this
memory cannot be used anymore by the VM, being carved out.Add ioctl command logic to get the offset in enclave memory where to
place the enclave image. Then the user space tooling copies the enclave
image in the memory using the given memory offset.Changelog
v9 -> v10
* Update commit message to include the changelog before the SoB tag(s).
v8 -> v9
* No changes.
v7 -> v8
* Add custom error code for incorrect enclave image load info flag.
v6 -> v7
* No changes.
v5 -> v6
* Check for invalid enclave image load flags.
v4 -> v5
* Check for the enclave not being started when invoking this ioctl call.
* Remove log on copy_from_user() / copy_to_user() failure.v3 -> v4
* Use dev_err instead of custom NE log pattern.
* Set enclave image load offset based on flags.
* Update the naming for the ioctl command from metadata to info.v2 -> v3
* No changes.
v1 -> v2
* New in v2.
Reviewed-by: Alexander Graf <email address hidden>
Signed-off-by: Andra Paraschiv <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Greg Kroah-Hartman <email address hidden>
(cherry picked from commit 988b7a471726209330b739adafc545 63cbdbf986)
Signed-off-by: Kamal Mostafa <email address hidden> - 9139e25... by Andra Paraschiv <email address hidden>
-
nitro_enclaves: Add logic for setting an enclave vCPU
BugLink: https:/
/bugs.launchpad .net/bugs/ 1903087 An enclave, before being started, has its resources set. One of its
resources is CPU.A NE CPU pool is set and enclave CPUs are chosen from it. Offline the
CPUs from the NE CPU pool during the pool setup and online them back
during the NE CPU pool teardown. The CPU offline is necessary so that
there would not be more vCPUs than physical CPUs available to the
primary / parent VM. In that case the CPUs would be overcommitted and
would change the initial configuration of the primary / parent VM of
having dedicated vCPUs to physical CPUs.The enclave CPUs need to be full cores and from the same NUMA node. CPU
0 and its siblings have to remain available to the primary / parent VM.Add ioctl command logic for setting an enclave vCPU.
Changelog
v9 -> v10
* Update commit message to include the changelog before the SoB tag(s).
v8 -> v9
* Use the ne_devs data structure to get the refs for the NE PCI device.
v7 -> v8
* No changes.
v6 -> v7
* Check for error return value when setting the kernel parameter string.
* Use the NE misc device parent field to get the NE PCI device.
* Update the naming and add more comments to make more clear the logic
of handling full CPU cores and dedicating them to the enclave.
* Calculate the number of threads per core and not use smp_num_siblings
that is x86 specific.v5 -> v6
* Check CPUs are from the same NUMA node before going through CPU
siblings during the NE CPU pool setup.
* Update documentation to kernel-doc format.v4 -> v5
* Set empty string in case of invalid NE CPU pool.
* Clear NE CPU pool mask on pool setup failure.
* Setup NE CPU cores out of the NE CPU pool.
* Early exit on NE CPU pool setup if enclave(s) already running.
* Remove sanity checks for situations that shouldn't happen, only if
buggy system or broken logic at all.
* Add check for maximum vCPU id possible before looking into the CPU
pool.
* Remove log on copy_from_user() / copy_to_user() failure and on admin
capability check for setting the NE CPU pool.
* Update the ioctl call to not create a file descriptor for the vCPU.
* Split the CPU pool usage logic in 2 separate functions - one to get a
CPU from the pool and the other to check the given CPU is available in
the pool.v3 -> v4
* Setup the NE CPU pool at runtime via a sysfs file for the kernel
parameter.
* Check enclave CPUs to be from the same NUMA node.
* Use dev_err instead of custom NE log pattern.
* Update the NE ioctl call to match the decoupling from the KVM API.v2 -> v3
* Remove the WARN_ON calls.
* Update static calls sanity checks.
* Update kzfree() calls to kfree().
* Remove file ops that do nothing for now - open, ioctl and release.v1 -> v2
* Add log pattern for NE.
* Update goto labels to match their purpose.
* Remove the BUG_ON calls.
* Check if enclave state is init when setting enclave vCPU.Reviewed-by: Alexander Graf <email address hidden>
Signed-off-by: Alexandru Vasile <email address hidden>
Signed-off-by: Andra Paraschiv <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Greg Kroah-Hartman <email address hidden>
(cherry picked from commit ff8a4d3e3a99a32a54828e1b2af77a abdca2cabb)
Signed-off-by: Kamal Mostafa <email address hidden>