~timg-tpi/ubuntu/+source/linux/+git/focal:focal-nitro-enclaves-sf00323459

Last commit made on 2021-11-22
Get this branch:
git clone -b focal-nitro-enclaves-sf00323459 https://git.launchpad.net/~timg-tpi/ubuntu/+source/linux/+git/focal
Only Tim Gardner can upload to this branch. If you are Tim Gardner please log in for upload directions.

Branch merges

Branch information

Name:
focal-nitro-enclaves-sf00323459
Repository:
lp:~timg-tpi/ubuntu/+source/linux/+git/focal

Recent commits

6a6ddf2... by Andra Paraschiv <email address hidden>

nitro_enclaves: Add fixes for checkpatch blank line reports

BugLink: https://bugs.launchpad.net/bugs/1951873

Remove blank lines that are not necessary, fixing the checkpatch script
reports. While at it, add a blank line after the switch default block,
similar to the other parts of the codebase.

Reviewed-by: George-Aurelian Popescu <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 da1c396a81b87541cf7a7c2c6e128b722461a1c8)
Signed-off-by: Tim Gardner <email address hidden>

ed2d458... by Andra Paraschiv <email address hidden>

nitro_enclaves: Add fixes for checkpatch spell check reports

BugLink: https://bugs.launchpad.net/bugs/1951873

Fix the typos in the words spelling as per the checkpatch script
reports.

Reviewed-by: George-Aurelian Popescu <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 059ebe4fe332c5d1c25124166527cdf9fe43a3ce)
Signed-off-by: Tim Gardner <email address hidden>

a7969ce... by Andra Paraschiv <email address hidden>

nitro_enclaves: Add fixes for checkpatch match open parenthesis reports

BugLink: https://bugs.launchpad.net/bugs/1951873

Update the codebase formatting to fix the reports from the checkpatch
script, to match the open parenthesis.

Reviewed-by: George-Aurelian Popescu <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 02bba596de19c0b951b2843ebcd7a9da6e0938d4)
Signed-off-by: Tim Gardner <email address hidden>

e73c7b7... by Andra Paraschiv <email address hidden>

nitro_enclaves: Update copyright statement to include 2021

BugLink: https://bugs.launchpad.net/bugs/1951873

Update the copyright statement to include 2021, as a change has been
made over this year.

Check commit d874742f6a73 ("nitro_enclaves: Set Bus Master for the NE
PCI device") for the codebase update from this file (ne_pci_dev.c).

Reviewed-by: George-Aurelian Popescu <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 e3cba4d2454c2e4034147ca53b75c6592ded7c5a)
Signed-off-by: Tim Gardner <email address hidden>

ed65f34... by Andra Paraschiv <email address hidden>

nitro_enclaves: Add fix for the kernel-doc report

BugLink: https://bugs.launchpad.net/bugs/1951873

Fix the reported issue from the kernel-doc script, to have a comment per
identifier.

Reviewed-by: George-Aurelian Popescu <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 e16a30a419c89d71e68f4da348b48918944fd49c)
Signed-off-by: Tim Gardner <email address hidden>

924c98c... by Andra Paraschiv <email address hidden>

nitro_enclaves: Update documentation for Arm64 support

BugLink: https://bugs.launchpad.net/bugs/1951873

Add references for hugepages and booting steps for Arm64.

Include info about the current supported architectures for the
NE kernel driver.

Reviewed-by: George-Aurelian Popescu <email address hidden>
Acked-by: Stefano Garzarella <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 cfa3c18cd528f48fd1b4b584f330df8f00b8a97f)
Signed-off-by: Tim Gardner <email address hidden>

0ddff26... by Andra Paraschiv <email address hidden>

nitro_enclaves: Enable Arm64 support

BugLink: https://bugs.launchpad.net/bugs/1951873

Update the kernel config to enable the Nitro Enclaves kernel driver for
Arm64 support.

Reviewed-by: George-Aurelian Popescu <email address hidden>
Acked-by: Stefano Garzarella <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 f7e55f05301e71af557c45224817438670225aa7)
Signed-off-by: Tim Gardner <email address hidden>

70db649... by "Longpeng(Mike)" <email address hidden>

nitro_enclaves: Set Bus Master for the NE PCI device

BugLink: https://bugs.launchpad.net/bugs/1951873

Enable Bus Master for the NE PCI device, according to the PCI spec
for submitting memory or I/O requests:

 Master Enable – Controls the ability of a PCI Express
  Endpoint to issue Memory and I/O Read/Write Requests, and
  the ability of a Root or Switch Port to forward Memory and
  I/O Read/Write Requests in the Upstream direction

Cc: Andra Paraschiv <email address hidden>
Cc: Alexandru Vasile <email address hidden>
Cc: Alexandru Ciobotaru <email address hidden>
Reviewed-by: Andra Paraschiv <email address hidden>
Signed-off-by: Longpeng(Mike) <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Greg Kroah-Hartman <email address hidden>
(cherry picked from commit d874742f6a734c73c22235f9d56b8f10bcf17c5f)
Signed-off-by: Tim Gardner <email address hidden>

3e8f307... by Mathias Krause <email address hidden>

nitro_enclaves: Fix stale file descriptors on failed usercopy

BugLink: https://bugs.launchpad.net/bugs/1951873

A failing usercopy of the slot uid will lead to a stale entry in the
file descriptor table as put_unused_fd() won't release it. This enables
userland to refer to a dangling 'file' object through that still valid
file descriptor, leading to all kinds of use-after-free exploitation
scenarios.

Exchanging put_unused_fd() for close_fd(), ksys_close() or alike won't
solve the underlying issue, as the file descriptor might have been
replaced in the meantime, e.g. via userland calling close() on it
(leading to a NULL pointer dereference in the error handling code as
'fget(enclave_fd)' will return a NULL pointer) or by dup2()'ing a
completely different file object to that very file descriptor, leading
to the same situation: a dangling file descriptor pointing to a freed
object -- just in this case to a file object of user's choosing.

Generally speaking, after the call to fd_install() the file descriptor
is live and userland is free to do whatever with it. We cannot rely on
it to still refer to our enclave object afterwards. In fact, by abusing
userfaultfd() userland can hit the condition without any racing and
abuse the error handling in the nitro code as it pleases.

To fix the above issues, defer the call to fd_install() until all
possible errors are handled. In this case it's just the usercopy, so do
it directly in ne_create_vm_ioctl() itself.

Signed-off-by: Mathias Krause <email address hidden>
Signed-off-by: Andra Paraschiv <email address hidden>
Cc: stable <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Greg Kroah-Hartman <email address hidden>
(cherry picked from commit f1ce3986baa62cffc3c5be156994de87524bab99)
Signed-off-by: Tim Gardner <email address hidden>

5dc7cd9... by Andra Paraschiv <email address hidden>

nitro_enclaves: Fixup type and simplify logic of the poll mask setup

BugLink: https://bugs.launchpad.net/bugs/1951873

Update the assigned value of the poll result to be EPOLLHUP instead of
POLLHUP to match the __poll_t type.

While at it, simplify the logic of setting the mask result of the poll
function.

Reported-by: kernel test robot <email address hidden>
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 d9109fe0f30a1fba66b8623837fc3d3c1a031090)
Signed-off-by: Tim Gardner <email address hidden>