ksummit.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: mcgrof@gmail.com, ksummit-discuss@lists.linuxfoundation.org,
	jkkm@jkkm.org
Subject: Re: [Ksummit-discuss] [TECH TOPIC] Firmware signing
Date: Tue, 28 Jul 2015 17:17:20 +0100	[thread overview]
Message-ID: <29850.1438100240@warthog.procyon.org.uk> (raw)
In-Reply-To: <1438096213.5441.147.camel@HansenPartnership.com>

James Bottomley <James.Bottomley@HansenPartnership.com> wrote:

> >  (1) Should signatures produced by the manager of the linux-firmware package
> >      be allowed only?
> 
> Firmware is a binary blob usually with no decompilation.  How would the
> package manager know its provenance?  The only people who know are the
> people who write the driver.  If they sign, I think we have to accept
> their signature and if not, we could have a weaker level of trust on the
> package manager based on unbroken chain of transmission from the
> firmware provider, but you'd have to trust the packaging organisation.

There's an additional question here:

(1b) Assuming we want to reject any firmware blob for which we don't have a
     valid signature, what do we do about things for which we don't have a
     signature?

I'm assuming that we reasonably regard the set of blobs in linux-firmware -
and for the moment we might have to sign them all with the linux-firmware
manager's key.  Now this might be a bad assumption, but we can't practically
say that we require *every* firmware vendor to give us a signature for every
blob before we can guarantee that all of them will work.

> >  (3) If the vendors of firmware blobs supply signatures, should we accept
> >      those instead of or as well as linux-firmware signatures?
> 
> Of course, How are you going to validate other than by trusting the
> vendor?  Conversely, if you don't trust the vendor, why are you loading
> an unknown binary blob from them into a processing engine they made?

As previously mentioned, we have to deal with as-yet unsigned firmware blobs
or the validation can be worked around by simple removing the signature file.

> >  (4) If we start taking vendor created blobs, what do we do with all the
> >      vendor keys?  Compiling them into the kernel could quickly get out of
> >      hand and asking the user to add them to the UEFI keystore has the
> >      potential to brick the user's system due to a dodgy BIOS.
> 
> If the vendors buy in, I assume you'll eventually get them building them
> into their drivers.

You could do that.  But it means if a vendor's private key is compromised, you
have to issue a replacement kernel as well as a replacement firmware package
instead of just the latter.  I guess you have to pick the compromise you're
willing to live with.

> In the interim, the package manager could supply the trusted keys at
> runtime.

Only if they're signed by a key trusted by the kernel - otherwise they aren't
trusted keys.

> >  (6) Should module signatures contain the module name - to be matched
> >      against the modinfo structure after the signature is checked?
> 
> I'm agnostic on this, but if we're doing signatures, we already have the
> sha256 of the code.  We can build a simple comparison table, so we can
> match to the signature without knowing the name.

It would have to be built into the core kernel.  The Fedora kernel I'm running
has 4118 modules available.  That's 32 bytes per module, assuming simply a
flat list of module digests - giving a total table size of ~128K of
uncompressible, unswappable data.  Further, you also cannot load any module
external to that set - so no OpenAFS, no 

> >  (7) Do we want to have the driver mandate the key that will be used when
> >      requesting firmware?  How would we specify the key?  I'm loathe to
> >      include a hash of the public key since that means the driver is then
> >      tied to a particular key.
> 
> I think so ... how else would you have a true validation chain.  You
> need to ask yourself *what* your trusting.  I'm afraid the answer is
> whatever the manufacturer told you because there's no way of checking
> for firmware.

Well, you could theoretically have a validation chain if, say, LF had a root
cert that they signed vendor's keys with that they then used to sign their
firmware and we put the root X.509 cert into the kernel.

Of course, there'd likely be politicking about this and I'm not sure LF would
want to go there...

Also, this assumed that the vendor is interested in supporting Linux and is
willing to provide a cert that the driver can reference...  We have to be able
to support the case where this isn't true - and where a manufacturer no longer
exists or no longer supports a product.

> >  (8) Can we then trust that key if we load it on the basis that a driver
> >      specifies it by public key hash, even it we can't chain back from it to
> >      the system_trusted_keyring.
> 
> What's the point of tying to the system root of trust?

Because then we can demand-load keys using add_key() or request_key() and
validate their trust by chaining.

> >  (9) Do we allow UEFI blacklisting of firmware signatures?
> 
> There has to be a blacklist mechanism, yes ... I'm not sure UEFI would
> do it, though.

IIRC, UEFI blacklisting is just a list of SHA256 hashes.

However, we could also have a list of SHA256 hashes and names in the
linux-firmware package with its own signature that we can demand load using
request_firmware().

> > Some points that may be of use in considering the above:
> > 
> >  (A) PKCS#7/CMS messages can take multiple signatures.  Extra signatures can
> >      be added at a later date.
> 
> This is irrelevant in the detached signature case, isn't it?

No.  The PKCS#7 message file that is the 'signature' can have multiple digital
signatures by different keys.  As far as the PKCS#7 message is concerned, it's
the content that is detached.

