~sforshee/ubuntu/+source/linux/+git/disco:lockdown-updates

Last commit made on 2020-06-16
Get this branch:
git clone -b lockdown-updates https://git.launchpad.net/~sforshee/ubuntu/+source/linux/+git/disco
Only Seth Forshee can upload to this branch. If you are Seth Forshee please log in for upload directions.

Branch merges

Branch information

Name:
lockdown-updates
Repository:
lp:~sforshee/ubuntu/+source/linux/+git/disco

Recent commits

9f1a24f... by Seth Forshee

UBUNTU: [Config] CONFIG_XMON_DEFAULT_RO_MODE=y

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

Signed-off-by: Seth Forshee <email address hidden>

c4a8db0... by Jason A. Donenfeld

UBUNTU: SAUCE: acpi: disallow loading configfs acpi tables when locked down

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

Like other vectors already patched, this one here allows the root user
to load ACPI tables, which enables arbitrary physical address writes,
which in turn makes it possible to disable lockdown. This patch prevents
this by checking the lockdown status before allowing a new ACPI table to be
installed. The link in the trailer shows a PoC of how this might be
used.

Signed-off-by: Jason A. Donenfeld <email address hidden>
Cc: <email address hidden>
Link: https://git.zx2c4.com/american-unsigned-language/tree/american-unsigned-language-2.sh
Link: https://<email address hidden>/
[ saf: Backport to older lockdown implementation ]
Signed-off-by: Seth Forshee <email address hidden>

514d34c... by "Christopher M. Riedl" <email address hidden>

powerpc/xmon: Restrict when kernel is locked down

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

Xmon should be either fully or partially disabled depending on the
kernel lockdown state.

Put xmon into read-only mode for lockdown=integrity and prevent user
entry into xmon when lockdown=confidentiality. Xmon checks the lockdown
state on every attempted entry:

 (1) during early xmon'ing

 (2) when triggered via sysrq

 (3) when toggled via debugfs

 (4) when triggered via a previously enabled breakpoint

The following lockdown state transitions are handled:

 (1) lockdown=none -> lockdown=integrity
     set xmon read-only mode

 (2) lockdown=none -> lockdown=confidentiality
     clear all breakpoints, set xmon read-only mode,
     prevent user re-entry into xmon

 (3) lockdown=integrity -> lockdown=confidentiality
     clear all breakpoints, set xmon read-only mode,
     prevent user re-entry into xmon

Suggested-by: Andrew Donnellan <email address hidden>
Signed-off-by: Christopher M. Riedl <email address hidden>
Signed-off-by: Michael Ellerman <email address hidden>
Link: https://<email address hidden>
(backported from commit 69393cb03ccdf29f3b452d3482ef918469d1c098)
Signed-off-by: Seth Forshee <email address hidden>

5e3d112... by "Christopher M. Riedl" <email address hidden>

powerpc/xmon: add read-only mode

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

Operations which write to memory and special purpose registers should be
restricted on systems with integrity guarantees (such as Secure Boot)
and, optionally, to avoid self-destructive behaviors.

Add a config option, XMON_DEFAULT_RO_MODE, to set default xmon behavior.
The kernel cmdline options xmon=ro and xmon=rw override this default.

The following xmon operations are affected:
memops:
 disable memmove
 disable memset
 disable memzcan
memex:
 no-op'd mwrite
super_regs:
 no-op'd write_spr
bpt_cmds:
 disable
proc_call:
 disable

Signed-off-by: Christopher M. Riedl <email address hidden>
Reviewed-by: Oliver O'Halloran <email address hidden>
Reviewed-by: Andrew Donnellan <email address hidden>
Signed-off-by: Michael Ellerman <email address hidden>
(cherry picked from commit 0acb5f64560a052fd66ab37b212a72964847160f)
Signed-off-by: Seth Forshee <email address hidden>

02c6ea8... by Matthew Garrett <email address hidden>

efi: Restrict efivar_ssdt_load when the kernel is locked down

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

efivar_ssdt_load allows the kernel to import arbitrary ACPI code from an
EFI variable, which gives arbitrary code execution in ring 0. Prevent
that when the kernel is locked down.

Signed-off-by: Matthew Garrett <email address hidden>
Acked-by: Ard Biesheuvel <email address hidden>
Reviewed-by: Kees Cook <email address hidden>
Cc: Ard Biesheuvel <email address hidden>
Cc: <email address hidden>
Signed-off-by: James Morris <email address hidden>
(backported from commit 1957a85b0032a81e6482ca4aab883643b8dae06e)
Reported-by: Jason A. Donenfeld <email address hidden>
Signed-off-by: Seth Forshee <email address hidden>

18700c7... by Javier Martinez Canillas <email address hidden>

efi/efi_test: Lock down /dev/efi_test and require CAP_SYS_ADMIN

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

