LKML Archive on lore.kernel.org
 help / color / Atom feed
From: "AKASHI, Takahiro" <takahiro.akashi@linaro.org>
To: "Luis R. Rodriguez" <mcgrof@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Mimi Zohar <zohar@linux.vnet.ibm.com>,
	Jan Blunck <jblunck@infradead.org>,
	Julia Lawall <julia.lawall@lip6.fr>,
	David Howells <dhowells@redhat.com>,
	Marcus Meissner <meissner@suse.de>, Gary Lin <GLin@suse.com>,
	linux-security-module@vger.kernel.org,
	gnomes@lxorguk.ukuu.org.uk, linux-efi <linux-efi@vger.kernel.org>,
	linux-kernel@vger.kernel.org, Matthew Garrett <mjg59@google.com>
Subject: Re: Firmware signing -- Re: [PATCH 00/27] security, efi: Add kernel lockdown
Date: Thu, 9 Nov 2017 10:48:43 +0900
Message-ID: <20171109014841.GF7859@linaro.org> (raw)
In-Reply-To: <20171108194626.GQ22894@wotan.suse.de>

On Wed, Nov 08, 2017 at 08:46:26PM +0100, Luis R. Rodriguez wrote:
> On Wed, Nov 08, 2017 at 03:15:54PM +0900, AKASHI, Takahiro wrote:
> > Luis,
> > 
> > Thank you for this heads-up.
> > 
> > On Wed, Nov 08, 2017 at 12:07:00AM +0100, Luis R. Rodriguez wrote:
> > > On Thu, Nov 02, 2017 at 06:10:41PM -0400, Mimi Zohar wrote:
> > > > On Thu, 2017-11-02 at 22:04 +0000, David Howells wrote:
> > > > > Mimi Zohar <zohar@linux.vnet.ibm.com> wrote:
> > > > > 
> > > > > > > Only validly signed device firmware may be loaded.
> > > > > > 
> > > > > > fw_get_filesystem_firmware() calls kernel_read_file_from_path() to
> > > > > > read the firmware, which calls into the security hooks. Is there
> > > > > > another place that validates the firmware signatures.  I'm not seeing
> > > > > > which patch requires firmware to be signed?
> > > > > 
> > > > > Luis has a set of patches for this.  However, I'm not sure if that's going
> > > > > anywhere at the moment.  Possibly I should remove this from the manpage for
> > > > > the moment.
> > > 
> > > Remove it for now. The state of of affairs for firmware signing is complex given
> > > that we first wanted to address how to properly grow the API without making
> > > the API worse. This in and of itself was an effort, and that effort also
> > > evaluated two different development paradigms:
> > > 
> > > 	o functional API
> > > 	o data driven API
> > > 
> > > I only recently was convinced that functional API should be used, even for
> > > commonly used exported symbols,
> > 
> > Are you?
> 
> Yes, this stemmed from the fact that even system calls can be abused through
> data driven APIs, and that long term a functional API at least can make
> evolutions much easier to review and bisect.
> 
> That said this is all based on *empirical hearsay*, and no formal observations.
> But the ease to more easily bisect long term is enough for me to consider this 
> for the firmware API given subtle regressions have been a long standing pain
> on the firmware API and I would not want to make the process of bisecting
> any harder.
> 
> If anyone *does* have actual efforts which compares and contrasts both, I'd
> love to get them, to further back my current position, but as-is I'm already
> sold on functional API driven interface.
> 
> > I haven't answered Linus' question, but my concern about functional APIs,
> > as far as firmware signing goes, is that we have no way to _enforce_
> > firmware signing to existing (i.e. verification-unaware) drivers if we need
> > an explicit call of a function, say, verify_firmware().
> 
> Your concern seems to be that a functional driven API for firmware signing would
> implicate having to support verify_firmware() for drivers which *cannot* get
> signed firmware verified, is that correct?
> 
> IMHO that should just fail then, ie, a "locked down" kernel should not want to
> *pass* a firmware signature if such thing could not be done.
> 
> Its no different than trying to verify a signed module on a "locked down" for
> which it has no signature.
> 
> But perhaps I'm not understanding the issue well, let me know.

My point is quite simple:
my_deviceA_init() {
        err = request_firmware(&fw, "deviceA"); <--- (a)
        if (err)
                goto err_request;

        err = verify_firmware(fw);  <--- (b)
        if (err)
                goto err_verify;

        load_fw_to_deviceA(fw);     <--- (c)
        ...
}

As legacy device drivers does not have (b), there is no chance to
prevent loading a firmware at (c) for locked-down kernel.

If you allow me to bring in yet another function, say
request_firmware_signable(), which should be used in place of (a)
for all verification-aware drivers, that would be fine.
In this case, all the invocation of request_firmware() in legacy code
could be forced to fail in locked-down kernel.

But I think that "signable" should be allowed to be combined with other
features of request_firmware variants like _(no)wait or _direct.

-Takahiro AKASHI

> 
> > > and as such I've been going back and slowly
> > > grooming the firmware API with small atomic changes to first clean up the
> > > complex flag mess we have.
> > > 
> > > Since I'm busy with that Takahiro AKASHI has taken up firmware singing effort
> > > but this will depend on the above small cleanup to be done first. I was busy
> > > with addressing existing bugs on the firmware API for a while, then company
> > > travel / conferences so was not able to address this, but I'm back now and
> > > I believe I should be able to tackle the cleanup now.
> > 
> > Good to hear.
> > 
> > > Only after this is merged can we expect a final respin of the firmware signing
> > > effort.
> > > 
> > > > Or reflect that IMA-appraisal, if enabled, will enforce firmware being
> > > > validly signed.
> > > 
> > > But FWICT lockdown is a built-in kernel thingy, unless lockdown implies IMA
> > > it would not be the place to refer to it.
> > 
> > I think that the situation is the same as in module signing.
> 
> But by definition a "locked down" kernel will enforce module signing, and it
> would seem logical that if modules signing is enforced, eventually a statement
> about firmware signing can be added, as it relates to a kernel enforcement
> effort, not a kernel-userpace framework such as IMA.
> 
>   Luis
> 
> > -Takahiro AKASHI
> > 
> > > It seems the documentation was proposed to help users if an error was caught.
> > > That error should cover only what is being addressed in code on the kernel.
> > > 
> > >   Luis
> > 
> 
> -- 
> Luis Rodriguez, SUSE LINUX GmbH
> Maxfeldstrasse 5; D-90409 Nuernberg

  reply index

Thread overview: 151+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-19 14:50 David Howells
2017-10-19 14:50 ` [PATCH 01/27] Add the ability to lock down access to the running kernel image David Howells
2017-10-20 23:19   ` James Morris
2017-10-19 14:50 ` [PATCH 02/27] Add a SysRq option to lift kernel lockdown David Howells
2017-10-19 17:20   ` Randy Dunlap
2017-10-19 22:12   ` David Howells
2017-11-07 17:39   ` Thiago Jung Bauermann
2017-11-07 22:56   ` David Howells
2017-10-19 14:50 ` [PATCH 03/27] Enforce module signatures if the kernel is locked down David Howells
2017-10-20  6:33   ` joeyli
2017-10-20 23:21   ` James Morris
2017-10-27 18:48   ` Mimi Zohar
2017-10-30 17:00   ` David Howells
2017-10-30 17:52     ` Mimi Zohar
2017-11-02 17:22   ` David Howells
2017-11-02 19:13     ` Mimi Zohar
2017-11-02 21:30     ` David Howells
2017-11-02 21:41       ` Mimi Zohar
2017-11-02 22:01       ` David Howells
2017-11-02 22:18         ` Mimi Zohar
2017-10-19 14:51 ` [PATCH 04/27] Restrict /dev/mem and /dev/kmem when " David Howells
2017-10-20  6:37   ` joeyli
2017-10-20 23:21   ` James Morris
2017-10-19 14:51 ` [PATCH 05/27] kexec: Disable at runtime if " David Howells
2017-10-20  6:38   ` joeyli
2017-10-20 23:22   ` James Morris
2017-10-19 14:51 ` [PATCH 06/27] Copy secure_boot flag in boot params across kexec reboot David Howells
2017-10-20  6:40   ` joeyli
2017-10-19 14:51 ` [PATCH 07/27] kexec_file: Disable at runtime if securelevel has been set David Howells
2017-10-20 23:26   ` James Morris
2017-10-23 15:54   ` Mimi Zohar
2017-10-26  7:42     ` joeyli
2017-10-26 14:17       ` Mimi Zohar
2017-10-27 19:30         ` Mimi Zohar
2017-10-27 19:32         ` Mimi Zohar
2017-10-28  8:34           ` joeyli
2017-10-29 22:26             ` Mimi Zohar
2017-10-30  9:00       ` David Howells
2017-10-30 12:01         ` Mimi Zohar
2017-10-26 15:02     ` David Howells
2017-10-26 15:46       ` Mimi Zohar
2017-10-30 15:49       ` David Howells
2017-10-30 16:43         ` Mimi Zohar
2017-11-02 17:00         ` David Howells
2017-10-26 14:51   ` David Howells
2017-11-02 17:29   ` David Howells
2017-10-19 14:51 ` [PATCH 08/27] hibernate: Disable when the kernel is locked down David Howells
2017-10-20  6:40   ` joeyli
2017-10-19 14:51 ` [PATCH 09/27] uswsusp: " David Howells
2017-10-20  6:41   ` joeyli
2017-10-20 23:29   ` James Morris
2017-10-19 14:51 ` [PATCH 10/27] PCI: Lock down BAR access " David Howells
2017-10-20  6:42   ` joeyli
2017-10-19 14:51 ` [PATCH 11/27] x86: Lock down IO port " David Howells
2017-10-20  6:43   ` joeyli
2017-10-19 14:52 ` [PATCH 12/27] x86/msr: Restrict MSR " David Howells
2017-10-20  6:43   ` joeyli
2017-10-20 18:09   ` Alan Cox
2017-10-20 20:48   ` David Howells
2017-10-21  4:39     ` joeyli
2017-10-23 14:49   ` David Howells
2017-10-25 14:03     ` joeyli
2017-10-19 14:52 ` [PATCH 13/27] asus-wmi: Restrict debugfs interface " David Howells
2017-10-20  6:44   ` joeyli
2017-10-19 14:52 ` [PATCH 14/27] ACPI: Limit access to custom_method " David Howells
2017-10-20  6:45   ` joeyli
2017-10-19 14:52 ` [PATCH 15/27] acpi: Ignore acpi_rsdp kernel param when the kernel has been " David Howells
2017-10-20  6:45   ` joeyli
2017-10-19 14:52 ` [PATCH 16/27] acpi: Disable ACPI table override if the kernel is " David Howells
2017-10-20  6:46   ` joeyli
2017-10-19 14:52 ` [PATCH 17/27] acpi: Disable APEI error injection " David Howells
2017-10-20  6:47   ` joeyli
2017-10-19 14:52 ` [PATCH 18/27] bpf: Restrict kernel image access functions when " David Howells
2017-10-19 22:18   ` Alexei Starovoitov
2017-10-20  2:47     ` joeyli
2017-10-20  8:08     ` David Howells
2017-10-20 15:57       ` jlee
2017-10-20 23:00         ` Alexei Starovoitov
2017-10-23 14:51         ` David Howells
2017-10-20 16:03       ` David Howells
2017-10-20 16:43         ` jlee
2017-10-23 14:53         ` David Howells
2017-10-25  7:07           ` joeyli
2017-10-19 22:48   ` David Howells
2017-10-19 23:31     ` Alexei Starovoitov
2017-11-09 17:15     ` David Howells
2017-10-19 14:52 ` [PATCH 19/27] scsi: Lock down the eata driver David Howells
2017-10-19 14:53 ` [PATCH 20/27] Prohibit PCMCIA CIS storage when the kernel is locked down David Howells
2017-10-19 14:53 ` [PATCH 21/27] Lock down TIOCSSERIAL David Howells
2017-10-19 14:53 ` [PATCH 22/27] Lock down module params that specify hardware parameters (eg. ioport) David Howells
2017-10-19 14:53 ` [PATCH 23/27] x86/mmiotrace: Lock down the testmmiotrace module David Howells
2017-10-19 14:53 ` [PATCH 24/27] debugfs: Disallow use of debugfs files when the kernel is locked down David Howells
2017-10-19 14:53 ` [PATCH 25/27] Lock down /proc/kcore David Howells
2017-10-21  2:11   ` James Morris
2017-10-23 14:56   ` David Howells
2017-10-19 14:53 ` [PATCH 26/27] efi: Add an EFI_SECURE_BOOT flag to indicate secure boot mode David Howells
2017-10-21  2:19   ` James Morris
2017-10-23 14:58   ` David Howells
2017-10-19 14:53 ` [PATCH 27/27] efi: Lock down the kernel if booted in " David Howells
2017-10-19 22:39 ` [PATCH 00/27] security, efi: Add kernel lockdown David Howells
2017-10-23 14:34 ` [PATCH 04/27] Restrict /dev/mem and /dev/kmem when the kernel is locked down David Howells
2017-10-24 10:48   ` Ethan Zhao
2017-10-24 14:56   ` David Howells
2017-11-02 22:01 ` [PATCH 00/27] security, efi: Add kernel lockdown Mimi Zohar
2017-11-02 22:04 ` Firmware signing -- " David Howells
2017-11-02 22:10   ` Mimi Zohar
2017-11-07 23:07     ` Luis R. Rodriguez
2017-11-08  6:15       ` AKASHI, Takahiro
2017-11-08 19:46         ` Luis R. Rodriguez
2017-11-09  1:48           ` AKASHI, Takahiro [this message]
2017-11-09  2:17             ` Mimi Zohar
2017-11-09  4:46               ` AKASHI, Takahiro
2017-11-10 13:37                 ` Mimi Zohar
2017-11-11  2:32                 ` Alan Cox
2017-11-13 11:49                   ` Mimi Zohar
2017-11-13 17:42                   ` Luis R. Rodriguez
2017-11-13 21:08                     ` Alan Cox
2017-12-04 19:51                       ` Luis R. Rodriguez
2017-12-07 15:32                         ` Alan Cox
2017-11-13 21:44                     ` David Howells
2017-11-13 22:09                       ` Linus Torvalds
2017-11-14  0:20                         ` Alan Cox
2017-11-14 12:21                         ` Mimi Zohar
2017-11-14 12:38                           ` Greg Kroah-Hartman
2017-11-14 13:17                             ` Mimi Zohar
2017-11-14 17:34                           ` Linus Torvalds
2017-11-14 19:58                             ` Matthew Garrett
2017-11-14 20:18                               ` Linus Torvalds
2017-11-14 20:31                                 ` Matthew Garrett
2017-11-14 20:35                                   ` Linus Torvalds
2017-11-14 20:37                                     ` Matthew Garrett
2017-11-14 20:50                                 ` Luis R. Rodriguez
2017-11-14 20:55                                   ` Matthew Garrett
2017-11-14 22:14                                     ` James Bottomley
2017-11-14 22:17                                       ` Matthew Garrett
2017-11-14 22:31                                         ` James Bottomley
2017-11-14 22:34                                           ` Matthew Garrett
2017-11-15 11:49                                   ` Mimi Zohar
2017-11-15 17:52                                     ` Luis R. Rodriguez
2017-11-15 19:56                                       ` Mimi Zohar
2017-11-15 20:46                                         ` Luis R. Rodriguez
2017-11-16  0:05                                           ` Mimi Zohar
2017-12-05 10:27                                 ` Pavel Machek
2017-12-07 23:02                                   ` Luis R. Rodriguez
2017-12-08 17:11                                     ` Alan Cox
2017-11-10  1:46             ` Luis R. Rodriguez
2017-11-10 13:45               ` Mimi Zohar
2017-11-13 18:50                 ` Luis R. Rodriguez
2017-11-13 19:08                   ` Luis R. Rodriguez
2017-11-08 20:01       ` Mimi Zohar
2017-11-08 20:09         ` Luis R. Rodriguez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171109014841.GF7859@linaro.org \
    --to=takahiro.akashi@linaro.org \
    --cc=GLin@suse.com \
    --cc=dhowells@redhat.com \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=jblunck@infradead.org \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=meissner@suse.de \
    --cc=mjg59@google.com \
    --cc=torvalds@linux-foundation.org \
    --cc=zohar@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
	git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git