> >  (D) The PKCS#7/CMS field that matches the signing key is not itself signed.
> 
> Does it need to be?  If the field is modified, verification occurs with
> the wrong key and you get a failure.  That's logically equivalent to
> finding the field has been altered and getting a failure.

My point was that an Intel driver, say, can't say that "You must use a key
with subject /CN=Intel firmware/O=Intel" as anyone can create such a key and a
fake firmware blob that requires that key.

David

  parent reply	other threads:[~2015-07-28 16:17 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-28 13:36 David Howells
2015-07-28 14:23 ` David Woodhouse
2015-07-28 16:55   ` Luis R. Rodriguez
2015-07-28 15:10 ` James Bottomley
2015-07-28 15:22   ` Andy Lutomirski
2015-07-28 15:31     ` James Bottomley
2015-07-28 16:05       ` Andy Lutomirski
2015-07-28 16:10         ` James Bottomley
2015-07-28 16:15           ` David Woodhouse
2015-07-28 16:35             ` Andy Lutomirski
2015-07-28 16:44             ` David Howells
2015-07-28 17:03               ` Andy Lutomirski
2015-07-28 19:19                 ` David Woodhouse
2015-07-28 19:31                   ` Andy Lutomirski
2015-07-28 19:43                     ` David Woodhouse
2015-07-28 22:03                     ` James Bottomley
2015-08-11 20:24                     ` David Howells
2015-08-11 21:56                       ` Andy Lutomirski
2015-08-11 22:03                         ` Luis R. Rodriguez
2015-08-12 18:22                       ` David Howells
2015-08-12 18:45                         ` David Woodhouse
2015-08-12 19:09                           ` Andy Lutomirski
2015-08-12 19:15                             ` James Bottomley
2015-08-12 19:25                               ` Andy Lutomirski
2015-08-12 19:43                                 ` James Bottomley
2015-08-12 19:45                                   ` Andy Lutomirski
2015-08-12 19:59                                     ` James Bottomley
2015-08-13  7:03                                       ` Jan Kara
2015-08-13 14:01                                         ` James Bottomley
2015-08-12 22:46                           ` David Howells
2015-08-12 22:51                             ` Andy Lutomirski
2015-08-12 19:06                         ` Andy Lutomirski
2015-08-12 22:39                         ` David Howells
2015-08-12 22:45                           ` Andy Lutomirski
2015-08-12 22:45                         ` David Howells
2015-08-12 22:47                           ` Andy Lutomirski
2015-07-28 16:18   ` David Howells
2015-07-28 16:42     ` James Bottomley
2015-07-28 17:05       ` Andy Lutomirski
2015-07-28 17:09         ` James Bottomley
2015-07-28 17:10           ` Andy Lutomirski
2015-07-29  2:00         ` James Morris
2015-07-28 16:58   ` Josh Boyer
2015-07-28 15:12 ` David Woodhouse
2015-07-28 18:47   ` Peter Jones
2015-07-28 19:14   ` David Howells
2015-07-28 19:52     ` Peter Jones
2015-07-28 16:17 ` David Howells [this message]
2015-07-28 16:59   ` James Bottomley
2015-07-28 19:11   ` David Howells
2015-07-28 19:34     ` Luis R. Rodriguez
2015-07-28 21:53     ` James Bottomley
2015-07-28 22:39     ` David Howells
2015-07-28 22:44       ` Andy Lutomirski
2015-07-29  8:39         ` David Woodhouse
2015-07-28 18:36 ` josh
2015-07-28 18:44   ` James Bottomley
2015-07-28 18:54     ` josh
2015-07-28 19:06       ` Luis R. Rodriguez
2015-07-28 21:38       ` Greg KH
2015-07-28 23:59         ` josh
2015-07-29  0:17           ` Greg KH
2015-07-29  9:37         ` David Woodhouse
2015-07-29 15:00           ` James Bottomley
2015-07-29 15:35             ` David Woodhouse
2015-07-29 16:38               ` James Bottomley
2015-07-29 17:32                 ` David Woodhouse
2015-07-29 23:39                   ` James Bottomley
2015-07-30  8:08                     ` David Woodhouse
2015-07-30 13:48                       ` James Bottomley
2015-07-30 14:21                         ` Heiko Stübner
2015-07-30 14:30                           ` James Bottomley
2015-07-30 15:01                         ` David Woodhouse
2015-07-30 16:17                           ` James Bottomley
2015-07-30 19:17                             ` David Woodhouse
2015-07-31 14:41                               ` Theodore Ts'o
2015-07-31 16:14                                 ` Tim Bird
2015-07-31 17:25                                   ` David Woodhouse
2015-07-30 16:24                           ` Tim Bird
2015-07-29 16:35             ` Josh Triplett
2015-07-29  8:29       ` David Woodhouse
2015-07-29 11:57       ` Mark Brown
2015-07-29 12:02         ` David Woodhouse
2015-07-29 12:24           ` Mark Brown
2015-07-28 19:23   ` David Woodhouse
2015-07-28 19:19 ` David Howells

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=29850.1438100240@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=jkkm@jkkm.org \
    --cc=ksummit-discuss@lists.linuxfoundation.org \
    --cc=mcgrof@gmail.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox