From: David Howells <dhowells@redhat.com> Date: 2018-03-30 23:29:44
Date: Thu, 26 Oct 2017 17:37:38 +0100
Hi James,
Can you pull this patchset into security/next please? It has been in
linux-next since the beginning of March.
It adds kernel lockdown support for EFI secure boot.
There's a manual page (kernel_lockdown.7) associated with this:
.\"
.\" Copyright (C) 2017 Red Hat, Inc. All Rights Reserved.
.\" Written by David Howells (dhowells at redhat.com)
.\"
.\" %%%LICENSE_START(GPLv2+_SW_ONEPARA)
.\" This program is free software; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License
.\" as published by the Free Software Foundation; either version
.\" 2 of the License, or (at your option) any later version.
.\" %%%LICENSE_END
.\"
.TH "KERNEL LOCKDOWN" 7 2017-10-05 Linux "Linux Programmer's Manual"
.SH NAME
Kernel Lockdown \- Kernel image access prevention feature
.SH DESCRIPTION
The Kernel Lockdown feature is designed to prevent both direct and indirect
access to a running kernel image, attempting to protect against unauthorised
modification of the kernel image and to prevent access to security and
cryptographic data located in kernel memory, whilst still permitting driver
modules to be loaded.
.P
Lockdown is typically enabled during boot and may be terminated, if configured,
by typing a special key combination on a directly attached physical keyboard.
.P
If a prohibited or restricted feature is accessed or used, the kernel will emit
a message that looks like:
.P
.RS
Lockdown: X: Y is restricted, see man kernel_lockdown.7
.RE
.P
where X indicates the process name and Y indicates what is restricted.
.P
On an EFI-enabled x86 or arm64 machine, lockdown will be automatically enabled
if the system boots in EFI Secure Boot mode.
.P
If the kernel is appropriately configured, lockdown may be lifted by typing the
appropriate sequence on a directly attached physical keyboard. For x86
machines, this is
.IR SysRq+x .
.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.SH COVERAGE
When lockdown is in effect, a number of features are disabled or have their use
restricted. This includes special device files and kernel services that allow
direct access of the kernel image:
.P
.RS
/dev/mem
.br
/dev/kmem
.br
/dev/kcore
.br
/dev/ioports
.br
BPF
.br
kprobes
.RE
.P
and the ability to directly configure and control devices, so as to prevent the
use of a device to access or modify a kernel image:
.P
.RS
The use of module parameters that directly specify hardware parameters to
drivers through the kernel command line or when loading a module.
.P
The use of direct PCI BAR access.
.P
The use of the ioperm and iopl instructions on x86.
.P
The use of the KD*IO console ioctls.
.P
The use of the TIOCSSERIAL serial ioctl.
.P
The alteration of MSR registers on x86.
.P
The replacement of the PCMCIA CIS.
.P
The overriding of ACPI tables.
.P
The use of ACPI error injection.
.P
The specification of the ACPI RDSP address.
.P
The use of ACPI custom methods.
.RE
.P
Certain facilities are restricted:
.P
.RS
Only validly signed modules may be loaded (waived if the module file being
loaded is vouched for by IMA appraisal).
.P
Only validly signed binaries may be kexec'd (waived if the binary image file to
be executed is vouched for by IMA appraisal).
.P
Unencrypted hibernation/suspend to swap are disallowed as the kernel image is
saved to a medium that can then be accessed.
.P
Use of debugfs is not permitted as this allows a whole range of actions
including direct configuration of, access to and driving of hardware.
.P
IMA requires the addition of the "secure_boot" rules to the policy, whether or
not they are specified on the command line, for both the builtin and custom
policies in secure boot lockdown mode.
.RE
David
---
The following changes since commit 6f70eb2b00eb416146247c65003d31f4df983ce0:
Merge branch 'idr-2018-02-06' of git://git.infradead.org/users/willy/linux-dax (2018-02-26 13:22:45 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git tags/lockdown-20180330
for you to fetch changes up to 89bcd5b02f125335f74289c5f4ae03e9b893ab7f:
lockdown: Print current->comm in restriction messages (2018-02-28 14:43:03 +0000)
----------------------------------------------------------------
Kernel lockdown
----------------------------------------------------------------
Dave Young (1):
Copy secure_boot flag in boot params across kexec reboot
David Howells (15):
Add the ability to lock down access to the running kernel image
Enforce module signatures if the kernel is locked down
scsi: Lock down the eata driver
Prohibit PCMCIA CIS storage when the kernel is locked down
Lock down TIOCSSERIAL
Lock down module params that specify hardware parameters (eg. ioport)
x86/mmiotrace: Lock down the testmmiotrace module
Lock down /proc/kcore
Lock down kprobes
bpf: Restrict kernel image access functions when the kernel is locked down
Lock down perf
debugfs: Restrict debugfs when the kernel is locked down
efi: Add an EFI_SECURE_BOOT flag to indicate secure boot mode
efi: Lock down the kernel if booted in secure boot mode
lockdown: Print current->comm in restriction messages
Jiri Bohac (2):
kexec_file: split KEXEC_VERIFY_SIG into KEXEC_SIG and KEXEC_SIG_FORCE
kexec_file: Restrict at runtime if the kernel is locked down
Josh Boyer (2):
hibernate: Disable when the kernel is locked down
acpi: Ignore acpi_rsdp kernel param when the kernel has been locked down
Kyle McMartin (1):
Add a SysRq option to lift kernel lockdown
Linn Crosetto (2):
acpi: Disable ACPI table override if the kernel is locked down
acpi: Disable APEI error injection if the kernel is locked down
Matthew Garrett (7):
Restrict /dev/{mem,kmem,port} when the kernel is locked down
kexec_load: Disable at runtime if the kernel is locked down
uswsusp: Disable when the kernel is locked down
PCI: Lock down BAR access when the kernel is locked down
x86: Lock down IO port access when the kernel is locked down
x86/msr: Restrict MSR access when the kernel is locked down
ACPI: Limit access to custom_method when the kernel is locked down
Mimi Zohar (1):
ima: require secure_boot rules in lockdown mode
arch/x86/Kconfig | 20 ++++--
arch/x86/include/asm/setup.h | 2 +
arch/x86/kernel/ioport.c | 6 +-
arch/x86/kernel/kexec-bzimage64.c | 1 +
arch/x86/kernel/machine_kexec_64.c | 2 +-
arch/x86/kernel/msr.c | 10 +++
arch/x86/kernel/setup.c | 18 ++----
arch/x86/mm/testmmiotrace.c | 3 +
crypto/asymmetric_keys/verify_pefile.c | 4 +-
drivers/acpi/apei/einj.c | 3 +
drivers/acpi/custom_method.c | 3 +
drivers/acpi/osl.c | 2 +-
drivers/acpi/tables.c | 5 ++
drivers/char/mem.c | 2 +
drivers/firmware/efi/Makefile | 1 +
drivers/firmware/efi/secureboot.c | 38 ++++++++++++
drivers/input/misc/uinput.c | 1 +
drivers/pci/pci-sysfs.c | 9 +++
drivers/pci/proc.c | 9 ++-
drivers/pci/syscall.c | 3 +-
drivers/pcmcia/cistpl.c | 3 +
drivers/scsi/eata.c | 5 +-
drivers/tty/serial/serial_core.c | 6 ++
drivers/tty/sysrq.c | 19 ++++--
fs/debugfs/file.c | 28 +++++++++
fs/debugfs/inode.c | 30 ++++++++-
fs/proc/kcore.c | 2 +
include/linux/efi.h | 16 +++--
include/linux/input.h | 5 ++
include/linux/kernel.h | 17 ++++++
include/linux/kexec.h | 4 +-
include/linux/security.h | 8 +++
include/linux/sysrq.h | 8 ++-
kernel/bpf/syscall.c | 3 +
kernel/debug/kdb/kdb_main.c | 2 +-
kernel/events/core.c | 5 ++
kernel/kexec.c | 7 +++
kernel/kexec_file.c | 56 ++++++++++++++---
kernel/kprobes.c | 3 +
kernel/module.c | 56 +++++++++++++----
kernel/params.c | 26 ++++++--
kernel/power/hibernate.c | 2 +-
kernel/power/user.c | 3 +
security/Kconfig | 32 ++++++++++
security/Makefile | 3 +
security/integrity/ima/ima_policy.c | 39 +++++++++---
security/lock_down.c | 108 +++++++++++++++++++++++++++++++++
47 files changed, 557 insertions(+), 81 deletions(-)
create mode 100644 drivers/firmware/efi/secureboot.c
create mode 100644 security/lock_down.c
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: James Morris <jmorris@namei.org> Date: 2018-03-31 00:46:10
On Sat, 31 Mar 2018, David Howells wrote:
Date: Thu, 26 Oct 2017 17:37:38 +0100
Hi James,
Can you pull this patchset into security/next please? It has been in
linux-next since the beginning of March.
It adds kernel lockdown support for EFI secure boot.
Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git
next-lockdown and next-testing
Are there any known coverage gaps now?
--
James Morris
[off-list ref]
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: David Howells <dhowells@redhat.com> Date: 2018-03-31 10:20:00
James Morris [off-list ref] wrote:
Are there any known coverage gaps now?
I've covered all the ones I know about.
David
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Andy Lutomirski <luto@kernel.org> Date: 2018-04-03 00:37:17
On 03/30/2018 05:46 PM, James Morris wrote:
On Sat, 31 Mar 2018, David Howells wrote:
quoted
Date: Thu, 26 Oct 2017 17:37:38 +0100
Hi James,
Can you pull this patchset into security/next please? It has been in
linux-next since the beginning of March.
It adds kernel lockdown support for EFI secure boot.
Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git
next-lockdown and next-testing
Are there any known coverage gaps now?
This is an attempt at a review. I'm replying here because I can't find
the actual relevant patch emails.
Cover letter:
> Here's a set of patches to institute a "locked-down mode" in the
> kernel and to trigger that mode if the kernel is booted in
secure-boot > mode or through the command line.
I think this is seriously problematic in that it's not well defined. It
sounds like "locked-down mode" means "make me feel good about
something". For the rest of this review, I'm going to pretend that you
actually want two features:
"try-prevent-root-from-corrupting-the-kernel" and
"try-to-prevent-root-from-reading-kernel-memory".
Also, there should be a justification that allows normal people (i.e.
those who are not involved in the UEFI signing process) to understand
*why* this should have anything to do with UEFI. I can very easily see
why it would make sense for a UEFI authenticated variable to tell the
kernel to enable one or both of these modes or for there to be an
authenticated mechanism for the bootloader to tell the kernel to enable
it. I do *not* see why the mere act of using Secure Boot should have
this effect.
In particular, UEFI Secure Boot should *not* enable
"try-to-prevent-root-from-reading-kernel-memory", which means that,
unless you actually implement the split, you should drop a bunch of the
patches.
In fact, I think the kernel should try to get away from the idea that
UEFI Secure Boot should imply annoying restrictions. It's really
annoying and it's never been clear to me that it has a benefit.
"Restrict /dev/{mem,kmem,port} when the kernel is locked down": this
should probably split into one restriction for read and one for write.
"Lock down /proc/kcore": should only apply to
"try-to-prevent-root-from-reading-kernel-memory"
"Lock down kprobes": ditto
"bpf: Restrict kernel image access functions when the kernel is locked
down": This patch just sucks in general. At the very least, it should
only apply to "bpf: Restrict kernel image access functions when the
kernel is locked down". But you should probably just force all eBPF
users through the unprivileged path when locked down instead, since eBPF
is really quite useful even with the stricter verification mode.
"Lock down perf": how about preventing using perf on the kernel when
"try-to-prevent-root-from-reading-kernel-memory" is set and not
restricting it otherwise?
"debugfs: Restrict debugfs when the kernel is locked down": The logic is
IMO nutty. Why the 0444 restriction? I see no reason that reading a
0644 file should be treated any differently from reading a 0444 file.
Regardless, I think you should prevent writing or reading depending on
lockdown mode and add an API so that individual debugfs files can
override this.
"efi: Lock down the kernel if booted in secure boot mode": you have a
stray change in fs/debugfs/inode.c in here. Also, as above, I really
dislike this patch.
"lockdown: Print current->comm in restriction messages": Shouldn't this
be folded in with whatever patch added that code in the first place?
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Apr 2, 2018 at 5:37 PM, Andy Lutomirski [off-list ref] wrote:
On 03/30/2018 05:46 PM, James Morris wrote:
quoted
On Sat, 31 Mar 2018, David Howells wrote:
quoted
Date: Thu, 26 Oct 2017 17:37:38 +0100
Hi James,
Can you pull this patchset into security/next please? It has been in
linux-next since the beginning of March.
It adds kernel lockdown support for EFI secure boot.
Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git
next-lockdown and next-testing
Are there any known coverage gaps now?
This is an attempt at a review. I'm replying here because I can't find the
actual relevant patch emails.
Cover letter:
quoted
Here's a set of patches to institute a "locked-down mode" in the
kernel and to trigger that mode if the kernel is booted in secure-boot >
mode or through the command line.
I think this is seriously problematic in that it's not well defined. It
sounds like "locked-down mode" means "make me feel good about something".
Naming of this feature has been multi-year bikeshedding, so if we
could just leave the name, that'd be nice.
For the rest of this review, I'm going to pretend that you actually want two
features: "try-prevent-root-from-corrupting-the-kernel" and
"try-to-prevent-root-from-reading-kernel-memory".
That is how I view it, yes. It's about creating a bright line between
uid-0 and ring-0. The most powerful of these distinctions was made
long ago with signed modules. It hasn't been enough, though, since
there have been many ways for uid-0 to read or write kernel memory. My
expectation for this was to reasonably fill all the remaining gaps.
Also, there should be a justification that allows normal people (i.e. those
who are not involved in the UEFI signing process) to understand *why* this
should have anything to do with UEFI. I can very easily see why it would
make sense for a UEFI authenticated variable to tell the kernel to enable
one or both of these modes or for there to be an authenticated mechanism for
the bootloader to tell the kernel to enable it. I do *not* see why the mere
act of using Secure Boot should have this effect.
In particular, UEFI Secure Boot should *not* enable
"try-to-prevent-root-from-reading-kernel-memory", which means that, unless
you actually implement the split, you should drop a bunch of the patches.
In fact, I think the kernel should try to get away from the idea that UEFI
Secure Boot should imply annoying restrictions. It's really annoying and
it's never been clear to me that it has a benefit.
FWIW, I've never been a fan of this being UEFI-centric: more than
Secure Boot needs this. For example, Chrome OS's static root of trust
and boot firmware isn't UEFI, but it wants this feature enabled.
Chrome OS would set it on the command line, since the command line is
part of the signed boot image along with the kernel, etc.
"Restrict /dev/{mem,kmem,port} when the kernel is locked down": this should
probably split into one restriction for read and one for write.
I think splitting read and write is only useful if there is a use-case
for only blocking one of them. I struggle to imagine allowing write
and blocking read, so really it's the case of wanting to allow read
and disallow write. Is there actually a use-case for this? In all the
"locked down" cases I've seen, both are desired.
-Kees
--
Kees Cook
Pixel Security
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Andy Lutomirski <luto@amacapital.net> Date: 2018-04-03 01:47:10
On Apr 2, 2018, at 5:59 PM, Kees Cook [off-list ref] wrote:
quoted
On Mon, Apr 2, 2018 at 5:37 PM, Andy Lutomirski [off-list ref] wrote:
quoted
On 03/30/2018 05:46 PM, James Morris wrote:
quoted
On Sat, 31 Mar 2018, David Howells wrote:
Date: Thu, 26 Oct 2017 17:37:38 +0100
Hi James,
Can you pull this patchset into security/next please? It has been in
linux-next since the beginning of March.
It adds kernel lockdown support for EFI secure boot.
Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git
next-lockdown and next-testing
Are there any known coverage gaps now?
This is an attempt at a review. I'm replying here because I can't find the
actual relevant patch emails.
Cover letter:
quoted
Here's a set of patches to institute a "locked-down mode" in the
kernel and to trigger that mode if the kernel is booted in secure-boot >
mode or through the command line.
I think this is seriously problematic in that it's not well defined. It
sounds like "locked-down mode" means "make me feel good about something".
Naming of this feature has been multi-year bikeshedding, so if we
could just leave the name, that'd be nice.
Fair enough. How about enum kernel_lockdown_level with three modes?
quoted
"Restrict /dev/{mem,kmem,port} when the kernel is locked down": this should
probably split into one restriction for read and one for write.
I think splitting read and write is only useful if there is a use-case
for only blocking one of them. I struggle to imagine allowing write
and blocking read, so really it's the case of wanting to allow read
and disallow write. Is there actually a use-case for this? In all the
"locked down" cases I've seen, both are desired.
Let?s suppose for the sake of argument that UEFI really has a good reason to block writes. Blocking reads (kprobes, perf, etc) sounds extremely annoying, especially if running a stock distro, and I?d much rather not do it unless there?s a specific use case that needs it. --
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: David Howells <dhowells@redhat.com> Date: 2018-04-03 07:07:06
Andy Lutomirski [off-list ref] wrote:
This is an attempt at a review. I'm replying here because I can't find the
actual relevant patch emails.
This was the latest post:
https://lkml.org/lkml/2017/11/9/660
and they were posted multiple times before that, plus distributions, such as
Fedora, have been carrying them for a long while.
For the rest of this review, I'm going to pretend that you actually want two
features: "try-prevent-root-from-corrupting-the-kernel" and
"try-to-prevent-root-from-reading-kernel-memory".
It theoretically boils down into those two, but the line is blurrier than you
think.
Further, some of the vectors that can be used to do one can potentially do the
other also and it starts getting to be a lot of extra work to distinguish the
two.
I do *not* see why the mere act of using Secure Boot should have this
effect.
To be able to pass secure boot mode over kexec, you have to make sure that the
kernel image doesn't get corrupted, lest someone blacklist your signing key in
the bootloader.
In particular, UEFI Secure Boot should *not* enable
"try-to-prevent-root-from-reading-kernel-memory", which means that, unless
you actually implement the split, you should drop a bunch of the patches.
Yes it should. If someone can read your kernel image, they can steal the
crypto keys you use to encrypt your filesystem.
"Restrict /dev/{mem,kmem,port} when the kernel is locked down": this should
probably split into one restriction for read and one for write.
Not so for /dev/port. Read & Write here are _not_ the same as Read & Write
on, say, /dev/mem. In fact, if /dev/mem gives you access to mmio ports, then
the same applies there. Btw, Fedora hasn't even provided /dev/kmem for a
while.
"bpf: Restrict kernel image access functions when the kernel is locked down":
This patch just sucks in general.
Yes - but that's what Alexei Starovoitov specified. bpf kind of sucks since
it gives you unrestricted access to the kernel.
"debugfs: Restrict debugfs when the kernel is locked down": The logic is IMO
nutty. Why the 0444 restriction? I see no reason that reading a 0644 file
should be treated any differently from reading a 0444 file.
Yes. IMO it should be locked down entirely. However, it's been abused and
there are things in there that are apparently needed (ie. it's not
debugging-only now); unfortunately, it *also* contains files that directly map
hardware.
"efi: Lock down the kernel if booted in secure boot mode": you have a stray
change in fs/debugfs/inode.c in here.
Good catch, thanks.
Also, as above, I really dislike this patch.
You dislike everything, but you didn't say so any of the times these patches
were posted...
"lockdown: Print current->comm in restriction messages": Shouldn't this be
folded in with whatever patch added that code in the first place?
Perhaps, but at the time I added it, I didn't want to go back and change the
existing patches again. If I have to do so, I'll fold it in then.
David
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
(+ Andy and Kees so they can respond to the thread)
On 31 March 2018 at 12:20, David Howells [off-list ref] wrote:
James Morris [off-list ref] wrote:
quoted
Are there any known coverage gaps now?
I've covered all the ones I know about.
Andy (and Kees) responded to this without keeping all the cc's. Given
that I share Andy's concern wrt the general nature of these patches, I
will reiterate them here.
First of all, in my experience, when introducing any kind of 'secure'
mode, people will immediately assume that everything they use the
system for will be more secure going forward, and so they are more
likely to let their guard down, resulting in a less secure situation
than we started out with. So I already argued for calling this a
'lockdown policy' which is a clearly communicated as a best effort
attempt to make the system more robust against inadvertent
modifications, and documenting/logging clearly what it actually
*means*. The latter is especially important because many of these
things are arch specific, and need to be implemented for each arch
individually in order to take effect on them. Also, v4.17 lockdown
will most likely be different from v4.18 lockdown.
Furthermore, there is a fundamental deviation from common security
sense here, where things like command line parameters and other
lockdown specific tunables are blacklisted rather than whitelisted,
and so rather than locking everything down and re-enabling only once
what needs to be re-enabled for the system to work, we are now forever
going to have to track a moving target, where it is someone's job to
ensure that incoming changes don't regress lockdown mode on any of the
architectures it supports.
If the distros are shipping their kernels with these patches applied
to adhere to some kind of requirements imposed by MicroSoft in order
for them to be willing to sign shim images, can we please involve
those into the discussion as well? It seems to me that this is a
solution without a problem statement, and I would like to fully
understand the problem before reasoning about the solution.
--
Ard.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Andy Lutomirski <luto@kernel.org> Date: 2018-04-03 15:11:30
[re-added cc's, I think. Sorry, I think I failed to use the gmane
gateway correctly there.]
On Tue, Apr 3, 2018 at 12:06 AM, David Howells [off-list ref] wrote:
Andy Lutomirski [off-list ref] wrote:
quoted
This is an attempt at a review. I'm replying here because I can't find the
actual relevant patch emails.
This was the latest post:
https://lkml.org/lkml/2017/11/9/660
and they were posted multiple times before that, plus distributions, such as
Fedora, have been carrying them for a long while.
quoted
For the rest of this review, I'm going to pretend that you actually want two
features: "try-prevent-root-from-corrupting-the-kernel" and
"try-to-prevent-root-from-reading-kernel-memory".
It theoretically boils down into those two, but the line is blurrier than you
think.
Further, some of the vectors that can be used to do one can potentially do the
other also and it starts getting to be a lot of extra work to distinguish the
two.
quoted
I do *not* see why the mere act of using Secure Boot should have this
effect.
To be able to pass secure boot mode over kexec, you have to make sure that the
kernel image doesn't get corrupted, lest someone blacklist your signing key in
the bootloader.
Can you explain that much more clearly? I'm asking why booting via
UEFI Secure Boot should enable lockdown, and I don't see what this has
to do with kexec. And "someone blacklist[ing] your key in the
bootloader" sounds like a political issue, not a technical issue.
What is the actual purpose of these patches?
quoted
In particular, UEFI Secure Boot should *not* enable
"try-to-prevent-root-from-reading-kernel-memory", which means that, unless
you actually implement the split, you should drop a bunch of the patches.
Yes it should. If someone can read your kernel image, they can steal the
crypto keys you use to encrypt your filesystem.
Can you please explain the actual attack that is avoided by doing this?
Suppose I'm a bad guy attacking someone's laptop. If I just have
normal uid!=0 access, then these patches have no effect. Instead,
we're talking about an attacker who is somehow able to become global
root and bypass all LSM restrictions but has not gained kernel code
execution. It is indeed the case that your patches make it harder to
simply read the dm-crypt encryption key out of main memory. But root
can attack the disk encryption in many other ways. They can
persistently compromise the machine by adding services or user
accounts or intentionally misconfiguring something. They can directly
read the entire contents of the disk. They can modify the initrd so
that the next time the machine reboots and the user types the
password, the attacker gets the key (unless the TPM is involved, but
getting *that* right on a standard distro is difficult or impossible).
And I'm not even sure why an attacker who manages to become root wants
your disk encryption key. That key is worth nothing unless the
attacker makes its attack persistent, but, if the attacker can install
a persistent user-level backdoor, then they can read the cleartext off
your disk just as easily as they can read the ciphertext.
quoted
"Restrict /dev/{mem,kmem,port} when the kernel is locked down": this should
probably split into one restriction for read and one for write.
Not so for /dev/port. Read & Write here are _not_ the same as Read & Write
on, say, /dev/mem. In fact, if /dev/mem gives you access to mmio ports, then
the same applies there. Btw, Fedora hasn't even provided /dev/kmem for a
while.
Then split /dev/mem and turn off /dev/port for all locked-down modes.
quoted
"bpf: Restrict kernel image access functions when the kernel is locked down":
This patch just sucks in general.
Yes - but that's what Alexei Starovoitov specified. bpf kind of sucks since
it gives you unrestricted access to the kernel.
bpf, in certain contexts, gives you unrestricted access to *reading*
kernel memory. bpf should, under no circumstances, let you write to
the kernel unless you're using fault injection or similar.
I'm surprised that Alexei acked this patch. If something like XDP or
bpfilter starts becoming widely used, this patch will require a lot of
reworking to avoid breaking standard distros.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 03, 2018 at 08:11:07AM -0700, Andy Lutomirski wrote:
quoted
quoted
"bpf: Restrict kernel image access functions when the kernel is locked down":
This patch just sucks in general.
Yes - but that's what Alexei Starovoitov specified. bpf kind of sucks since
it gives you unrestricted access to the kernel.
bpf, in certain contexts, gives you unrestricted access to *reading*
kernel memory. bpf should, under no circumstances, let you write to
the kernel unless you're using fault injection or similar.
I'm surprised that Alexei acked this patch. If something like XDP or
bpfilter starts becoming widely used, this patch will require a lot of
reworking to avoid breaking standard distros.
my understanding was that this lockdown set attemps to disallow _reads_
of kernel memory from anything, so first version of patch was adding
run-time checks for bpf_probe_read() which is no-go
and without this helper the bpf for tracing is losing a lot of its power,
so the easiest is to disable it all.
I think lockdown suppose to disable xdp, bpfilter, nflog, raw sockets + pcap too
otherwise even cap_net_admin can see traffic coming into host.
Similarly kprobe, perf_event, ftrace should be off as well?
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Andy Lutomirski <luto@kernel.org> Date: 2018-04-03 16:26:49
On Tue, Apr 3, 2018 at 8:41 AM, Alexei Starovoitov
[off-list ref] wrote:
On Tue, Apr 03, 2018 at 08:11:07AM -0700, Andy Lutomirski wrote:
quoted
quoted
quoted
"bpf: Restrict kernel image access functions when the kernel is locked down":
This patch just sucks in general.
Yes - but that's what Alexei Starovoitov specified. bpf kind of sucks since
it gives you unrestricted access to the kernel.
bpf, in certain contexts, gives you unrestricted access to *reading*
kernel memory. bpf should, under no circumstances, let you write to
the kernel unless you're using fault injection or similar.
I'm surprised that Alexei acked this patch. If something like XDP or
bpfilter starts becoming widely used, this patch will require a lot of
reworking to avoid breaking standard distros.
my understanding was that this lockdown set attemps to disallow _reads_
of kernel memory from anything, so first version of patch was adding
run-time checks for bpf_probe_read() which is no-go
and without this helper the bpf for tracing is losing a lot of its power,
so the easiest is to disable it all.
Fair enough.
I think lockdown suppose to disable xdp, bpfilter, nflog, raw sockets + pcap too
otherwise even cap_net_admin can see traffic coming into host.
Similarly kprobe, perf_event, ftrace should be off as well?
I'm reasonably sure that lockdown is not intended to be this far
reaching. cap_net_admin can see traffic coming into the host, and I
don't think lockdown is intended to change that.
David, I think this is exactly why you need to define what "lockdown"
means. As it stands, the best argument I've seen involves
"blacklisting", but that's a political thing and almost no one
involved has any ability to evaluate it. Right now there's a series
of patches that check for "lockdown" and seem to disable things that
make someone uncomfortable. That's not a good way to design a
security feature.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Matthew Garrett <hidden> Date: 2018-04-03 16:30:01
On Tue, Apr 3, 2018 at 8:11 AM Andy Lutomirski [off-list ref] wrote:
Can you explain that much more clearly? I'm asking why booting via
UEFI Secure Boot should enable lockdown, and I don't see what this has
to do with kexec. And "someone blacklist[ing] your key in the
bootloader" sounds like a political issue, not a technical issue.
A kernel that allows users arbitrary access to ring 0 is just an
overfeatured bootloader. Why would you want secure boot in that case?
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Andy Lutomirski <luto@kernel.org> Date: 2018-04-03 16:46:07
On Tue, Apr 3, 2018 at 9:29 AM, Matthew Garrett [off-list ref] wrote:
On Tue, Apr 3, 2018 at 8:11 AM Andy Lutomirski [off-list ref] wrote:
quoted
Can you explain that much more clearly? I'm asking why booting via
UEFI Secure Boot should enable lockdown, and I don't see what this has
to do with kexec. And "someone blacklist[ing] your key in the
bootloader" sounds like a political issue, not a technical issue.
A kernel that allows users arbitrary access to ring 0 is just an
overfeatured bootloader. Why would you want secure boot in that case?
To get a chain of trust. I can provision a system with some public
keys, stored in UEFI authenticated variables, such that the system
will only boot a signed image. That signed image, can, in turn, load
a signed (or hashed or otherwise verfified) kernel and a verified
initramfs. The initramfs can run a full system from a verified (using
dm-verity or similar) filesystem, for example. Now it's very hard to
persistently attack this system. Chromium OS does something very much
like this, except that it doesn't use UEFI as far as I know. So does
iOS, and so do some Android versions. None of this requires lockdown,
or even a separation between usermode and kernelmode, to work
correctly. One could even do this on an MMU-less system if one really
cared to. More usefully, someone probably has done this using a
unikernel.
If I had to guess at a motivation that makes this patchset work, it
would be that there is an uneasy truce between Microsoft and the
various vendors of signed Linux bootloaders. That truce could
conceivably require that the signed bootloaders not knowingly ship a
system that allows a non-physically-present user to chainload Windows.
If so, the patchset should say that loud and clear in its description
and the parts that block bpf should go away.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: David Howells <dhowells@redhat.com> Date: 2018-04-03 17:16:09
Andy Lutomirski [off-list ref] wrote:
quoted
A kernel that allows users arbitrary access to ring 0 is just an
overfeatured bootloader. Why would you want secure boot in that case?
To get a chain of trust.
You don't have a chain of trust that you can trust in that case.
David
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 9:45 AM, Andy Lutomirski [off-list ref] wrote:
On Tue, Apr 3, 2018 at 9:29 AM, Matthew Garrett [off-list ref] wrote:
quoted
On Tue, Apr 3, 2018 at 8:11 AM Andy Lutomirski [off-list ref] wrote:
quoted
Can you explain that much more clearly? I'm asking why booting via
UEFI Secure Boot should enable lockdown, and I don't see what this has
to do with kexec. And "someone blacklist[ing] your key in the
bootloader" sounds like a political issue, not a technical issue.
A kernel that allows users arbitrary access to ring 0 is just an
overfeatured bootloader. Why would you want secure boot in that case?
To get a chain of trust. I can provision a system with some public
keys, stored in UEFI authenticated variables, such that the system
will only boot a signed image. That signed image, can, in turn, load
a signed (or hashed or otherwise verfified) kernel and a verified
initramfs. The initramfs can run a full system from a verified (using
dm-verity or similar) filesystem, for example. Now it's very hard to
persistently attack this system. Chromium OS does something very much
like this, except that it doesn't use UEFI as far as I know. So does
iOS, and so do some Android versions.
Correct, Chrome OS does not use UEFI, and we still want this patch
series, as it plugs all the known "intentional" escalation paths from
uid-0 to ring-0. Happily, that means all the politics around the UEFI
and Secure Boot case can be ignored, because those issues are specific
to Secure Boot, not the lockdown series. (They are _related_, sure,
but lockdown isn't only about Secure Boot -- it's just that SB is one
of the widely deployed implementations of this kind of
trust-chain-booting-thing. Chrome OS and Android's Verified Boot do
similar things and have the same expectations about the uid-0/ring-0
separation.)
The goal for that bright line on Chrome OS and Android is to stop
attack persistence. We want to know that a reboot onto a new kernel
and OS image will actually result in getting the desired system state,
and that any attack on persistent system data (even for things running
with full root privileges) can't result in using kernel interfaces to
gain kernel control. This isn't expected to be _perfect_, since
nothing is. But it creates a place to work from. The idea that uid-0
is NOT ring-0 is still relatively new, so the existing designs in the
kernel aren't well suited to building that distinction. I view this
series as a solid first step to getting there, though.
-Kees
--
Kees Cook
Pixel Security
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Andy Lutomirski <luto@kernel.org> Date: 2018-04-03 19:01:24
On Tue, Apr 3, 2018 at 11:45 AM, Kees Cook [off-list ref] wrote:
On Tue, Apr 3, 2018 at 9:45 AM, Andy Lutomirski [off-list ref] wrote:
quoted
On Tue, Apr 3, 2018 at 9:29 AM, Matthew Garrett [off-list ref] wrote:
quoted
On Tue, Apr 3, 2018 at 8:11 AM Andy Lutomirski [off-list ref] wrote:
quoted
Can you explain that much more clearly? I'm asking why booting via
UEFI Secure Boot should enable lockdown, and I don't see what this has
to do with kexec. And "someone blacklist[ing] your key in the
bootloader" sounds like a political issue, not a technical issue.
A kernel that allows users arbitrary access to ring 0 is just an
overfeatured bootloader. Why would you want secure boot in that case?
To get a chain of trust. I can provision a system with some public
keys, stored in UEFI authenticated variables, such that the system
will only boot a signed image. That signed image, can, in turn, load
a signed (or hashed or otherwise verfified) kernel and a verified
initramfs. The initramfs can run a full system from a verified (using
dm-verity or similar) filesystem, for example. Now it's very hard to
persistently attack this system. Chromium OS does something very much
like this, except that it doesn't use UEFI as far as I know. So does
iOS, and so do some Android versions.
Correct, Chrome OS does not use UEFI, and we still want this patch
series, as it plugs all the known "intentional" escalation paths from
uid-0 to ring-0. Happily, that means all the politics around the UEFI
and Secure Boot case can be ignored, because those issues are specific
to Secure Boot, not the lockdown series. (They are _related_, sure,
but lockdown isn't only about Secure Boot -- it's just that SB is one
of the widely deployed implementations of this kind of
trust-chain-booting-thing. Chrome OS and Android's Verified Boot do
similar things and have the same expectations about the uid-0/ring-0
separation.)
The goal for that bright line on Chrome OS and Android is to stop
attack persistence. We want to know that a reboot onto a new kernel
and OS image will actually result in getting the desired system state,
and that any attack on persistent system data (even for things running
with full root privileges) can't result in using kernel interfaces to
gain kernel control. This isn't expected to be _perfect_, since
nothing is. But it creates a place to work from. The idea that uid-0
is NOT ring-0 is still relatively new, so the existing designs in the
kernel aren't well suited to building that distinction. I view this
series as a solid first step to getting there, though.
But wouldn't Chrome OS possibly want to lock down kernel memory write
vectors but not read vectors? After all, debugging is useful even on
Chrome OS.
--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Andy Lutomirski <luto@kernel.org> Date: 2018-04-03 19:01:32
On Apr 3, 2018, at 10:16 AM, David Howells [off-list ref] wrote:
Andy Lutomirski [off-list ref] wrote:
quoted
quoted
A kernel that allows users arbitrary access to ring 0 is just an
overfeatured bootloader. Why would you want secure boot in that case?
To get a chain of trust.
You don't have a chain of trust that you can trust in that case.
Please elaborate on why I can?t trust it. Please also elaborate on how
lockdown helps at all.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 12:01 PM, Andy Lutomirski [off-list ref] wrote:
On Tue, Apr 3, 2018 at 11:45 AM, Kees Cook [off-list ref] wrote:
quoted
On Tue, Apr 3, 2018 at 9:45 AM, Andy Lutomirski [off-list ref] wrote:
quoted
On Tue, Apr 3, 2018 at 9:29 AM, Matthew Garrett [off-list ref] wrote:
quoted
On Tue, Apr 3, 2018 at 8:11 AM Andy Lutomirski [off-list ref] wrote:
quoted
Can you explain that much more clearly? I'm asking why booting via
UEFI Secure Boot should enable lockdown, and I don't see what this has
to do with kexec. And "someone blacklist[ing] your key in the
bootloader" sounds like a political issue, not a technical issue.
A kernel that allows users arbitrary access to ring 0 is just an
overfeatured bootloader. Why would you want secure boot in that case?
To get a chain of trust. I can provision a system with some public
keys, stored in UEFI authenticated variables, such that the system
will only boot a signed image. That signed image, can, in turn, load
a signed (or hashed or otherwise verfified) kernel and a verified
initramfs. The initramfs can run a full system from a verified (using
dm-verity or similar) filesystem, for example. Now it's very hard to
persistently attack this system. Chromium OS does something very much
like this, except that it doesn't use UEFI as far as I know. So does
iOS, and so do some Android versions.
Correct, Chrome OS does not use UEFI, and we still want this patch
series, as it plugs all the known "intentional" escalation paths from
uid-0 to ring-0. Happily, that means all the politics around the UEFI
and Secure Boot case can be ignored, because those issues are specific
to Secure Boot, not the lockdown series. (They are _related_, sure,
but lockdown isn't only about Secure Boot -- it's just that SB is one
of the widely deployed implementations of this kind of
trust-chain-booting-thing. Chrome OS and Android's Verified Boot do
similar things and have the same expectations about the uid-0/ring-0
separation.)
The goal for that bright line on Chrome OS and Android is to stop
attack persistence. We want to know that a reboot onto a new kernel
and OS image will actually result in getting the desired system state,
and that any attack on persistent system data (even for things running
with full root privileges) can't result in using kernel interfaces to
gain kernel control. This isn't expected to be _perfect_, since
nothing is. But it creates a place to work from. The idea that uid-0
is NOT ring-0 is still relatively new, so the existing designs in the
kernel aren't well suited to building that distinction. I view this
series as a solid first step to getting there, though.
But wouldn't Chrome OS possibly want to lock down kernel memory write
vectors but not read vectors? After all, debugging is useful even on
Chrome OS.
Chrome OS absolutely wants to block writing. We also want to block
reading as much as we possibly can, though yes we bump up against
debugging in that quest. But those cases are manageable and specific,
IMO.
-Kees
--
Kees Cook
Pixel Security
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Matthew Garrett <hidden> Date: 2018-04-03 19:30:02
On Tue, Apr 3, 2018 at 9:46 AM Andy Lutomirski [off-list ref] wrote:
On Tue, Apr 3, 2018 at 9:29 AM, Matthew Garrett [off-list ref] wrote:
quoted
A kernel that allows users arbitrary access to ring 0 is just an
overfeatured bootloader. Why would you want secure boot in that case?
To get a chain of trust. I can provision a system with some public
keys, stored in UEFI authenticated variables, such that the system
will only boot a signed image. That signed image, can, in turn, load
a signed (or hashed or otherwise verfified) kernel and a verified
initramfs. The initramfs can run a full system from a verified (using
dm-verity or similar) filesystem, for example. Now it's very hard to
persistently attack this system. Chromium OS does something very much
like this, except that it doesn't use UEFI as far as I know. So does
iOS, and so do some Android versions. None of this requires lockdown,
or even a separation between usermode and kernelmode, to work
correctly. One could even do this on an MMU-less system if one really
cared to. More usefully, someone probably has done this using a
unikernel.
That's only viable if you're the only person with the ability to sign stuff
for your machine - the moment there are generic distributions that your
machine trusts, an attacker can use one as a bootloader to compromise your
trust chain. Since most UEFI secure boot systems have to trust generic
distributions (if you don't trust the third party signing key then your GPU
won't post), the ecosystem depends on it not being possible for people to
use generic distributions as bootloaders.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: David Howells <dhowells@redhat.com> Date: 2018-04-03 19:49:14
Andy Lutomirski [off-list ref] wrote:
quoted
quoted
quoted
A kernel that allows users arbitrary access to ring 0 is just an
overfeatured bootloader. Why would you want secure boot in that case?
To get a chain of trust.
You don't have a chain of trust that you can trust in that case.
Please elaborate on why I can?t trust it.
If the user can arbitrarily modify the running kernel image, you cannot trust
anything. You cannot determine the trustworthiness of something because your
basis for determining that trust can be compromised.
Please also elaborate on how lockdown helps at all.
Stopping the kernel from being arbitrarily modified allows you to preserve
your trust.
Stopping the kernel from being arbitrarily read stops any encryption keys it
may be using from being retrieved.
And, if you can't guarantee the trustworthiness of your own image, you can't
pass the trust onto the next image that you kexec.
Now, I can't guarantee that my patches close every hole, they just close all
the holes I know about - including some obscure ones like using DMA-capable
ISA devices to hack/access the kernel image.
David
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 9:29 AM, Matthew Garrett [off-list ref] wrote:
On Tue, Apr 3, 2018 at 8:11 AM Andy Lutomirski [off-list ref] wrote:
quoted
Can you explain that much more clearly? I'm asking why booting via
UEFI Secure Boot should enable lockdown, and I don't see what this has
to do with kexec. And "someone blacklist[ing] your key in the
bootloader" sounds like a political issue, not a technical issue.
A kernel that allows users arbitrary access to ring 0 is just an
overfeatured bootloader. Why would you want secure boot in that case?
.. maybe you don't *want* secure boot, but it's been pushed in your
face by people with an agenda?
Seriously.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Matthew Garrett <hidden> Date: 2018-04-03 20:55:08
On Tue, Apr 3, 2018 at 1:53 PM Linus Torvalds
[off-list ref]
wrote:
On Tue, Apr 3, 2018 at 9:29 AM, Matthew Garrett [off-list ref] wrote:
quoted
On Tue, Apr 3, 2018 at 8:11 AM Andy Lutomirski [off-list ref] wrote:
quoted
Can you explain that much more clearly? I'm asking why booting via
UEFI Secure Boot should enable lockdown, and I don't see what this has
to do with kexec. And "someone blacklist[ing] your key in the
bootloader" sounds like a political issue, not a technical issue.
A kernel that allows users arbitrary access to ring 0 is just an
overfeatured bootloader. Why would you want secure boot in that case?
.. maybe you don't *want* secure boot, but it's been pushed in your
face by people with an agenda?
Then turn it off, or build a self-signed kernel that doesn't do this?
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 1:54 PM, Matthew Garrett [off-list ref] wrote:
quoted
.. maybe you don't *want* secure boot, but it's been pushed in your
face by people with an agenda?
Then turn it off, or build a self-signed kernel that doesn't do this?
Umm. So you asked a question, and then when you got an answer you said
"don't do that then".
The fact is, some hardware pushes secure boot pretty hard. That has
*nothing* to do with some "lockdown" mode.
Why do you conflate the two? That was the original question. You
replied with another question. People answered yours.
NOW ANSWER THE ORIGINAL QUESTION, DAMMIT.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Matthew Garrett <hidden> Date: 2018-04-03 21:09:08
On Tue, Apr 3, 2018 at 2:01 PM Linus Torvalds
[off-list ref]
wrote:
On Tue, Apr 3, 2018 at 1:54 PM, Matthew Garrett [off-list ref] wrote:
quoted
quoted
.. maybe you don't *want* secure boot, but it's been pushed in your
face by people with an agenda?
Then turn it off, or build a self-signed kernel that doesn't do this?
Umm. So you asked a question, and then when you got an answer you said
"don't do that then".
The fact is, some hardware pushes secure boot pretty hard. That has
*nothing* to do with some "lockdown" mode.
Secure Boot ensures that the firmware will only load signed bootloaders. If
a signed bootloader loads a kernel that's effectively an unsigned
bootloader, there's no point in using Secure Boot - you should just turn it
off instead, because it's not giving you any meaningful security. Andy's
example gives a scenario where by constraining your *userland* sufficiently
you can get close to having the same guarantees, but that involves you
having a read-only filesystem and takes you even further away from having a
general purpose computer.
If you don't want Secure Boot, turn it off. If you want Secure Boot, use a
kernel that behaves in a way that actually increases your security.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Al Viro <viro@ZenIV.linux.org.uk> Date: 2018-04-03 21:21:31
On Tue, Apr 03, 2018 at 09:08:54PM +0000, Matthew Garrett wrote:
quoted
The fact is, some hardware pushes secure boot pretty hard. That has
*nothing* to do with some "lockdown" mode.
Secure Boot ensures that the firmware will only load signed bootloaders. If
a signed bootloader loads a kernel that's effectively an unsigned
bootloader, there's no point in using Secure Boot - you should just turn it
off instead, because it's not giving you any meaningful security. Andy's
example gives a scenario where by constraining your *userland* sufficiently
you can get close to having the same guarantees, but that involves you
having a read-only filesystem and takes you even further away from having a
general purpose computer.
If you don't want Secure Boot, turn it off. If you want Secure Boot, use a
kernel that behaves in a way that actually increases your security.
That assumes you *can* turn that shit off. On the hardware where manufacturer
has installed firmware that doesn't allow that SB is a misfeature that has
to be worked around. Making that harder might improve the value of SB to
said manufacturers, but what's the benefit for everybody else?
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 2:08 PM, Matthew Garrett [off-list ref] wrote:
Secure Boot ensures that the firmware will only load signed bootloaders. If
a signed bootloader loads a kernel that's effectively an unsigned
bootloader, there's no point in using Secure Boot
Bullshit.
I may want to know that I'm running *my* kernel, but once that is the
case, I trust it.
In fact, I tend to trust it more than some random vendor key. You should too.
Your whole argument is FUNDAMENTALLY garbage. It's the Disney kind of
garbage. It was garbage back then, and it's garbage now.
It is also garbage for a simple technical reason: secure boot can be
hard to turn off. Sometimes "turn off" means "you just have to add
your own keys".
Yes, on x86 hardware at least at some point MS actually had the rule
that it has to be something you can turn off. That rule is apparently
not true on ARM, though.
Seriously. You sound like you're parroting some party line, not like
you are answering the actual question.
So again: why do you conflate the two issues?
If you want lockdown, fine, enable it. But what the F*CK does that
have to do with whether you had secure boot or not?
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Matthew Garrett <hidden> Date: 2018-04-03 21:33:04
On Tue, Apr 3, 2018 at 2:26 PM Linus Torvalds
[off-list ref]
wrote:
On Tue, Apr 3, 2018 at 2:08 PM, Matthew Garrett [off-list ref] wrote:
quoted
Secure Boot ensures that the firmware will only load signed
bootloaders. If
quoted
a signed bootloader loads a kernel that's effectively an unsigned
bootloader, there's no point in using Secure Boot
Bullshit.
I may want to know that I'm running *my* kernel, but once that is the
case, I trust it.
If you don't believe that your self-signed kernel is going to be a threat
against your security model then great! Don't turn this on when you build
it. But if you built a kernel that didn't have this lockdown functionality
and got it signed with, say, Red Hat's signing keys, anyone could take Red
Hat's bootloader chain and that kernel and subvert the Secure Boot chain on
any machine that trusts the third party signing key (ie, basically all of
them)
Yes, on x86 hardware at least at some point MS actually had the rule
that it has to be something you can turn off. That rule is apparently
not true on ARM, though.
Correct - there's no requirement that it be something you can disable on
ARM, but since Microsoft won't sign any third-party code for ARM anyway it
makes no difference to this discussion.
If you want lockdown, fine, enable it. But what the F*CK does that
have to do with whether you had secure boot or not?
Because a kernel signed with a generally trusted key that doesn't implement
any lockdown functionality is effectively a bootloader that will load
unsigned material on most machines on the market, which reduces the
security of users running those machines with Secure Boot enabled.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Matthew Garrett <hidden> Date: 2018-04-03 21:37:41
On Tue, Apr 3, 2018 at 2:21 PM Al Viro [off-list ref] wrote:
On Tue, Apr 03, 2018 at 09:08:54PM +0000, Matthew Garrett wrote:
quoted
If you don't want Secure Boot, turn it off. If you want Secure Boot,
use a
quoted
kernel that behaves in a way that actually increases your security.
That assumes you *can* turn that shit off. On the hardware where
manufacturer
has installed firmware that doesn't allow that SB is a misfeature that has
to be worked around. Making that harder might improve the value of SB to
said manufacturers, but what's the benefit for everybody else?
This is why Shim has support for its own key database, as well as allowing
you to disable further signature validation. If the hardware supports third
party code at all, you can just use Shim to sidestep any unreasonable
restrictions the vendor has imposed.
(This doesn't help with systems that don't support third party code at all,
but this patchset does nothing to make that worse - that hardware wouldn't
boot your own kernel before this patchset, and it won't afterwards either)
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: James Morris <jmorris@namei.org> Date: 2018-04-03 21:49:08
On Tue, 3 Apr 2018, Ard Biesheuvel wrote:
[snip]
Thanks for the input -- there are obviously still issues to be resolved.
I'll now not be pushing these to Linus for v4.17.
--
James Morris
[off-list ref]
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Andy Lutomirski <luto@kernel.org> Date: 2018-04-03 21:51:47
On Tue, Apr 3, 2018 at 12:29 PM, Matthew Garrett [off-list ref] wrote:
On Tue, Apr 3, 2018 at 9:46 AM Andy Lutomirski [off-list ref] wrote:
quoted
On Tue, Apr 3, 2018 at 9:29 AM, Matthew Garrett [off-list ref] wrote:
quoted
A kernel that allows users arbitrary access to ring 0 is just an
overfeatured bootloader. Why would you want secure boot in that case?
quoted
To get a chain of trust. I can provision a system with some public
keys, stored in UEFI authenticated variables, such that the system
will only boot a signed image. That signed image, can, in turn, load
a signed (or hashed or otherwise verfified) kernel and a verified
initramfs. The initramfs can run a full system from a verified (using
dm-verity or similar) filesystem, for example. Now it's very hard to
persistently attack this system. Chromium OS does something very much
like this, except that it doesn't use UEFI as far as I know. So does
iOS, and so do some Android versions. None of this requires lockdown,
or even a separation between usermode and kernelmode, to work
correctly. One could even do this on an MMU-less system if one really
cared to. More usefully, someone probably has done this using a
unikernel.
That's only viable if you're the only person with the ability to sign stuff
for your machine - the moment there are generic distributions that your
machine trusts, an attacker can use one as a bootloader to compromise your
trust chain.
If you removed "as a bootloader", then I agree with that sentence.
Can someone please explain why the UEFI crowd cares so much about "as
a bootloader"? Once I'm able to install an OS (Linux kernel +
bootloader, Windows embedded doodad, OpenBSD, whatever) on your
machine, I can use your peripherals, read your data, write your data,
see your keystrokes, use your network connection, re-flash your BIOS
(at least as well as any OS can), run VMs, and generally own your
system. Somehow you all seem fine with all of this, except that the
fact that I can chainload something else gives UEFI people the
willies.
Can someone explain why?
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Andy Lutomirski <luto@kernel.org> Date: 2018-04-03 21:58:24
On Tue, Apr 3, 2018 at 12:49 PM, David Howells [off-list ref] wrote:
Andy Lutomirski [off-list ref] wrote:
quoted
quoted
quoted
quoted
A kernel that allows users arbitrary access to ring 0 is just an
overfeatured bootloader. Why would you want secure boot in that case?
To get a chain of trust.
You don't have a chain of trust that you can trust in that case.
Please elaborate on why I can?t trust it.
If the user can arbitrarily modify the running kernel image, you cannot trust
anything. You cannot determine the trustworthiness of something because your
basis for determining that trust can be compromised.
I'm having a very, very hard time coming up with a scenario where I
can "trust" something if an attacker can get root but can't modify the
running kernel image but I can't "trust" something if the attacker
can't. About the only think I can come up with is that root generally
has a hard time directly reading kernel keyring data.
But if we really think that kernel keyring data is so sacred, let's
please solve it properly using SGX or some hypervisor doodad like
Microsoft's Credential Guard. Protecting the keyring with lockdown is
a whole lot of annoyance without all that much gain.
quoted
Please also elaborate on how lockdown helps at all.
Stopping the kernel from being arbitrarily modified allows you to preserve
your trust.
If I build a voting machine, an ATM, or a server that runs Panera
Bread's website, I can certainly issue a press release that says "hey,
the bad guy just downloaded tens of millions of customer records, but
they didn't actually get to run CPL0 code, so all is well."
</sarcasm>
Stopping the kernel from being arbitrarily read stops any encryption keys it
may be using from being retrieved.
If I build a server that runs Panera Bread 2.0's website, and the
attacker exploits my machine to steal tens of millions of customer
records by getting the machine to talk to some database server using
keys that are securely stored in the kernel keyring, I would feel
sooooooo much better knowing that the attacker didn't also manage to
extract the key that lets the machine talk to the database server.
Never mind that the attacker already stole the entire contents of the
database.
</sarcasm>
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: David Howells <dhowells@redhat.com> Date: 2018-04-03 22:32:57
Andy Lutomirski [off-list ref] wrote:
quoted
If the user can arbitrarily modify the running kernel image, you cannot
trust anything. You cannot determine the trustworthiness of something
because your basis for determining that trust can be compromised.
I'm having a very, very hard time coming up with a scenario where I
can "trust" something if an attacker can get root but can't modify the
running kernel image but I can't "trust" something if the attacker
can't.
Eh? If the attacker can't what? Did you mean to put "can" at the end of that
rather than "can't"? I don't see why the kernel-level trust would be
compromised if an attacker can't get root and can't modify the running kernel
image.
Here's a simple scenario: You boot your machine. You have module verification
keys in your kernel. You have /dev/mem available for root to read/write. A
program running as root can modify the keys in your kernel or just disable the
checking code entirely. It can now insmod any module it likes. You may as
well not bother with signed modules. In fact, it can modify the running
kernel image in any way it likes, without even having to load modules.
There's no point bothering with UID/GID checking either.
quoted
Stopping the kernel from being arbitrarily read stops any encryption keys it
may be using from being retrieved.
If I build a server that runs Panera Bread 2.0's website, and the
attacker exploits my machine to steal tens of millions of customer
records by getting the machine to talk to some database server using
keys that are securely stored in the kernel keyring, ...
I was thinking more in terms of preventing access to the encrypted data on
your own disk. The key for that could be unlocked using a TPM, but the
session key then has to be retained in RAM for performance reasons unless you
can transfer the session key to, say, your SATA controller without it going
through the CPU.
However, if /dev/mem can be read, any root process can extract the session key
for your disk.
But, as you suggest, they could also protect secrets used in communications.
However, the communications themselves have to be exposed to userspace for
userspace to be able to use them. That is unavoidable. The kernel keyring,
for example, tries to restrict who can even see a key, much less use it as
much as possible - but ptrace() exists... You are no less vulnerable if the
key is held in a userspace process; then the attacker can get the key and the
data.
If the kernel is locked down, the aim is to try and make sure that keys
stashed in the kernel cannot be read, though they have to be able to be used,
or there's no point to them.
David
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Andy Lutomirski <luto@kernel.org> Date: 2018-04-03 22:39:37
On Tue, Apr 3, 2018 at 3:32 PM, David Howells [off-list ref] wrote:
Andy Lutomirski [off-list ref] wrote:
quoted
quoted
If the user can arbitrarily modify the running kernel image, you cannot
trust anything. You cannot determine the trustworthiness of something
because your basis for determining that trust can be compromised.
I'm having a very, very hard time coming up with a scenario where I
can "trust" something if an attacker can get root but can't modify the
running kernel image but I can't "trust" something if the attacker
can't.
Eh? If the attacker can't what? Did you mean to put "can" at the end of that
rather than "can't"? I don't see why the kernel-level trust would be
compromised if an attacker can't get root and can't modify the running kernel
image.
Whoops, yes.
Here's a simple scenario: You boot your machine. You have module verification
keys in your kernel. You have /dev/mem available for root to read/write. A
program running as root can modify the keys in your kernel or just disable the
checking code entirely. It can now insmod any module it likes. You may as
well not bother with signed modules. In fact, it can modify the running
kernel image in any way it likes, without even having to load modules.
I don't particularly disagree with any of this, but you seem to be
saying "if you've bought into the party line wrt signed modules, you
had better enable lockdown, too". I *don't* buy into the party line
about why signed modules should be needed for Secure Boot.
There's no point bothering with UID/GID checking either.
Give me a break. There's a *huge* difference between a system where
only root can load unsigned modules and a system where anyone can load
unsigned modules.
quoted
quoted
Stopping the kernel from being arbitrarily read stops any encryption keys it
may be using from being retrieved.
If I build a server that runs Panera Bread 2.0's website, and the
attacker exploits my machine to steal tens of millions of customer
records by getting the machine to talk to some database server using
keys that are securely stored in the kernel keyring, ...
I was thinking more in terms of preventing access to the encrypted data on
your own disk. The key for that could be unlocked using a TPM, but the
session key then has to be retained in RAM for performance reasons unless you
can transfer the session key to, say, your SATA controller without it going
through the CPU.
However, if /dev/mem can be read, any root process can extract the session key
for your disk.
Any root process can read /dev/mapper/plaintext_disk, lockdown or otherwise.
But, as you suggest, they could also protect secrets used in communications.
However, the communications themselves have to be exposed to userspace for
userspace to be able to use them. That is unavoidable. The kernel keyring,
for example, tries to restrict who can even see a key, much less use it as
much as possible - but ptrace() exists... You are no less vulnerable if the
key is held in a userspace process; then the attacker can get the key and the
data.
If the kernel is locked down, the aim is to try and make sure that keys
stashed in the kernel cannot be read, though they have to be able to be used,
or there's no point to them.
Sure. I have no problem with having an upstream kernel have a
lockdown feature, although I think that feature should distinguish
between reads and writes. But I don't think the upstream kernel
should apply a patch that ties any of this to Secure Boot without a
genuine technical reason why it makes sense.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 3:39 PM, Andy Lutomirski [off-list ref] wrote:
Sure. I have no problem with having an upstream kernel have a
lockdown feature, although I think that feature should distinguish
between reads and writes. But I don't think the upstream kernel
should apply a patch that ties any of this to Secure Boot without a
genuine technical reason why it makes sense.
So this is where I violently agree with Andy.
For example, I love signed kernel modules. The fact that I love them
has absolutely zero to do with secure boot, though. There is
absolutely no linkage between the two issues: I use (self-)signed
kernel modules simply because I think it's a good thing in general.
The same thing is true of some lockdown patch. Maybe it's a good thing
in general. But whether it's a good thing is _entirely_ independent of
any secure boot issue. I can see using secure boot without it, but I
can very much also see using lockdown without secure boot.
The two things are simply entirely orthogonal. They have _zero_
overlap. I'm not seeing why they'd be linked at all in any way.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Matthew Garrett <hidden> Date: 2018-04-03 22:51:26
On Tue, Apr 3, 2018 at 3:46 PM Linus Torvalds
[off-list ref]
wrote:
For example, I love signed kernel modules. The fact that I love them
has absolutely zero to do with secure boot, though. There is
absolutely no linkage between the two issues: I use (self-)signed
kernel modules simply because I think it's a good thing in general.
The same thing is true of some lockdown patch. Maybe it's a good thing
in general. But whether it's a good thing is _entirely_ independent of
any secure boot issue. I can see using secure boot without it, but I
can very much also see using lockdown without secure boot.
The two things are simply entirely orthogonal. They have _zero_
overlap. I'm not seeing why they'd be linked at all in any way.
Lockdown is clearly useful without Secure Boot (and I intend to deploy it
that way for various things), but I still don't understand why you feel
that the common case of booting a kernel from a boot chain that's widely
trusted derives no benefit from it being harder to subvert that kernel into
subverting that boot chain. For cases where you're self-signing and feel
happy about that, you just set CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT to n and
everyone's happy?
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Andy Lutomirski <luto@kernel.org> Date: 2018-04-03 22:53:29
On Tue, Apr 3, 2018 at 3:51 PM, Matthew Garrett [off-list ref] wrote:
On Tue, Apr 3, 2018 at 3:46 PM Linus Torvalds
[off-list ref]
wrote:
quoted
For example, I love signed kernel modules. The fact that I love them
has absolutely zero to do with secure boot, though. There is
absolutely no linkage between the two issues: I use (self-)signed
kernel modules simply because I think it's a good thing in general.
quoted
The same thing is true of some lockdown patch. Maybe it's a good thing
in general. But whether it's a good thing is _entirely_ independent of
any secure boot issue. I can see using secure boot without it, but I
can very much also see using lockdown without secure boot.
quoted
The two things are simply entirely orthogonal. They have _zero_
overlap. I'm not seeing why they'd be linked at all in any way.
Lockdown is clearly useful without Secure Boot (and I intend to deploy it
that way for various things), but I still don't understand why you feel
that the common case of booting a kernel from a boot chain that's widely
trusted derives no benefit from it being harder to subvert that kernel into
subverting that boot chain. For cases where you're self-signing and feel
happy about that, you just set CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT to n and
everyone's happy?
I would like to see distros that want Secure Boot to annoy users by
enabling Lockdown be honest about the fact that it's an annoyance and
adds very little value by having to carry a patch that was rejected by
the upstream kernel.
-Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 3:51 PM, Matthew Garrett [off-list ref] wrote:
Lockdown is clearly useful without Secure Boot (and I intend to deploy it
that way for various things), but I still don't understand why you feel
that the common case of booting a kernel from a boot chain that's widely
trusted derives no benefit from it being harder to subvert that kernel into
subverting that boot chain.
It has NOTHING TO DO WITH "HARDER TO SUBVERT".
THE TWO FEATURES HAVE NOTHING TO DO WITH EACH OTHER WHAT-SO-EVER.
I do not want my kernel to act differently depending on some really
esoteric detail in how it was booted. That is fundamentally wrong.
Is that really so hard to understand?
Look at it this way: maybe lockdown breaks some application because
that app does something odd. I get a report of that happening, and it
so happens that the reporter is running the same distro I am, so I try
it with his exact kernel configuration, and it works for me.
It is *entirely* non-obvious that the reporter happened to run a
distro kernel that had secure boot enabled, and I obviously do not.
See what the problem is? Tying these things magically together IS A BAD IDEA.
And when people ask you why you did it, YOU HAVE YET TO COME UP WITH A
SINGLE ACTUAL RESPONSE.
Instead, you just ask people why they care, or tell people to not enable it.
Seriously, Matthew, it's WRONG to tie things together in magic ways
when they have nothing what-so-ever to do with each other.
So no. The answer is simply "don't tie the two things together".
And dammit, if you tie them together, you had damn well have a good
reason. So far, your reasons have _literally_ been "Why not?" and
tried to make the onus be on others to explain to you why not.
That's not the right approach to begin with, Matthew. The onus is on
*you* to explain why you tied them together, not on others to explain
to you - over and over - that they have nothing to do with each other.
This discussion is over until you give an actual honest-to-goodness
reason for why you tied the two features together. No more "Why not?"
crap.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Matthew Garrett <hidden> Date: 2018-04-03 23:09:41
On Tue, Apr 3, 2018 at 3:53 PM Andy Lutomirski [off-list ref] wrote:
On Tue, Apr 3, 2018 at 3:51 PM, Matthew Garrett [off-list ref] wrote:
quoted
Lockdown is clearly useful without Secure Boot (and I intend to deploy
it
quoted
that way for various things), but I still don't understand why you feel
that the common case of booting a kernel from a boot chain that's widely
trusted derives no benefit from it being harder to subvert that kernel
into
quoted
subverting that boot chain. For cases where you're self-signing and feel
happy about that, you just set CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT to n
and
quoted
everyone's happy?
I would like to see distros that want Secure Boot to annoy users by
enabling Lockdown be honest about the fact that it's an annoyance and
adds very little value by having to carry a patch that was rejected by
the upstream kernel.
I disagree with the assertion that it adds very little value, but if you
want to reject a technically useful patch for political reasons then I'm
well beyond the point of caring.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 4:08 PM, Linus Torvalds
[off-list ref] wrote:
This discussion is over until you give an actual honest-to-goodness
reason for why you tied the two features together. No more "Why not?"
crap.
Side note: I suspect the reason is something along the lines of "there
are political reasons".
But dammit, if that's the case, those should be documented and
explained, not answered with "why not" when people ask why something
is the case.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: David Howells <dhowells@redhat.com> Date: 2018-04-03 23:13:04
Andy Lutomirski [off-list ref] wrote:
I'm having a very, very hard time coming up with a scenario where I
can "trust" something if an attacker can get root but can't modify the
running kernel image but I can't "trust" something if the attacker
can [modify the running kernel image].
(I think the above is what you meant)
Let's go at this a different way. How do you decide you can trust something
in this context? You compare it to something. Signing it, keeping a hash
whitelist, IMA - these are all ways of comparing something. Do you agree with
that?
However, the comparison can be subverted if the running kernel image (I might
be better saying running kernel state here since I'm not talking about the
source bzImage file) can be modified arbitrarily by userspace, either by
modifying the data against which the comparison is made - e.g. the public key
set or the hash list - or by modifying the code that makes the comparison.
/dev/mem, direct access to DMA, bpf, etc. all provide ways of modifying the
kernel image arbitrarily, which leads me to this:
I *don't* buy into the party line about why signed modules should be needed
for Secure Boot.
Modules are just another way of modifying the kernel image. If I can just
create an arbitrary module and load it, then I can modify the kernel image
from within the module.
Locking down modules by signing, hashing or IMA practically prevents the
loading of arbitrarily constructed modules and only permits modules from a set
that the provider of the modules somewhat trusts.
What use is secure boot if processes run as root can subvert your kernel?
quoted
There's no point bothering with UID/GID checking either.
Give me a break. There's a *huge* difference between a system where
only root can load unsigned modules and a system where anyone can load
unsigned modules.
I don't think we've ever advocated letting just anyone load a module.
But my point is that if you can modify the running kernel, you can nullify all
security checks, including UID/GID checks.
quoted
However, if /dev/mem can be read, any root process can extract the session
key for your disk.
Any root process can read /dev/mapper/plaintext_disk, lockdown or otherwise.
True - for now - and they can also access the mounted filesystem. But if they
get their hands on your powered-off computer, no, they can't.
But I don't think the upstream kernel should apply a patch that ties any of
this to Secure Boot without a genuine technical reason why it makes sense.
Because unless you turn lockdown on during kernel boot, there exists a window
of opportunity where the kernel isn't locked down and can be accessed, thereby
obviating the fact that you started in Secure Boot mode.
David
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Matthew Garrett <hidden> Date: 2018-04-03 23:17:42
On Tue, Apr 3, 2018 at 4:08 PM Linus Torvalds
[off-list ref]
wrote:
That's not the right approach to begin with, Matthew. The onus is on
*you* to explain why you tied them together, not on others to explain
to you - over and over - that they have nothing to do with each other.
1) Secure Boot is intended to permit the construction of a boot chain that
only runs ring 0 code that the user considers trustworthy
2) Allowing arbitrary user code to run in ring 0 without affirmative
consent on the part of the user is therefore incompatible with the goals of
Secure Boot
3) This patchset provides a mechanism to alter the behaviour of the kernel
such that it is significantly more difficult for arbitrary user code to run
in ring 0 without affirmative user consent
4) Providing a mechanism for automatically enabling this behaviour when
running in a context that is intended to restrict access to ring 0 is a
rational thing to do, because otherwise it is difficult to achieve the
objective in (1)
Alternative approaches to achieve (1) rely on severely constraining
userland - ChromeOS, for instance, doesn't impose these restrictions at
present but also doesn't allow users to run arbitrary applications (you're
stuck inside either the Chrome or Android sandbox). So, if the goal is to
achieve (1) when the platform is in this state, what's a more reasonable
alternative?
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 4:17 PM, Matthew Garrett [off-list ref] wrote:
1) Secure Boot is intended to permit the construction of a boot chain that
only runs ring 0 code that the user considers trustworthy
No.
That may be *one* intention, for some people.
It's not an a-priori one for the actual user.
2) Allowing arbitrary user code to run in ring 0 without affirmative
consent on the part of the user is therefore incompatible with the goals of
Secure Boot
Again, that has absolutely zero relevance.
Those goals are not the *users* goals.
Be honest now. It wasn't generally users who clamored for it.
If the user actually wanted it, and is asking for it, he can enable
it. Independently of secure boot, which the user generally has little
control over.
3) This patchset provides a mechanism to alter the behaviour of the kernel
such that it is significantly more difficult for arbitrary user code to run
in ring 0 without affirmative user consent
That difficulty already exists, the new thing isn't somehow related to
that at all.
Look at our "uyou can only load modules if you're root" rules. Or the
"you can only load modules if they are signed".
See a pattern there? They don't magically enable themselves (or
disable themselves) depending on whether you booted with secure boot
or not.
Yet they are a HELL OF A LOT MORE IMPORTANT than this new patch series.
4) Providing a mechanism for automatically enabling this behaviour when
running in a context that is intended to restrict access to ring 0 is a
rational thing to do, because otherwise it is difficult to achieve the
objective in (1)
No. See why it's *NOT* rational, as explained already several times.
Magically changing kernel behavior depending on some subtle and often
unintentional bootup behavior detail is completely idiotic.
It would be idiotic if it was that "check kernel module signatures"
check. This is no less idiotic.
Seriously, listen to your own arguments. If they don't make sense for
checking kernel module signatures, why the hell would they make sense
for something like lockdown.
THE TWO THINGS ARE ENTIRELY INDEPENDENT.
I'm done with you. You're not listening, and you're repeating bogus
arguments that make no sense.
No way in hell will I merge anything like this.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 4:12 PM, David Howells [off-list ref] wrote:
What use is secure boot if processes run as root can subvert your kernel?
Stop this idiocy.
The above has now been answered multiple times, several different ways.
The "point" of secure boot may be that you had no choice, or there was
no point at all, it just came that way.
Or the "point" of secure boot may be that you don't trust anybody else
than yourself, but once you've booted you do trust what you booted.
But the *real* point is that this has nothing what-so-ever to do with
secure boot. You may want (or not want) lockdown independently of it.
Don't tie magic boot issues with kernel runtime behavior.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: David Howells <dhowells@redhat.com> Date: 2018-04-03 23:39:13
Linus Torvalds [off-list ref] wrote:
The same thing is true of some lockdown patch. Maybe it's a good thing
in general. But whether it's a good thing is _entirely_ independent of
any secure boot issue. I can see using secure boot without it, but I
can very much also see using lockdown without secure boot.
The two things are simply entirely orthogonal. They have _zero_
overlap. I'm not seeing why they'd be linked at all in any way.
I'm not sure I agree. Here's my reasoning:
(1) Lockdown mode really needs to activated during kernel boot, before
userspace has a chance to run, otherwise there's a window of opportunity
in which the kernel *isn't* locked down.
(2) If the kernel isn't booted in secure boot mode, then there's the
opportunity to tamper before the kernel even starts booting.
(3) There doesn't seem any point in booting in secure boot mode if you don't
protect the running kernel image against tampering. What does it mean to
be in "secure boot mode" in that case? If the kernel can be tampered
with, it would seem to be, by definition, insecure.
(4) You can't validly promise the next OS you kexec that *it* is started in
secure boot mode if you don't stop your image from being tampered with.
Note that this doesn't prevent a compromised kernel from lying to the
next OS.
(5) Tampering with a running kernel can be achieved in a variety of ways:
loading of arbitrary modules, loading of modified firmware, direct access
to devices that can effect DMA, writing to /dev/mem, ...
(6) We need to be able to load modules and firmware, but these can be signed,
hashed or measured so we have some idea of their provenance - but signing
can be worked around if, say, /dev/mem is writable.
(7) If you told the BIOS[*] that you want to be in secure boot mode, then the
kernel should honour that and try to prevent tampering with the image.
(8) Turning lockdown mode on if the kernel is booted in secure boot seems to
be the way to achieve this.
(9) BIOS vendors can blacklist any of the components - say the SHIM - to
prevent an insecure kernel from being used to compromise and kexec
another OS.
Note that I've provided a kernel command line parameter that will turn
lockdown mode on arbitrarily - but that can be turned off by editing the
parameters in grub.cfg, say.
David
[*] Yeah, I know, this is an x86-centric view.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 4:26 PM, Linus Torvalds
[off-list ref] wrote:
Magically changing kernel behavior depending on some subtle and often
unintentional bootup behavior detail is completely idiotic.
Another way of looking at this: if lockdown is a good idea to enable
when you booted using secure boot, then why isn't it a good idea when
you *didn't* boot using secure boot?
That's the flip side of this whole argument.
People who boot without secure boot may be wanting all the same
protections. Maybe you have to disable it when you build your own
kernel, for example. Does that suddenly mean that lockdown is now a
bad idea?
And if it does, explain it. Explain why it's a bad idea to enable
without secure boot, but is a good idea to enable *with* secure boot.
In other words: explain the tie-in.
Because I really don't see it. All I see is illogical blathering that
tries to conflate issues that have nothing to do with each other.
Please explain to me why a distro or a user would want lockdown to be
disabled just because the user didn't use secure boot, but suddenly if
it's booted on another machine, it's not just a good idea, but
mandatory in your world view?
Honestly, if I were a distro maintainer, the *last* thing I'd want is
the kernel to act fundamentally differently in some security context
depending on some random bootup condition.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Andy Lutomirski <luto@kernel.org> Date: 2018-04-03 23:43:09
On Tue, Apr 3, 2018 at 4:12 PM, David Howells [off-list ref] wrote:
Andy Lutomirski [off-list ref] wrote:
quoted
I'm having a very, very hard time coming up with a scenario where I
can "trust" something if an attacker can get root but can't modify the
running kernel image but I can't "trust" something if the attacker
can [modify the running kernel image].
(I think the above is what you meant)
Let's go at this a different way. How do you decide you can trust something
in this context? You compare it to something. Signing it, keeping a hash
whitelist, IMA - these are all ways of comparing something. Do you agree with
that?
I trust or distrust a system as a whole. I don't make that decision
by comparing it to anything. I make it by evaluating how the system
works and deciding whether it's trustworthy.
What use is secure boot if processes run as root can subvert your kernel?
Secure boot serves several purposes:
1. Anti-competitive purposes. It's intentionally difficult to run
non-Windows OSes on Windows ARM machines, for example.
2. Allowing me to use a stock UEFI machine to have a verified boot chain.
The latter has nothing whatsoever to do with CPL0. The former,
however, does. If I could easily write some Windows program to run
CPL0 code, then I could chainload Linux using the Windows image, and
I've subverted the purpose.
Cynical? Yes.
quoted
quoted
There's no point bothering with UID/GID checking either.
Give me a break. There's a *huge* difference between a system where
only root can load unsigned modules and a system where anyone can load
unsigned modules.
I don't think we've ever advocated letting just anyone load a module.
But my point is that if you can modify the running kernel, you can nullify all
security checks, including UID/GID checks.
quoted
quoted
However, if /dev/mem can be read, any root process can extract the session
key for your disk.
Any root process can read /dev/mapper/plaintext_disk, lockdown or otherwise.
True - for now - and they can also access the mounted filesystem. But if they
get their hands on your powered-off computer, no, they can't.
This is, IMO, a silly argument. You're saying that some bad guy has
managed to run code as root on my laptop. Then, next week, the bad
guy steals my laptop while it's powered off, and Lockdown is supposed
to protect me against that bad guy. If this happens, I've already
lost completely, lockdown or no.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Matthew Garrett <hidden> Date: 2018-04-03 23:46:04
On Tue, Apr 3, 2018 at 4:26 PM Linus Torvalds
[off-list ref]
wrote:
On Tue, Apr 3, 2018 at 4:17 PM, Matthew Garrett [off-list ref] wrote:
quoted
1) Secure Boot is intended to permit the construction of a boot chain
that
quoted
only runs ring 0 code that the user considers trustworthy
No.
That may be *one* intention, for some people.
It's not an a-priori one for the actual user.
Secure Boot is intended to *permit* that. Without Secure Boot you're unable
to do that. Some users want that. Some users don't.
quoted
2) Allowing arbitrary user code to run in ring 0 without affirmative
consent on the part of the user is therefore incompatible with the
goals of
quoted
Secure Boot
Again, that has absolutely zero relevance.
Those goals are not the *users* goals.
Be honest now. It wasn't generally users who clamored for it.
If you ask a user whether they want a system that lets an attacker replace
their kernel or one that doesn't, what do you think their answer is likely
to be?
If the user actually wanted it, and is asking for it, he can enable
it. Independently of secure boot, which the user generally has little
control over.
How? If the bootloader will boot kernels that don't impose this restriction
then an attacker just replaces whatever's enabling that feature. And, uh,
seriously, I've been asking for *years* for someone to point me at a PC on
the market that doesn't give the user control over Secure Boot, but Shim
was expressly designed to ensure that the user would have the ability to
enroll additional trusted keys (or disable signature validation entirely),
so which cases are you thinking of where the user doesn't have control?
quoted
3) This patchset provides a mechanism to alter the behaviour of the
kernel
quoted
such that it is significantly more difficult for arbitrary user code to
run
quoted
in ring 0 without affirmative user consent
That difficulty already exists, the new thing isn't somehow related to
that at all.
Look at our "uyou can only load modules if you're root" rules. Or the
"you can only load modules if they are signed".
See a pattern there? They don't magically enable themselves (or
disable themselves) depending on whether you booted with secure boot
or not.
What's the benefit of "You can only load modules if they are signed" if
root is able to just overwrite that policy bit in the kernel? The split
between unprivileged users and root is real, but right now module
signatures are theater - there's no significant security benefit from them.
But the reason to tie this to Secure Boot is that without that an attacker
who has root can just replace the kernel on disk (or patch the bootloader
to live-patch the kernel on boot, and yes that's an attack we've seen in
the real world), so while it's a feature that is arguably beneficial under
all circumstances it's a feature that only has significant benefit if you
have some way to actually validate what you're booting in the first place.
quoted
4) Providing a mechanism for automatically enabling this behaviour when
running in a context that is intended to restrict access to ring 0 is a
rational thing to do, because otherwise it is difficult to achieve the
objective in (1)
No. See why it's *NOT* rational, as explained already several times.
Magically changing kernel behavior depending on some subtle and often
unintentional bootup behavior detail is completely idiotic.
It would be idiotic if it was that "check kernel module signatures"
check. This is no less idiotic.
Seriously, listen to your own arguments. If they don't make sense for
checking kernel module signatures, why the hell would they make sense
for something like lockdown.
THE TWO THINGS ARE ENTIRELY INDEPENDENT.
Again, what is your proposed mechanism for ensuring that off the shelf
systems can be configured in a way that makes this possible?
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Matthew Garrett <hidden> Date: 2018-04-03 23:48:07
On Tue, Apr 3, 2018 at 4:39 PM Linus Torvalds
[off-list ref]
wrote:
On Tue, Apr 3, 2018 at 4:26 PM, Linus Torvalds
[off-list ref] wrote:
quoted
Magically changing kernel behavior depending on some subtle and often
unintentional bootup behavior detail is completely idiotic.
Another way of looking at this: if lockdown is a good idea to enable
when you booted using secure boot, then why isn't it a good idea when
you *didn't* boot using secure boot?
Because it's then trivial to circumvent and the restrictions aren't worth
the benefit.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Andy Lutomirski <luto@kernel.org> Date: 2018-04-03 23:48:54
On Tue, Apr 3, 2018 at 4:39 PM, David Howells [off-list ref] wrote:
Linus Torvalds [off-list ref] wrote:
quoted
The same thing is true of some lockdown patch. Maybe it's a good thing
in general. But whether it's a good thing is _entirely_ independent of
any secure boot issue. I can see using secure boot without it, but I
can very much also see using lockdown without secure boot.
The two things are simply entirely orthogonal. They have _zero_
overlap. I'm not seeing why they'd be linked at all in any way.
I'm not sure I agree. Here's my reasoning:
(1) Lockdown mode really needs to activated during kernel boot, before
userspace has a chance to run, otherwise there's a window of opportunity
in which the kernel *isn't* locked down.
That's simply not true. A sensible verified boot chain (a la Chrome
OS) is likely to load, as one verified chunk, a kernel and initramfs.
Then initramfs can flip on lockdown all by itself before it enables
networking or any other attack vectors.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 4:45 PM, Matthew Garrett [off-list ref] wrote:
quoted
Be honest now. It wasn't generally users who clamored for it.
If you ask a user whether they want a system that lets an attacker replace
their kernel or one that doesn't, what do you think their answer is likely
to be?
Goddamnit.
We both know what the answer will be.
And it will have *nothing* to do with secure boot.
So *you* be honest now.
Because you clearly aren't.
Seriously. Go ask that question to a random person:
"Do you want a system that lets an attacker replace their kernel or
one that doesn't?"
and don't ask anything else.
Do you really think they'll answer "no, I don't want an attacker to
replace my kernel, but only if I booted with secure boot"?
Honestly, now.
Again, what is your proposed mechanism for ensuring that off the shelf
systems can be configured in a way that makes this possible?
If you think lockdown is a good idea, and you enabled it, then IT IS ENABLED.
No idiotic "secure boot or not" garbage.
Because secure boot or not isn't *relevant*.
Christ, we already have things like
- CONFIG_STRICT_KERNEL_RWX
- CONFIG_STRICT_DEVMEM
- CONFIG_HARDENED_USERCOPY
- CONFIG_MODULE_SIG_ALL (and friends)
and absolutely *NONE* of them depend on whether the kernel was booted
with secure boot or not.
And I claim that it would be completely idiotic and broken if they did.
And - not entirely unrelated - I claim that it is COMPLETELY IDIOTIC
AND BROKEN to make some new "lockdown" option depend on it.
Comprende?
Really. Your arguments make no sense. They are all fundamentally
broken for the simple reason that all your "but secure boot implies
XYZ" are pure and utter bullshit, because all your arguments are valid
whether secure boot happened or not.
See? Secure boot has *NOTHING* do to with anything. It has nothing to
do with loading only signed kernel modules. It has nothing to do with
your lockdown patches.
Either lockdown is good or not. It's that simple. But the goodness has
nothing to do with secure boot.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: David Howells <dhowells@redhat.com> Date: 2018-04-03 23:56:13
Linus Torvalds [off-list ref] wrote:
Be honest now. It wasn't generally users who clamored for it.
...
If the user actually wanted it, and is asking for it, he can enable it.
From the distributions' point of view, this is a rubbish argument.
Most users haven't even given this a moment's thought, aren't even aware of
the issues, don't even know to ask and, for them, it makes no difference.
They trust their distribution to deal with stuff they don't know about.
David
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 4:56 PM, David Howells [off-list ref] wrote:
=>
Most users haven't even given this a moment's thought, aren't even aware of
the issues, don't even know to ask and, for them, it makes no difference.
They trust their distribution to deal with stuff they don't know about.
Right.
Like perhaps trusting the distribution to just enable all those
security measures _regaredless_ of whether they booted in using secure
boot or not?
See?
If lockdown breaks something, the distro would need to fix it
regardless of secure boot.
So why is the enablement dependent on it again?
I'm not arguing "lockdown shouldn't be on".
I'm arguing "lockdown being on or off has _nothing_ to do with whether
the machine was booted in EFI mode with secure boot or not".
You don't seem to get it.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Matthew Garrett <hidden> Date: 2018-04-03 23:59:54
On Tue, Apr 3, 2018 at 4:55 PM Linus Torvalds
[off-list ref]
wrote:
On Tue, Apr 3, 2018 at 4:45 PM, Matthew Garrett [off-list ref] wrote:
quoted
quoted
Be honest now. It wasn't generally users who clamored for it.
If you ask a user whether they want a system that lets an attacker
replace
quoted
their kernel or one that doesn't, what do you think their answer is
likely
quoted
to be?
Goddamnit.
We both know what the answer will be.
And it will have *nothing* to do with secure boot.
Right, because they care about outcome rather than mechanism. Secure Boot
is the mechanism we have to make that outcome possible.
quoted
Again, what is your proposed mechanism for ensuring that off the shelf
systems can be configured in a way that makes this possible?
If you think lockdown is a good idea, and you enabled it, then IT IS
ENABLED.
Ok. So we can build distribution kernels that *always* have this on, and to
turn it off you have to disable Secure Boot and install a different kernel.
Or we can build distribution kernels that only have this on when you're
booting in a context that makes sense, and you can disable it by just
disabling Secure Boot (by running mokutil --disable-validation) and not
have to install a new kernel. Which outcome do you prefer?
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 4:47 PM, Matthew Garrett [off-list ref] wrote:
quoted
Another way of looking at this: if lockdown is a good idea to enable
when you booted using secure boot, then why isn't it a good idea when
you *didn't* boot using secure boot?
Because it's then trivial to circumvent and the restrictions aren't worth
the benefit.
Bullshit.
If there those restrictions cause problems, they need to be fixed regardless.
In fact, from a debuggability standpoint, you want to find the
problems early, on those kernel development machines that had secure
boot explicitly turned off because it's such a pain.
And if they can't be fixed, then the user is going to disable lockdown
regardless of how he booted the machine.
In no situation is "depending on how you booted" a good choice.
Either you can enable it or you can't. If you can, good. And if you
can't, it has nothing to do with secure boot.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Matthew Garrett <hidden> Date: 2018-04-04 00:05:04
On Tue, Apr 3, 2018 at 5:02 PM Linus Torvalds
[off-list ref]
wrote:
On Tue, Apr 3, 2018 at 4:47 PM, Matthew Garrett [off-list ref] wrote:
quoted
quoted
Another way of looking at this: if lockdown is a good idea to enable
when you booted using secure boot, then why isn't it a good idea when
you *didn't* boot using secure boot?
Because it's then trivial to circumvent and the restrictions aren't
worth
quoted
the benefit.
Bullshit.
If there those restrictions cause problems, they need to be fixed
regardless.
How? When there are random DMA-capable PCI devices that are driven by
userland tools that are mmap()ing the BARs out of sysfs, how do we
simultaneously avoid breaking those devices while also preventing the
majority of users from being vulnerable to an attacker just DMAing over the
kernel?
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 4:59 PM, Matthew Garrett [off-list ref] wrote:
Ok. So we can build distribution kernels that *always* have this on, and to
turn it off you have to disable Secure Boot and install a different kernel.
Bingo.
Exactly like EVERY OTHER KERNEL CONFIG OPTION.
Just like all the ones that I've mentioned several times.
Or, like a lot of other kernel options, maybe have a way to just
disable it on the kernel command line, and let the user know about it.
That would still be better than disabling secure boot entirely in your
world view, so it's (a) more convenient and (b) better.
Again, in no case does it make sense to tie it into "how did we boot".
Because that's just inconvenient for everybody.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 5:04 PM, Matthew Garrett [off-list ref] wrote:
How? When there are random DMA-capable PCI devices that are driven by
userland tools that are mmap()ing the BARs out of sysfs, how do we
simultaneously avoid breaking those devices while also preventing the
majority of users from being vulnerable to an attacker just DMAing over the
kernel?
.. if that ends up being a real problem, then you print a warning and
tell people to use the kernel command line to disable things.
And if it's a big and common problem, then the answer may be that
lockdown has to be entirely OFF by default, and you instead just tell
people to enable it manually with a kernel command line option.
Still better than telling them to disable/enable secure boot, which
they may or may not even be able to to.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Matthew Garrett <hidden> Date: 2018-04-04 00:11:02
On Tue, Apr 3, 2018 at 5:06 PM Linus Torvalds
[off-list ref]
wrote:
On Tue, Apr 3, 2018 at 4:59 PM, Matthew Garrett [off-list ref] wrote:
quoted
Ok. So we can build distribution kernels that *always* have this on,
and to
quoted
turn it off you have to disable Secure Boot and install a different
kernel.
Bingo.
Exactly like EVERY OTHER KERNEL CONFIG OPTION.
So your argument is that we should make the user experience worse? Without
some sort of verified boot mechanism, lockdown is just security theater.
There's no good reason to enable it unless you have some mechanism for
verifying that you booted something you trust.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Matthew Garrett <hidden> Date: 2018-04-04 00:12:18
On Tue, Apr 3, 2018 at 5:08 PM Linus Torvalds
[off-list ref]
wrote:
Still better than telling them to disable/enable secure boot, which
they may or may not even be able to to.
Users who can boot a non-vendor Linux distribution on their platform can
disable Secure Boot 100% of the time.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 5:10 PM, Matthew Garrett [off-list ref] wrote:
quoted
Exactly like EVERY OTHER KERNEL CONFIG OPTION.
So your argument is that we should make the user experience worse? Without
some sort of verified boot mechanism, lockdown is just security theater.
There's no good reason to enable it unless you have some mechanism for
verifying that you booted something you trust.
Wow. Way to snip the rest of the email where I told you what the
solution was. Let me repeat it here, since you so conveniently missed
it and deleted it:
quoted
Or, like a lot of other kernel options, maybe have a way to just
disable it on the kernel command line, and let the user know about it.
That would still be better than disabling secure boot entirely in your
world view, so it's (a) more convenient and (b) better.
Matthew, it's simply not worth continuing talking with you.
I'll just not pull this crap, and vendors that you convince to do
stupid things have only themselves to blame.
You clearly have an agenda, and are not willing to look at arguments
against your idiotic choices.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Matthew Garrett <hidden> Date: 2018-04-04 00:17:00
On Tue, Apr 3, 2018 at 5:15 PM Linus Torvalds
[off-list ref]
wrote:
On Tue, Apr 3, 2018 at 5:10 PM, Matthew Garrett [off-list ref] wrote:
quoted
quoted
Exactly like EVERY OTHER KERNEL CONFIG OPTION.
So your argument is that we should make the user experience worse?
Without
quoted
some sort of verified boot mechanism, lockdown is just security theater.
There's no good reason to enable it unless you have some mechanism for
verifying that you booted something you trust.
Wow. Way to snip the rest of the email where I told you what the
solution was. Let me repeat it here, since you so conveniently missed
it and deleted it:
I ignored it because it's not a viable option. Part of the patchset
disables various kernel command line options. If there's a kernel command
line option that disables the patchset then it's pointless.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Apr 4, 2018 at 2:06 AM, Linus Torvalds
[off-list ref] wrote:
On Tue, Apr 3, 2018 at 4:59 PM, Matthew Garrett [off-list ref] wrote:
quoted
Ok. So we can build distribution kernels that *always* have this on, and to
turn it off you have to disable Secure Boot and install a different kernel.
Bingo.
Exactly like EVERY OTHER KERNEL CONFIG OPTION.
Just like all the ones that I've mentioned several times.
Or, like a lot of other kernel options, maybe have a way to just
disable it on the kernel command line, and let the user know about it.
That would still be better than disabling secure boot entirely in your
world view, so it's (a) more convenient and (b) better.
Again, in no case does it make sense to tie it into "how did we boot".
Because that's just inconvenient for everybody.
Without taking a stance regarding whether I think that kernel lockdown
makes sense, I think Matthew's point is this:
If you don't have lockdown, secure boot doesn't provide a benefit,
since an attacker could just modify the init binary instead of messing
with your kernel.
If you have secure boot, you want lockdown to prevent chainloading
into a backdoored version of the real OS.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Andy Lutomirski <luto@kernel.org> Date: 2018-04-04 00:18:34
On Tue, Apr 3, 2018 at 5:16 PM, Matthew Garrett [off-list ref] wrote:
On Tue, Apr 3, 2018 at 5:15 PM Linus Torvalds
[off-list ref]
wrote:
quoted
On Tue, Apr 3, 2018 at 5:10 PM, Matthew Garrett [off-list ref] wrote:
quoted
quoted
Exactly like EVERY OTHER KERNEL CONFIG OPTION.
So your argument is that we should make the user experience worse?
Without
quoted
quoted
some sort of verified boot mechanism, lockdown is just security theater.
There's no good reason to enable it unless you have some mechanism for
verifying that you booted something you trust.
quoted
Wow. Way to snip the rest of the email where I told you what the
solution was. Let me repeat it here, since you so conveniently missed
it and deleted it:
I ignored it because it's not a viable option. Part of the patchset
disables various kernel command line options. If there's a kernel command
line option that disables the patchset then it's pointless.
if your secure boot-enabled bootloader can't prevent a bad guy from
using malicious kernel command line parameters, then fix it.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Matthew Garrett <hidden> Date: 2018-04-04 00:19:48
On Tue, Apr 3, 2018 at 5:18 PM Andy Lutomirski [off-list ref] wrote:
if your secure boot-enabled bootloader can't prevent a bad guy from
using malicious kernel command line parameters, then fix it.
How is a bootloader supposed to know what the set of malicious kernel
command line parameters is?
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: David Howells <dhowells@redhat.com> Date: 2018-04-04 00:22:31
Linus Torvalds [off-list ref] wrote:
... use the kernel command line to disable things.
An attacker could then modify grub.cfg, say, and cause a reboot (or wait for
the next reboot) to disable lockdown:-/
And whilst we could also distribute a non-locked-down variant of the kernel as
an alternative, the attacker could install and boot that instead since we
can't lock package installation down very easily since it doesn't impinge
directly on the running kernel.
Unfortunately, it's hard to come up with a disablement mechanism in the kernel
that an attacker can't also make use of:-/
David
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Andy Lutomirski <luto@kernel.org> Date: 2018-04-04 00:24:01
On Tue, Apr 3, 2018 at 5:17 PM, Jann Horn [off-list ref] wrote:
On Wed, Apr 4, 2018 at 2:06 AM, Linus Torvalds
[off-list ref] wrote:
quoted
On Tue, Apr 3, 2018 at 4:59 PM, Matthew Garrett [off-list ref] wrote:
quoted
Ok. So we can build distribution kernels that *always* have this on, and to
turn it off you have to disable Secure Boot and install a different kernel.
Bingo.
Exactly like EVERY OTHER KERNEL CONFIG OPTION.
Just like all the ones that I've mentioned several times.
Or, like a lot of other kernel options, maybe have a way to just
disable it on the kernel command line, and let the user know about it.
That would still be better than disabling secure boot entirely in your
world view, so it's (a) more convenient and (b) better.
Again, in no case does it make sense to tie it into "how did we boot".
Because that's just inconvenient for everybody.
Without taking a stance regarding whether I think that kernel lockdown
makes sense, I think Matthew's point is this:
If you don't have lockdown, secure boot doesn't provide a benefit,
since an attacker could just modify the init binary instead of messing
with your kernel.
If you have secure boot, you want lockdown to prevent chainloading
into a backdoored version of the real OS.
I don't think that's the argument here. Secure boot can be used to
protect initramfs, since initramfs comes from the secure boot-verified
bootloader. That verified initramfs can protect the init binary.
As far as I can tell, what's really going on here is that there's a
significant contingent here that wants to prevent Linux from
chainloading something that isn't Linux. (There doesn't seem to be a
real benefit to preventing Linux from chainloading Linux, since the
chainloaded Linux is unlikely to let the attacker do much that the
original rooted Linux kernel wouldn't have allowed.) In particular,
Microsoft, which de facto controls most of the secure boot key
ecosystem, doesn't want Windows to be chainloaded without having its
signature verified.
I admit I'm not quite sure why Microsoft considers this important.
They already require a TPM for all new systems, and any important
secrets can be sealed by the TPM such that a maliciously chainloaded
Windows kernel couldn't access those secrets. But secure boot
predates the WHQL TPM requirement if I remember correctly, and I
suspect that we're seeing leftover requirements from
secure-boot-but-no-TPM era.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 5:16 PM, Matthew Garrett [off-list ref] wrote:
I ignored it because it's not a viable option. Part of the patchset
disables various kernel command line options. If there's a kernel command
line option that disables the patchset then it's pointless.
Honestly, I don't think the patchset is viable at all in that case.
No way will any sane distribution take it, potentially breaking a lot
of machines, and have no way to unbreak them except for "oh, btw, you
have to disable secure boot to get things to work again".
That would be insane.
So you'd better allow some command line options.
One reasonable option may be to just disable lockdown by default (to
make machines work reliably), and then have a "if you're anal about
security, add 'lockdown' to the kernel command line".
People who care about this already need to check the secure boot
status, so this would be just one more thing they'd check.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 5:25 PM, Linus Torvalds
[off-list ref] wrote:
Honestly, I don't think the patchset is viable at all in that case.
.. or rather, it's probably viable only for distributions that already
have reasons to only care about controlled hardware environments, ie
Chromebooks etc.
But a chome OS install wouldn't care about the whole "secure boot or
not" issue anyway, because they'd also control that side, an they
might as well just enable it unconditionally.
In contrast, the generic distros can't enable it anyway if it breaks
random hardware. And it wouldn't be about secure boot or not, but
about the random hardware choice.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Matthew Garrett <hidden> Date: 2018-04-04 00:46:15
On Tue, Apr 3, 2018 at 5:33 PM Linus Torvalds
[off-list ref]
wrote:
In contrast, the generic distros can't enable it anyway if it breaks
random hardware. And it wouldn't be about secure boot or not, but
about the random hardware choice.
The generic distros have been shipping this policy for the past 5 years.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 5:46 PM, Matthew Garrett [off-list ref] wrote:
The generic distros have been shipping this policy for the past 5 years.
.. so apparently it doesn't actually break things? Why not enable it
by default then?
And if "turn off secure boot" really is the accepted - and actuially
used - workaround for the breakage, then
WHY THE HELL DIDN'T YOU START OFF BY EXPLAINING THAT IN THE FIRST
PLACE WHEN PEOPLE ASKED WHY THE TIE-IN EXISTED?
Sorry for shouting, but really. We have a thread of just *how* many
email messages that asked for the explanation for this? All we got was
incomprehensible and illogical crap explanations.
If there actually was a good explanation for the tie-in, it should
have been front-and-center and explained as such.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Matthew Garrett <hidden> Date: 2018-04-04 01:13:25
On Tue, Apr 3, 2018 at 5:56 PM Linus Torvalds
[off-list ref]
wrote:
On Tue, Apr 3, 2018 at 5:46 PM, Matthew Garrett [off-list ref] wrote:
quoted
The generic distros have been shipping this policy for the past 5 years.
.. so apparently it doesn't actually break things? Why not enable it
by default then?
Because it does break things, and the documented fix is "Disable Secure
Boot by running mokutil --disable-validation".
And if "turn off secure boot" really is the accepted - and actuially
used - workaround for the breakage, then
WHY THE HELL DIDN'T YOU START OFF BY EXPLAINING THAT IN THE FIRST
PLACE WHEN PEOPLE ASKED WHY THE TIE-IN EXISTED?
Sorry for shouting, but really. We have a thread of just *how* many
email messages that asked for the explanation for this? All we got was
incomprehensible and illogical crap explanations.
There are four cases:
Verified Boot off, lockdown off: Status quo in distro and mainline kernels
Verified Boot off, lockdown on: Perception of security improvement that's
trivially circumvented (and so bad)
Verified Boot on, lockdown off: Perception of security improvement that's
trivially circumvented (and so bad), status quo in mainline kernels
Verified Boot on, lockdown on: Security improvement, status quo in distro
kernels
Of these four options, only two make sense. The most common implementation
of Verified Boot on x86 platforms is UEFI Secure Boot, so this patchset
includes an option that (if set) results in the kernel doing the right
thing without user intervention. This makes it easy for a user to switch
between the two states that make sense by running a single command and then
following some prompts on the next reboot. The alternative would be to
provide a signed kernel that always enabled lockdown and an unsigned kernel
that didn't, which would (a) increase load on distributions and (b) force
users to both run mokutil --disable-validation and also install a different
kernel.
I'm sorry if I've appeared tetchy in this discussion - having several of my
coworkers shot has not done wonders for my mood.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 7:56 PM, Linus Torvalds
[off-list ref] wrote:
On Tue, Apr 3, 2018 at 5:46 PM, Matthew Garrett [off-list ref] wrote:
quoted
The generic distros have been shipping this policy for the past 5 years.
.. so apparently it doesn't actually break things? Why not enable it
by default then?
And if "turn off secure boot" really is the accepted - and actuially
used - workaround for the breakage, then
While there is very little breakage in the *years* we have been
shipping this in distro kernels, the accepted and used workaround has
always been "turn off secure boot" or sign/import your own keys,
depending on the problems encountered.
WHY THE HELL DIDN'T YOU START OFF BY EXPLAINING THAT IN THE FIRST
PLACE WHEN PEOPLE ASKED WHY THE TIE-IN EXISTED?
Sorry for shouting, but really. We have a thread of just *how* many
email messages that asked for the explanation for this? All we got was
incomprehensible and illogical crap explanations.
If there actually was a good explanation for the tie-in, it should
have been front-and-center and explained as such.
Honestly, yes, the major distros have been shipping this patch set for
years now, and every time it comes to upstream, the same damn
arguments emerge. I do not disagree that there are uses for lockdown
outside of secure boot, provided you have some other mechanism to
verify your chain, I believe chrome OS does. But the tie to secure
boot is because that is the use case that users have been using for
years, it was discussed at kernel summit quite a while ago, plans went
forward there seemed to be agreement, and when it comes time for a
pull request, people come out of the woodwork with an expectation that
it solves every problem or it doesn't need to exist. What is here is a
good starting point. I would expect that if it were merged, others
would build upon that and use much of the code already in place to
extend it. It is tied to secure boot because that is what has been
using this for years as it never seems to get upstream. I am sure
that once it does finally land, it can and will be extended to other
things, but I don't think I would want to spend a lot of time trying
to leverage another external patch set that has been delayed upstream
so many times until it actually did land.
As for the ties to MS that come up every time, and have here as well,
there is no requirement on the MS signature. You can import your own
keys if you don't want them involved, I keep a "test key" imported for
actually running what I build locally.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Apr 3, 2018 at 6:13 PM, Matthew Garrett [off-list ref] wrote:
There are four cases:
No.
Matthew., stop with the agenda already.
This shit is what I'm talking about:
Verified Boot off, lockdown on: Perception of security improvement that's
trivially circumvented (and so bad)
You're doing some serious value judgement that is simply bogus.
If lockdown actually helps avoid CPL0 execution attacks, then it helps
even if secure more is off.
Sure, you can do things like try to install kernels and reboot, but
honestly, that's not "trivially circumvented". It can be quite hard to
hide even if you don't have secure boot. Things like disk encryption
(common for a lot of people) for example means that you simply won't
be booting that machine without the user noticing.
Or think of virtual machines - which people often use on purpose for
security things. Again, they very much are _not_ going to have secure
boot, but it's not necessarily even possible to "replace the kernel
and reboot" at all, because the kernel came from outside the virtual
machine entirely, and rebooting might just kill the VM rather than
restart anything.
So I really think you're pushing this whole "not secure boot" means
"trivial circumvention" much much too hard.
To the point of it being an outright lie.
I think the kind of people who run stuff in virtual machines could
easily want to also enable lockdown measures, simply to reduce the
attack window within that VM. Wouldn't you agree? Those are often
security-conscious people.
This is what I mean by having an agenda. We all know you are a big
proponent of secure boot. But it seems to cloud your arguments, by
turning your assumptions and your agenda into an "argument" that is
simply not even TRUE.
See what I'm unhappy about?
Verified Boot on, lockdown off: Perception of security improvement that's
trivially circumvented (and so bad), status quo in mainline kernels
I think this is entirely false too. Again, the "trivial circumvention"
shows a bias and agenda that isn't really all that true.
Of these four options, only two make sense.
No.
You say that, because you have that bias and that agenda.
But that simply doesn't make it true.
Now, what actually seems to be a real and valid argument is *this* part:
This makes it easy for a user to switch
between the two states that make sense by running a single command and then
following some prompts on the next reboot. The alternative would be to
provide a signed kernel that always enabled lockdown and an unsigned kernel
that didn't, which would (a) increase load on distributions and (b) force
users to both run mokutil --disable-validation and also install a different
kernel.
THAT is an actual argument. Admittedly I think it's a horrible hack,
but it's a hack that can be explained without outright lying. And it
may be a hack that is "the best we can reasonably do"
See what I'm saying?
One argument is based on your value judgments that not everybody else
believes in.
The other argument is based purely on cold hard particular facts.
Guess which argument is better for people who aren't Matthew Garrett?
That said, wouldn't it be equally good to just make the whole thing be
a protected EFI variable instead? Once you have physical access to the
EFI shell (to turn off secure boot) you have access to that too.
Which would allow the "switch off/on" case even if there are other
reasons why changing secure boot isn't a great option (possibly
because secure boot isn't an option to begin with due to being so
invonvenient).
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Matthew Garrett <hidden> Date: 2018-04-04 04:30:32
On Tue, Apr 3, 2018 at 6:43 PM Linus Torvalds
[off-list ref]
wrote:
On Tue, Apr 3, 2018 at 6:13 PM, Matthew Garrett [off-list ref] wrote:
quoted
There are four cases:
No.
Matthew., stop with the agenda already.
This shit is what I'm talking about:
quoted
Verified Boot off, lockdown on: Perception of security improvement
that's
quoted
trivially circumvented (and so bad)
You're doing some serious value judgement that is simply bogus.
If lockdown actually helps avoid CPL0 execution attacks, then it helps
even if secure more is off.
Bear in mind that I'm talking about defaults here - in more constrained
configurations the answers may change. But the kernel has no way of knowing
whether it's in one of those configurations, and as a result there's an
argument for not overpromising on the security that you're providing users.
If a user has a configuration where you're able to verify that userspace
has some degree of protection (eg, disk encryption keys are in the TPM and
won't unseal if someone's switched out the kernel) then it's reasonable for
userland (or a kernel command line option) to enable the functionality.
What I'm afraid of is this turning into a "security" feature that ends up
being circumvented in most scenarios where it's currently deployed - eg,
module signatures are mostly worthless in the non-lockdown case because you
can just grab the sig_enforce symbol address and then kexec a preamble that
flips it back to N regardless of the kernel config. This is the sort of
thing that's not obvious to most users, and it potentially causes them to
make worse security decisions as a result. The goal for this part of the
patchset isn't to cover every single conceivable case, it's to provide
reasonable defaults in a way that makes life easier for distributions.
Or think of virtual machines - which people often use on purpose for
security things. Again, they very much are _not_ going to have secure
boot, but it's not necessarily even possible to "replace the kernel
and reboot" at all, because the kernel came from outside the virtual
machine entirely, and rebooting might just kill the VM rather than
restart anything.
And where you have a trustworthy external thing providing your kernel,
yeah, that's also an argument - and having a kernel command line argument
that enables it in this case also seems entirely reasonable.
This is what I mean by having an agenda. We all know you are a big
proponent of secure boot. But it seems to cloud your arguments, by
turning your assumptions and your agenda into an "argument" that is
simply not even TRUE.
I'm making this argument from the perspective of "What should the kernel do
when it has no additional information". Having the kernel automatically
enable lockdown without the user being aware of which guarantees their
environment is providing risks giving users the impression of security that
they may not have - in that case it makes more sense to have the user make
an explicit decision to enable it.
See what I'm unhappy about?
quoted
Verified Boot on, lockdown off: Perception of security improvement
that's
quoted
trivially circumvented (and so bad), status quo in mainline kernels
I think this is entirely false too. Again, the "trivial circumvention"
shows a bias and agenda that isn't really all that true.
quoted
Of these four options, only two make sense.
No.
You say that, because you have that bias and that agenda.
Ok. Only two make sense *in the absence of additional information about
local configuration*. Distributions have to make reasonable choices here,
and where a configuration choice decreases functionality and provides what
may only be a marginal increase in security it's not a good configuration
choice to make by default.
That said, wouldn't it be equally good to just make the whole thing be
a protected EFI variable instead? Once you have physical access to the
EFI shell (to turn off secure boot) you have access to that too.
That's pretty much exactly what mokutil does, without you needing to find a
copy of the UEFI shell to install first. If you think there's a strong
enough need for it, we could definitely add an additional variable that
allowed you to disable lockdown without disabling signature validation.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Peter Dolding <hidden> Date: 2018-04-04 06:56:54
.
On Wed, Apr 4, 2018 at 11:13 AM, Matthew Garrett [off-list ref] wrote:
There are four cases:
Verified Boot off, lockdown off: Status quo in distro and mainline kernels
Verified Boot off, lockdown on: Perception of security improvement that's
trivially circumvented (and so bad)
Verified Boot on, lockdown off: Perception of security improvement that's
trivially circumvented (and so bad), status quo in mainline kernels
Verified Boot on, lockdown on: Security improvement, status quo in distro
kernels
Of these four options, only two make sense. The most common implementation
of Verified Boot on x86 platforms is UEFI Secure Boot,
Stop right there. Verified boot does not have to be UEFI secureboot.
You could be using a uboot verified boot or
https://www.coreboot.org/git-docs/Intel/vboot.html google vboot.
Neither of these provide flags to kernel to say they have been
performed.
So Verified boot looking off to kernel yet lockdown needing to be on
is one very valid combination and must be supported because the Linux
kernel does not always know when it verified boot environment. When
the Linux kernel thinks verified boot is off it may not be trivial to
circumvent.
Now Verified Boot on, lockdown off. Insanely this can be required in
diagnostic on some embedded platform because EFI secureboot does not
have a off switch. These are platforms where they don't boot if
they don't have a PK and KEK set installed. Yes some of these is jtag
the PK and KEK set in.
The fact that this Verified Boot on, lockdown off causes trouble
points to a clear problem. User owns the hardware they should have
the right to defeat secureboot if they wish to.
In fact the issue that you can not install a KEK per operating system
installed shows a problem as well.
So all OS use the same KEK for their installers and then you have all
non Microsoft in a lot of cases the same KEK for booting OS. Any of
these bootloaders/kernels with defect will end up with the security
being exactly like Verified Boot on, lockdown off. Remember attackers
will send around copies of what ever they need to so they can breach a
system so they find a defective solution some where they will ship it
everywhere. Attackers that secureboot is attempted to prevent are
criminal anyhow what is a little bit of copyright violation to them..
So when the current UEFI design is security theatre there should not
be any special effort to support it.
If UEFI was not security theatre there would be a clean way for people
install and setup up their systems to list what operating system KEK
should be accepted so allowing attack surface area to be minimised and
the damaged form any flawed implementation to also be limited. This
way end users could opt in or out of operating systems based on
security. If user has opted out of all operating systems doing
Verified Boot on, lockdown off: those are not a threat. Also any OS
with defective kernel or bootloader that the system has not allowed
the KEK of would also not be a threat.
Really I see no reason to be bending over in the Linux kernel for UEFI
secureboot. You list all 4 types need to exist for different usage
case of the Linux kernel. The fact UEFI secureboot currently is
implemented on x86 does not handle the fact all 4 use cases need to
exist is really a issue with UEFI Secureboot that needs to be fixed by
those designing UEFI for the future.
Allowing the kernel to be configured the 4 different ways does not
mean a party like Microsoft has to sign off on everything the Linux
kernel can do. Its not like android/IOT vendors have to bow to
Microsoft.
The Linux kernel should not show favouritism. This does mean that
all 4 modes should be in the kernel configuration options.
Matthew Garrett your mistake is that only 2 are valid when all 4 are
valid in different usage cases. Circumventing security is sometimes
required accepting that case is hard for some people. Of course
when a party need perform circumventing security the fact that it
currently gives out the keys to world of UEFI systems is a very big
security design flaw in UEFI.
Why should the Linux kernel contain code to work around defective
design of UEFI and limit what users not using UEFI and using UEFI can
do?
Peter Dolding
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html