The driver exposes EFI runtime services to user-space through an IOCTL
interface, calling the EFI services function pointers directly without
using the efivar API.

Disallow access to the /dev/efi_test character device when the kernel is
locked down to prevent arbitrary user-space to call EFI runtime services.

Also require CAP_SYS_ADMIN to open the chardev to prevent unprivileged
users to call the EFI runtime services, instead of just relying on the
chardev file mode bits for this.

The main user of this driver is the fwts [0] tool that already checks if
the effective user ID is 0 and fails otherwise. So this change shouldn't
cause any regression to this tool.

[0]: https://wiki.ubuntu.com/FirmwareTestSuite/Reference/uefivarinfo

Signed-off-by: Javier Martinez Canillas <email address hidden>
Signed-off-by: Ard Biesheuvel <email address hidden>
Acked-by: Laszlo Ersek <email address hidden>
Acked-by: Matthew Garrett <email address hidden>
Cc: Linus Torvalds <email address hidden>
Cc: Peter Zijlstra <email address hidden>
Cc: Thomas Gleixner <email address hidden>
Cc: <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Ingo Molnar <email address hidden>
(backported from commit 359efcc2c910117d2faf704ce154e91fc976d37f)
Signed-off-by: Seth Forshee <email address hidden>

18af4d0... by Seth Forshee

UBUNTU: [Config] Update kexec signature config options

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

A previous patch split KEXEC_VERIFY_SIG into KEXEC_SIG and
KEXEC_SIG_FORCE. Update our configs to enable KEXEC_SIG and
disable KEXEC_SIG_FORCE. This will make the kernel reject images
with invalid signtures, but will still permit loading of unsigned
images when lockdown is not enabled.

Signed-off-by: Seth Forshee <email address hidden>

f51e243... by Jiri Bohac <email address hidden>

UBUNTU: SAUCE: (efi-lockdown) kexec_file: Restrict at runtime if the kernel is locked down

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

When KEXEC_SIG is not enabled, kernel should not load images through
kexec_file systemcall if the kernel is locked down.

[Modified by David Howells to fit with modifications to the previous patch
 and to return -EPERM if the kernel is locked down for consistency with
 other lockdowns. Modified by Matthew Garrett to remove the IMA
 integration, which will be replaced by integrating with the IMA
 architecture policy patches.]

Signed-off-by: Jiri Bohac <email address hidden>
Signed-off-by: David Howells <email address hidden>
Reviewed-by: Jiri Bohac <email address hidden>
cc: <email address hidden>
Signed-off-by: Matthew Garrett <email address hidden>
(cherry picked from commit 0534109a5184b15bdec4cb66822894478c689603
 git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git)
Signed-off-by: Seth Forshee <email address hidden>

07a0a24... by Jiri Bohac <email address hidden>

UBUNTU: SAUCE: (efi-lockdown) kexec_file: split KEXEC_VERIFY_SIG into KEXEC_SIG and KEXEC_SIG_FORCE

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

This is a preparatory patch for kexec_file_load() lockdown. A locked down
kernel needs to prevent unsigned kernel images from being loaded with
kexec_file_load(). Currently, the only way to force the signature
verification is compiling with KEXEC_VERIFY_SIG. This prevents loading
usigned images even when the kernel is not locked down at runtime.

This patch splits KEXEC_VERIFY_SIG into KEXEC_SIG and KEXEC_SIG_FORCE.
Analogous to the MODULE_SIG and MODULE_SIG_FORCE for modules, KEXEC_SIG
turns on the signature verification but allows unsigned images to be
loaded. KEXEC_SIG_FORCE disallows images without a valid signature.

[Modified by David Howells such that:

 (1) verify_pefile_signature() differentiates between no-signature and
     sig-didn't-match in its returned errors.

 (2) kexec fails with EKEYREJECTED and logs an appropriate message if
     signature checking is enforced and an signature is not found, uses
     unsupported crypto or has no matching key.

 (3) kexec fails with EKEYREJECTED if there is a signature for which we
     have a key, but signature doesn't match - even if in non-forcing mode.

 (4) kexec fails with EBADMSG or some other error if there is a signature
     which cannot be parsed - even if in non-forcing mode.

 (5) kexec fails with ELIBBAD if the PE file cannot be parsed to extract
     the signature - even if in non-forcing mode.

]

Signed-off-by: Jiri Bohac <email address hidden>
Signed-off-by: David Howells <email address hidden>
Reviewed-by: Jiri Bohac <email address hidden>
cc: <email address hidden>
Signed-off-by: Matthew Garrett <email address hidden>
(cherry picked from commit 76f8617a4f9ddd1dae5cbd9c4efc509d43eb2503
 git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git)
Signed-off-by: Seth Forshee <email address hidden>

e0ed87e... by Marcelo Cerri

UBUNTU: Ubuntu-5.0.0-53.57

Signed-off-by: Marcelo Henrique Cerri <email address hidden>