[RFC] Second attempt at kernel secure boot support

Started by Matthew Garrett on Sep 20, 2012 · 167 messages from 24 authors · Last reply Nov 23, 2012

page 2 of 3 · open the first message on its own page

  1. [PATCH V2 01/10] Secure boot: Add new capability
    Related patches
  2. [PATCH V2 04/10] ACPI: Limit access to custom_method
    Related patches
  3. [PATCH V2 07/10] Secure boot: Add a dummy kernel parameter that will switch on Secure Boot mode
    Related patches
  4. [PATCH V2 09/10] acpi: Ignore acpi_rsdp kernel parameter in a secure boot environment
    Related patches
  5. [PATCH V2 08/10] efi: Enable secure boot lockdown automatically when enabled in firmware
    Related patches
  6. [PATCH V2 06/10] Restrict /dev/mem and /dev/kmem in secure boot setups
    Related patches
  7. [PATCH V2 05/10] asus-wmi: Restrict debugfs interface
    Related patches
  8. [PATCH V2 03/10] x86: Lock down IO port access in secure boot environments
    Related patches
  9. [PATCH V2 02/10] PCI: Lock down BAR access in secure boot environments
    Related patches
  10. [PATCH V2 10/10] SELinux: define mapping for new Secure Boot capability
    Related patches
  11. [PATCH V3 07/10] Secure boot: Add a dummy kernel parameter that will switch on Secure Boot mode
    Related patches
  12. [PATCH RFC 1/4] scripts/sign-file: Allow specifying hash algorithm via -a option
    Revisions and related patches
    Revisions (2)
    1. rfc current
    2. v2 [diff against previous]
  13. [PATCH RFC 2/4] scripts/sign-file: Support firmware signing
    Revisions and related patches
    Revisions (2)
    1. rfc current
    2. v2 [diff against previous]
  14. [PATCH RFC 3/4] firmware: Add a signature check
    Revisions and related patches
    Revisions (2)
    1. rfc current
    2. v2 [diff against previous]
  15. [PATCH RFC 4/4] firmware: Install signature files automatically
    Revisions and related patches
    Revisions (2)
    1. rfc current
    2. v2 [diff against previous]
  16. [PATCH RFC v2 4/4] firmware: Install firmware signature files automatically
    Revisions and related patches
    Revisions (2)
    1. rfc
    2. v2 current [diff against previous]
  17. [PATCH RFC v2 2/4] firmware: Add -a option to scripts/sign-file
    Revisions and related patches
    Revisions (2)
    1. rfc
    2. v2 current [diff against previous]
  18. [PATCH RFC v2 1/4] firmware: Add the firmware signing support to scripts/sign-file
    Revisions and related patches
    Revisions (2)
    1. rfc
    2. v2 current [diff against previous]
  19. [PATCH RFC v2 3/4] firmware: Add support for signature checks
    Revisions and related patches
    Revisions (2)
    1. rfc
    2. v2 current [diff against previous]
Message details and related content
On Thu, 2012-11-01 at 14:49 +0000, Matthew Garrett wrote:
On Thu, Nov 01, 2012 at 02:42:15PM +0000, James Bottomley wrote:
quoted
On Thu, 2012-11-01 at 10:29 -0400, Eric Paris wrote:
quoted
Imagine you run windows and you've never heard of Linux.  You like
that only windows kernels can boot on your box and not those mean
nasty hacked up malware kernels.  Now some attacker manages to take
over your box because you clicked on that executable for young models
in skimpy bathing suits.  That executable rewrote your bootloader to
launch a very small carefully crafted Linux environment.  This
environment does nothing but launch a perfectly valid signed Linux
kernel, which gets a Windows environment all ready to launch after
resume and goes to sleep.  Now you have to hit the power button twice
every time you turn on your computer, weird, but Windows comes up, and
secureboot is still on, so you must be safe!
So you're going back to the root exploit problem?  I thought that was
debunked a few emails ago in the thread?
The entire point of this feature is that it's no longer possible to turn 
a privileged user exploit into a full system exploit. Gaining admin 
access on Windows 8 doesn't permit you to install a persistent backdoor, 
unless there's some way to circumvent that. Which there is, if you can 
drop a small Linux distribution onto the ESP and use a signed, trusted 
bootloader to boot a signed, trusted kernel that then resumes from an 
unsigned, untrusted hibernate image. So we have to ensure that that's 
impossible.
But surely that's fanciful ... you've already compromised windows to get
access to the ESP.  If you've done it once, you can do it again until
the exploit is patched.  There are likely many easier ways of ensuring
persistence than trying to install a full linux kernel with a
compromised resume system.

If this could be used to attack a windows system in the first place,
then Microsoft might be annoyed, but you have to compromise windows
*first* in this scenario.

James

Message details and related content
would get keys revoked.  If your key is revoke Linux can't boot on a
large amount of new hardware without BIOS twiddling.
See "live free or die". If you want to live in a world where you can't
even fart before checking if the man from Microsoft will revoke your key
you might as well go home now.
The point of secureboot is even if the admin did something which
allowed his kernel to be compromised, it won't persist.  Sure,
secureboot moves the attack up the stack to userspace, but at least we
can do something about the kernel.
Nice theory.

At the end of the day I don't care if you want to produce this stuff and
sell it to people. Fine, the interface proposed is clean enough that it
doesn't pee on other work, but don't expect the rest of the world to
follow mindlessly into your slave pit driven by your fear.

Alan
Message details and related content
On Thu, Nov 1, 2012 at 11:06 AM, James Bottomley
[off-list ref] wrote:
But surely that's fanciful ... you've already compromised windows to get
access to the ESP.  If you've done it once, you can do it again until
the exploit is patched.
You work under the assumption that any bad operation was done by means
of a compromised kernel.  Admins install things all the time,
sometimes, things which they shouldn't.  (This statement is OS
agnostic)
There are likely many easier ways of ensuring
persistence than trying to install a full linux kernel with a
compromised resume system.
I'm sure lots of us would love to hear the ideas.  And the attack is
on the suspend side, nothing about resume has to be malicious (not
really relevant I guess)...
Message details and related content
On Thu, 2012-11-01 at 10:59 -0400, Eric Paris wrote:
On Thu, Nov 1, 2012 at 10:42 AM, James Bottomley
[off-list ref] wrote:
quoted
On Thu, 2012-11-01 at 10:29 -0400, Eric Paris wrote:
quoted
On Thu, Nov 1, 2012 at 5:59 AM, James Bottomley
[off-list ref] wrote:
quoted
But that doesn't really help me: untrusted root is an oxymoron.
Imagine you run windows and you've never heard of Linux.  You like
that only windows kernels can boot on your box and not those mean
nasty hacked up malware kernels.  Now some attacker manages to take
over your box because you clicked on that executable for young models
in skimpy bathing suits.  That executable rewrote your bootloader to
launch a very small carefully crafted Linux environment.  This
environment does nothing but launch a perfectly valid signed Linux
kernel, which gets a Windows environment all ready to launch after
resume and goes to sleep.  Now you have to hit the power button twice
every time you turn on your computer, weird, but Windows comes up, and
secureboot is still on, so you must be safe!
So you're going back to the root exploit problem?  I thought that was
debunked a few emails ago in the thread?

Your attack vector isn't plausible because for the suspend attack to
work, the box actually has to be running Linux by default ... I think
the admin of that box might notice if it suddenly started running
windows ...
Maybe you misread.  The owner of the box would never know a shim Linux
was loaded.  In any case, as I said, windows really is irrelevant.
It's just using Linux as an attack vectore against Windows is what
would get keys revoked.  If your key is revoke Linux can't boot on a
large amount of new hardware without BIOS twiddling.u
quoted
quoted
In this case we have a completely 'untrusted' root inside Linux.  From
the user PoV root and Linux are both malware.  Notice the EXACT same
attack would work launching rootkit'd Linux from Linux.  So don't
pretend not to care about Windows.  It's just that launching malware
Linux seems like a reason to get your key revoked.  We don't want
signed code which can be used as an attack vector on ourselves or on

23 more quoted lines

You're completely confusing two separate goals:

     1. Is it possible to use secure boot to implement a security policy
        on Linux
     2. What do we have to do anything to prevent Linux being used to
        attack windows which may lead to a revocation of the distro
        signing key.

"untrusted root" is a silly answer to 1 because it's incredibly
difficult to remove sufficient trust from root and still have it be
trusted enough to be effective as root.  The trust bound up in root is
incredibly intertwined.  It would be far better to start by eliminating
the root user altogether and building up on the capabilities in a
granular fashion for this type of lockdown.

"untrusted root", if it can even be achieved, might be a sufficient
condition for 2 but it's way overkill for a necessary one.

James

Message details and related content
On Thu, Nov 01, 2012 at 03:06:30PM +0000, James Bottomley wrote:
But surely that's fanciful ... you've already compromised windows to get
access to the ESP.  If you've done it once, you can do it again until
the exploit is patched.  There are likely many easier ways of ensuring
persistence than trying to install a full linux kernel with a
compromised resume system.
There's a pretty strong distinction between "Machine is exploited until 
exploit is patched" and "Machine is exploited until drive is replaced".

-- 
Matthew Garrett | mjg59@srcf.ucam.org
Message details and related content
On Thu, Nov 01, 2012 at 03:06:54PM +0000, Alan Cox wrote:
quoted
The entire point of this feature is that it's no longer possible to turn 
a privileged user exploit into a full system exploit. Gaining admin 
access on Windows 8 doesn't permit you to install a persistent backdoor, 
Really, that would be a first. Do you have a detailed knowledge of
windows 8 actual security ?
http://msdn.microsoft.com/en-us/library/windows/desktop/hh848061%28v=vs.85%29.aspx
quoted
unless there's some way to circumvent that. Which there is, if you can 
drop a small Linux distribution onto the ESP and use a signed, trusted 
bootloader to boot a signed, trusted kernel that then resumes from an 
unsigned, untrusted hibernate image. So we have to ensure that that's 
impossible.
Well if you want to make Linux entirely robust Red Hat could start
helping with some of the 6000 odd coverity matches some of which will
most certainly turn out to be real flaws.
Sure, bugs should be fixed.

-- 
Matthew Garrett | mjg59@srcf.ucam.org
Message details and related content
On Thu, 1 Nov 2012 16:29:01 +0000
Matthew Garrett [off-list ref] wrote:
On Thu, Nov 01, 2012 at 03:06:54PM +0000, Alan Cox wrote:
quoted
quoted
The entire point of this feature is that it's no longer possible to turn 
a privileged user exploit into a full system exploit. Gaining admin 
access on Windows 8 doesn't permit you to install a persistent backdoor, 
Really, that would be a first. Do you have a detailed knowledge of
windows 8 actual security ?
http://msdn.microsoft.com/en-us/library/windows/desktop/hh848061%28v=vs.85%29.aspx
No I said knowledge of not web pages. The Red Hat pages say Linux is very
secure, the Apple ones say MacOS is.

The point being you don't want to evaluate apparent security by press
release of one system versus deep internal knowledge of the other.

Alan

Message details and related content
On Thu, Nov 1, 2012 at 11:18 AM, James Bottomley
[off-list ref] wrote:
You're completely confusing two separate goals:

     1. Is it possible to use secure boot to implement a security policy
        on Linux
     2. What do we have to do anything to prevent Linux being used to
        attack windows which may lead to a revocation of the distro
        signing key.

"untrusted root" is a silly answer to 1 because it's incredibly
difficult to remove sufficient trust from root and still have it be
trusted enough to be effective as root.  The trust bound up in root is
incredibly intertwined.  It would be far better to start by eliminating
the root user altogether and building up on the capabilities in a
granular fashion for this type of lockdown.
granular lockdown!?  sounds like SELinux.  But that certainly can't
solve the problems here...

I think your premise has a couple of problems.  First is how you chose
to word #2.  Lets reword it as:

What do we have to do to prevent Linux being used to attack Linux
which may lead to secure boot being useless.

If we accept that as #2, then we think, "What makes secure boot
useless"  or "What is the security goal as envisioned by secure boot."
 The goal of secure boot is to implement an operating system which
prevents uid==0 to ring 0 escalation.  That is the security policy
secure boot needs to not be completely useless.  And as it turns out,
that security policy is useful in other situations.
"untrusted root", if it can even be achieved, might be a sufficient
condition for 2 but it's way overkill for a necessary one.
But it is a condition, as specifically stated, that others have wanted
long before secure boot even came to rise.  I've talked with and
worked with a public cloud operator who wants to prevent even a
malicious root user from being able to run code in ring 0 inside their
VM.  The hope in that case was that in doing so they can indirectly
shrink the attack surface between virtual machine and hypervisor.
They hoped to limit the ways the guest could interact to only those
methods the linux kernel implemented.

They want to launch a vm running a kernel they chose and make sure
root inside the vm could not run some other kernel or run arbitrary
code in kernel space.  It's wasn't something they solved completely.
If it was, all of this secure boot work would be finished.  Which is
why we are having these discussions to understand all of the way that
you an Alan seem to have to get around the secure boot restrictions.
And look for solutions to retain functionality which meeting the
security goal of 'prevent uid=0 to ring 0 privilege escalation.

-Eric
Message details and related content
Hi!
quoted
But that doesn't really help me: untrusted root is an oxymoron.
Imagine you run windows and you've never heard of Linux.  You like
that only windows kernels can boot on your box and not those mean
nasty hacked up malware kernels.  Now some attacker manages to take
over your box because you clicked on that executable for young models
in skimpy bathing suits.  That executable rewrote your bootloader to
launch a very small carefully crafted Linux environment.  This
environment does nothing but launch a perfectly valid signed Linux
kernel, which gets a Windows environment all ready to launch after
resume and goes to sleep.  Now you have to hit the power button twice
every time you turn on your computer, weird, but Windows comes up, and
secureboot is still on, so you must be safe!
Ok, so you cripple kexec / suspend to disallow this, and then...


...attacker launches carefuly crafter Linux environment, that just launches
X and fullscreen wine.

Sure, timing may be slightly different, but Windows came up and secureboot is still
on.. so user happily enters his bank account details.

Could someone write down exact requirements for Linux kernel to be signed by Microsoft?
Because thats apparently what you want, and I don't think crippling kexec/suspend is
enough.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Message details and related content
On 11/01/2012 02:27 PM, Pavel Machek wrote:
Could someone write down exact requirements for Linux kernel to be signed by Microsoft?
Because thats apparently what you want, and I don't think crippling kexec/suspend is
enough.
As I understand it, the kernel won't be signed by Microsoft.

Rather, the bootloader will be signed by Microsoft and the vendors will be the ones that refuse to sign a kernel unless it is reasonably assured that it won't be used as an attack vector.

If you want fully-open behaviour it's still possible, you just need to turn off secure boot.

With secure boot enabled, then the kernel should refuse to let an unsigned kexec load new images, and kexec itself should refuse to load unsigned images.  Also the kernel would need to sign its "suspend-to-disk" images and refuse to resume unsigned images.

Presumably the signing key for the "suspend-to-disk" images would need to be stored somewhere that is not accessable even by root.  It's not clear to me how we would do this, but maybe it's possible with hardware support.

Chris
Message details and related content
On Thu, 2012-11-01 at 13:50 -0400, Eric Paris wrote:
On Thu, Nov 1, 2012 at 11:18 AM, James Bottomley
[off-list ref] wrote:
quoted
You're completely confusing two separate goals:

     1. Is it possible to use secure boot to implement a security policy
        on Linux
     2. What do we have to do anything to prevent Linux being used to
        attack windows which may lead to a revocation of the distro
        signing key.

"untrusted root" is a silly answer to 1 because it's incredibly
difficult to remove sufficient trust from root and still have it be
trusted enough to be effective as root.  The trust bound up in root is
incredibly intertwined.  It would be far better to start by eliminating
the root user altogether and building up on the capabilities in a
granular fashion for this type of lockdown.
granular lockdown!?  sounds like SELinux.  But that certainly can't
solve the problems here...

I think your premise has a couple of problems.  First is how you chose
to word #2.  Lets reword it as:

What do we have to do to prevent Linux being used to attack Linux
which may lead to secure boot being useless.
That's not really remotely related, is it?  Microsoft doesn't really
care about Linux on Linux attacks, so preventing or allowing them isn't
going to get a distro key revoked.

If we accept that as #2, then we think, "What makes secure boot
useless"  or "What is the security goal as envisioned by secure boot."
 The goal of secure boot is to implement an operating system which
prevents uid==0 to ring 0 escalation.  That is the security policy
secure boot needs to not be completely useless.  And as it turns out,
that security policy is useful in other situations.
Um, so all that is a rewording of what I said in 1 ... how do you take
advantage of secure boot, so you're re-conflating the issues.

Snip the rest because it doesn't really make sense in terms of getting
the key revoked.

James

Message details and related content
On Thu, Nov 01, 2012 at 09:03:20PM +0000, James Bottomley wrote:
On Thu, 2012-11-01 at 13:50 -0400, Eric Paris wrote:
quoted
What do we have to do to prevent Linux being used to attack Linux
which may lead to secure boot being useless.
That's not really remotely related, is it?  Microsoft doesn't really
care about Linux on Linux attacks, so preventing or allowing them isn't
going to get a distro key revoked.
Linux vendors may care about Linux on Linux attacks. It's all fun and 
games until Oracle get Microsoft to revoke Red Hat's signature.

-- 
Matthew Garrett | mjg59@srcf.ucam.org
Message details and related content
On Thu, 2012-11-01 at 21:06 +0000, Matthew Garrett wrote:
On Thu, Nov 01, 2012 at 09:03:20PM +0000, James Bottomley wrote:
quoted
On Thu, 2012-11-01 at 13:50 -0400, Eric Paris wrote:
quoted
What do we have to do to prevent Linux being used to attack Linux
which may lead to secure boot being useless.
That's not really remotely related, is it?  Microsoft doesn't really
care about Linux on Linux attacks, so preventing or allowing them isn't
going to get a distro key revoked.
Linux vendors may care about Linux on Linux attacks. It's all fun and 
games until Oracle get Microsoft to revoke Red Hat's signature.
I agree that's a possibility.  However, I think the court of public
opinion would pillory the first Commercial Linux Distribution that went
to Microsoft for the express purpose of revoking their competition's
right to boot.  It would be commercial suicide.

James


Message details and related content
On Thu, Nov 01, 2012 at 09:14:00PM +0000, James Bottomley wrote:
I agree that's a possibility.  However, I think the court of public
opinion would pillory the first Commercial Linux Distribution that went
to Microsoft for the express purpose of revoking their competition's
right to boot.  It would be commercial suicide.
Oracle are something of a vexatious litigant as far as the court of 
public opinion is concerned, but even without that it could be a 
customer who complains. If you're personally comfortable with a specific 
level of security here, that's fine - but it's completely reasonable for 
others to feel that there are valid technical and commercial concerns to 
do this properly.

-- 
Matthew Garrett | mjg59@srcf.ucam.org
Message details and related content
Linux vendors may care about Linux on Linux attacks. It's all fun and 
games until Oracle get Microsoft to revoke Red Hat's signature.
Fear uncertainty and doubt (and if you think Oracle are going to do that
I suspect your lawyers should deal with it)

Alan.
Message details and related content
On Thu, Nov 01, 2012 at 09:31:27PM +0000, Alan Cox wrote:
quoted
Linux vendors may care about Linux on Linux attacks. It's all fun and 
games until Oracle get Microsoft to revoke Red Hat's signature.
Fear uncertainty and doubt (and if you think Oracle are going to do that
I suspect your lawyers should deal with it)
Lawyers won't remove blacklist entries.

-- 
Matthew Garrett | mjg59@srcf.ucam.org
Message details and related content
On Thu, 1 Nov 2012 21:18:59 +0000
Matthew Garrett [off-list ref] wrote:
On Thu, Nov 01, 2012 at 09:14:00PM +0000, James Bottomley wrote:
quoted
I agree that's a possibility.  However, I think the court of public
opinion would pillory the first Commercial Linux Distribution that went
to Microsoft for the express purpose of revoking their competition's
right to boot.  It would be commercial suicide.
Oracle are something of a vexatious litigant as far as the court of 
public opinion is concerned, but even without that it could be a 
customer who complains. If you're personally comfortable with a specific 
level of security here, that's fine - but it's completely reasonable for 
others to feel that there are valid technical and commercial concerns to 
do this properly.
The main people who really really care about this the MS key stuff
is mostly irrelevant for as they won't use the Microsoft keys
anyway. Microsoft will have to provide signing to all sorts of other law
enforcement bodies as a responsible provider. If the FBI have a key no
other government security installation will have that key in their
systems. If the Chinese state has it I doubt the US government will be
too keen either.

All those official government trojans end up creating a big problem in the
trust department.

Alan
Message details and related content
On Thu, 1 Nov 2012 21:28:43 +0000
Matthew Garrett [off-list ref] wrote:
On Thu, Nov 01, 2012 at 09:31:27PM +0000, Alan Cox wrote:
quoted
quoted
Linux vendors may care about Linux on Linux attacks. It's all fun and 
games until Oracle get Microsoft to revoke Red Hat's signature.
Fear uncertainty and doubt (and if you think Oracle are going to do that
I suspect your lawyers should deal with it)
Lawyers won't remove blacklist entries.
Fear Uncertainty and Doubt

Courts do, injunctions do, the possibilty of getting caught with theirs
hands in the till does.

But I suspect your lawyers should also deal with public comments about
Oracle such as the one you've made before you make them in public 8)
Message details and related content
On Thu, Nov 01, 2012 at 09:37:51PM +0000, Alan Cox wrote:
On Thu, 1 Nov 2012 21:28:43 +0000
Matthew Garrett [off-list ref] wrote:
quoted
Lawyers won't remove blacklist entries.
Fear Uncertainty and Doubt

Courts do, injunctions do, the possibilty of getting caught with theirs
hands in the till does.
I think you've misunderstood. Blacklist updates are append only.

-- 
Matthew Garrett | mjg59@srcf.ucam.org
Message details and related content
On Thu, 1 Nov 2012 21:34:52 +0000
Matthew Garrett [off-list ref] wrote:
On Thu, Nov 01, 2012 at 09:37:51PM +0000, Alan Cox wrote:
quoted
On Thu, 1 Nov 2012 21:28:43 +0000
Matthew Garrett [off-list ref] wrote:
quoted
Lawyers won't remove blacklist entries.
Fear Uncertainty and Doubt

Courts do, injunctions do, the possibilty of getting caught with theirs
hands in the till does.
I think you've misunderstood. Blacklist updates are append only.
I think you've misunderstood - thats a technical detail that merely
alters the cost to the people who did something improper.

If Red Hat want to ship a kernel that is very very locked down - fine.
It's a business choice and maybe it'll sell to someone. The
implementation is non-offensive in its mechanism for everyone else so
technically I don't care, but the 'quiver before our new masters and lick
their boots' stuff isn't a technical (or sane business) approach so can
we cut the trying to FUD other people into doing what you believe your
new master requires.

Alan
Message details and related content
On Thu, Nov 01, 2012 at 09:58:17PM +0000, Alan Cox wrote:
On Thu, 1 Nov 2012 21:34:52 +0000
Matthew Garrett [off-list ref] wrote:
quoted
I think you've misunderstood. Blacklist updates are append only.
I think you've misunderstood - thats a technical detail that merely
alters the cost to the people who did something improper.
Winning a case is cold comfort if your software has been uninstallable 
for the years it took to get through the courts. If others want to take 
that risk, fine.

-- 
Matthew Garrett | mjg59@srcf.ucam.org
Message details and related content
On Thu, Nov 01, 2012 at 10:29:17AM -0400, Eric Paris wrote:
On Thu, Nov 1, 2012 at 5:59 AM, James Bottomley
[off-list ref] wrote:
quoted
But that doesn't really help me: untrusted root is an oxymoron.
Imagine you run windows and you've never heard of Linux.  You like
that only windows kernels can boot on your box and not those mean
nasty hacked up malware kernels.  Now some attacker manages to take
over your box because you clicked on that executable for young models
in skimpy bathing suits.  That executable rewrote your bootloader to
launch a very small carefully crafted Linux environment.  This
Rewrote bootloader on disk so that it gets executed next time? It
will not run as signature will not match.

Thanks
Vivek
Message details and related content
On Wed, Oct 31, 2012 at 03:02:01PM +0000, Matthew Garrett wrote:
On Wed, Oct 31, 2012 at 03:50:00PM +0100, Jiri Kosina wrote:
quoted
Reading stored memory image (potentially tampered before reboot) from disk 
is basically DMA-ing arbitrary data over the whole RAM. I am currently not 
able to imagine a scenario how this could be made "secure" (without 
storing private keys to sign the hibernation image on the machine itself 
which, well, doesn't sound secure either).
shim generates a public and private key. It hands the kernel the private 
key in a boot parameter and stores the public key in a boot variable. On 
suspend, the kernel signs the suspend image with that private key and 
discards it. On the next boot, shim generates a new key pair and hands 
the new private key to the kernel along with the old public key. The 
kernel verifies the suspend image before resuming it. The only way to 
subvert this would be to be able to access kernel memory directly, which 
means the attacker has already won.
"crash" utility has module which allows reading kernel memory. So leaking
this private key will be easier then you are thinking it to be.

Thanks
Vivek
Message details and related content
On Fri, Nov 02, 2012 at 11:30:48AM -0400, Vivek Goyal wrote:
"crash" utility has module which allows reading kernel memory. So leaking
this private key will be easier then you are thinking it to be.
That's not upstream, right?

-- 
Matthew Garrett | mjg59@srcf.ucam.org
Message details and related content
On Thu, Nov 01, 2012 at 03:02:25PM -0600, Chris Friesen wrote:
On 11/01/2012 02:27 PM, Pavel Machek wrote:
quoted
Could someone write down exact requirements for Linux kernel to be signed by Microsoft?
Because thats apparently what you want, and I don't think crippling kexec/suspend is
enough.
As I understand it, the kernel won't be signed by Microsoft.

Rather, the bootloader will be signed by Microsoft and the vendors
will be the ones that refuse to sign a kernel unless it is
reasonably assured that it won't be used as an attack vector.

If you want fully-open behaviour it's still possible, you just need
to turn off secure boot.

With secure boot enabled, then the kernel should refuse to let an
unsigned kexec load new images, and kexec itself should refuse to
load unsigned images.
Yep, good in theory. Now that basically means reimplementing kexec-tools
in kernel. That also means creating a new system call. It also
also means cutting down on future flexibility (assuming new system
call interface will be able to support existing features provided by
kernel). And it is lot of code in user space which needs to be
reimplemented in kernel and bloat kernel.

Keeping most of the logic in kexec-tools provided flexibility and keeps
kernel small. So now re-architect kexec and reverse a good design completely
for secureboot. It is a huge pain.

Thanks
Vivek
Message details and related content
On Fri, Nov 02, 2012 at 03:42:48PM +0000, Matthew Garrett wrote:
On Fri, Nov 02, 2012 at 11:30:48AM -0400, Vivek Goyal wrote:
quoted
"crash" utility has module which allows reading kernel memory. So leaking
this private key will be easier then you are thinking it to be.
That's not upstream, right?
Yes, checked with Dave, it is not upstream. Well, still it is a concern
for distro kernel.

So if we keep private key in kernel, looks like we shall have to disable
one more feature in secureboot mode.

Thanks
Vivek
Message details and related content
On Fri, 2 Nov 2012, Vivek Goyal wrote:
quoted
quoted
"crash" utility has module which allows reading kernel memory. So leaking
this private key will be easier then you are thinking it to be.
That's not upstream, right?
Yes, checked with Dave, it is not upstream. Well, still it is a concern
for distro kernel.
Well, that's about /dev/crash, right?

How about /proc/kcore?

-- 
Jiri Kosina
SUSE Labs
Message details and related content
On Thu 2012-11-01 15:02:25, Chris Friesen wrote:
On 11/01/2012 02:27 PM, Pavel Machek wrote:
quoted
Could someone write down exact requirements for Linux kernel to be signed by Microsoft?
Because thats apparently what you want, and I don't think crippling kexec/suspend is
enough.
As I understand it, the kernel won't be signed by Microsoft.
Rather, the bootloader will be signed by Microsoft and the vendors
will be the ones that refuse to sign a kernel unless it is
reasonably assured that it won't be used as an attack vector.
Yes. So can someone write down what "used as an attack vector" means?

Because, AFAICT, Linux kernel is _designed_ to work as an attact
vector. We intentionally support wine, and want to keep that support.
With secure boot enabled, then the kernel should refuse to let an
unsigned kexec load new images, and kexec itself should refuse to
load unsigned images.  Also the kernel would need to sign its
"suspend-to-disk" images and refuse to resume unsigned images.
I believe that attacking Windows using wine is easier than using
suspend-to-disk.

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Message details and related content
On Fri, Nov 2, 2012 at 9:52 AM, Vivek Goyal [off-list ref] wrote:
On Fri, Nov 02, 2012 at 03:42:48PM +0000, Matthew Garrett wrote:
quoted
On Fri, Nov 02, 2012 at 11:30:48AM -0400, Vivek Goyal wrote:
quoted
"crash" utility has module which allows reading kernel memory. So leaking
this private key will be easier then you are thinking it to be.
That's not upstream, right?
Yes, checked with Dave, it is not upstream. Well, still it is a concern
for distro kernel.

So if we keep private key in kernel, looks like we shall have to disable
one more feature in secureboot mode.
I have been following parts of this thread and beginning to think,
"Are we over engineering" the solution for secureboot. Do we have a
list of what is must to meet the Spec.? At this point, Linux
secureboot solution is sounding so pervasive and will impact every
aspect of Linux user's and kernel developer's use pattern. So far I
picked up on the following:

Kernel need to be signed.
firmware kernel loads needs to be signed
What else?

Is there a list of what all needs to be signed? I am interested in
seeing a list of requirements. At some point, OS will be so secure
that, will it become so complex to run anything on it and continue to
do development as we are used to doing today? I don't pretend to know
much about secureboot, and I am asking as a concerned Linux user, and
kernel developer.

-- Shuah
Message details and related content
On Fri, 2012-11-02 at 17:33 +0100, Pavel Machek wrote:
On Thu 2012-11-01 15:02:25, Chris Friesen wrote:
quoted
On 11/01/2012 02:27 PM, Pavel Machek wrote:
quoted
Could someone write down exact requirements for Linux kernel to be signed by Microsoft?
Because thats apparently what you want, and I don't think crippling kexec/suspend is
enough.
As I understand it, the kernel won't be signed by Microsoft.
quoted
Rather, the bootloader will be signed by Microsoft and the vendors
will be the ones that refuse to sign a kernel unless it is
reasonably assured that it won't be used as an attack vector.
Yes. So can someone write down what "used as an attack vector" means?

Because, AFAICT, Linux kernel is _designed_ to work as an attact
vector. We intentionally support wine, and want to keep that support.
I think there's a variety of opinions on this one.

My definition is that you can construct a signed boot system from the
components delivered with a Linux distribution that will fairly
invisibly chain load a hacked version of windows.  Thus allowing the
windows user to think they have a chain of trust to the UEFI firmware
when, in fact, they haven't.

The first question is how many compromises do you need.  Without
co-operation from windows, you don't get to install something in the
boot system, so if you're looking for a single compromise vector, the
only realistic attack is to trick the user into booting a hacked linux
system from USB or DVD.

There's also a lot of debate around "fairly invisibly".  If your hack
involves shim->grub->linux->windows, that's a fairly long boot process
with time for the user to notice something.

Obviously, a boot loader that breaks the trust chain is ideal as a
windows attack vector, which is why most pre bootloaders on virgin
systems do a present user test (tell the user what they're doing and ask
permission to continue).  I really think that if the shim+MOK system
always paused and asked to continue if the MOK Boot Services variables
aren't present (i.e. it's a first boot virgin system), we've solved the
windows attack vector problem, and we can move on from this rather
sterile debate to think of how we can use secure boot to enhance Linux
security for the machine owner.

James

Message details and related content
On Fri, Nov 02, 2012 at 04:52:44PM +0000, James Bottomley wrote:
The first question is how many compromises do you need.  Without
co-operation from windows, you don't get to install something in the
boot system, so if you're looking for a single compromise vector, the
only realistic attack is to trick the user into booting a hacked linux
system from USB or DVD.
You run a binary. It pops up a box saying "Windows needs your permission 
to continue", just like almost every other Windows binary that's any 
use. Done.

-- 
Matthew Garrett | mjg59@srcf.ucam.org
Message details and related content
On 11/02/2012 09:48 AM, Vivek Goyal wrote:
On Thu, Nov 01, 2012 at 03:02:25PM -0600, Chris Friesen wrote:
quoted
With secure boot enabled, then the kernel should refuse to let an
unsigned kexec load new images, and kexec itself should refuse to
load unsigned images.
Yep, good in theory. Now that basically means reimplementing kexec-tools
in kernel.
Maybe I'm missing something, but couldn't the vendors provide a signed kexec?  Why does extra stuff need to be pushed into the kernel?

Chris
Message details and related content
On Fri, Nov 02, 2012 at 10:54:50AM -0600, Chris Friesen wrote:
On 11/02/2012 09:48 AM, Vivek Goyal wrote:
quoted
On Thu, Nov 01, 2012 at 03:02:25PM -0600, Chris Friesen wrote:
quoted
quoted
With secure boot enabled, then the kernel should refuse to let an
unsigned kexec load new images, and kexec itself should refuse to
load unsigned images.
Yep, good in theory. Now that basically means reimplementing kexec-tools
in kernel.
Maybe I'm missing something, but couldn't the vendors provide a
signed kexec?  Why does extra stuff need to be pushed into the
kernel?
Bingo. Join us in following mail thread for all the gory details and
extra work required to make signing of user space processes work.

https://lkml.org/lkml/2012/10/24/451

In a nut-shell, there is no infrastructure currently for signing user
space processes and verifying it (like module signing). Then if you
just sign select user processes and not whole of the user space, then
it brings extra complications with linking shared objects and being
able to modify the code of process etc.

So yes, being able to sign /sbin/kexec will be great. Looks like that
itself will require lot of work and is not that straight forward.

Thanks
Vivek
Message details and related content
On Thu, Nov 01, 2012 at 01:50:08PM -0400, Eric Paris wrote:

[..]
I've talked with and
worked with a public cloud operator who wants to prevent even a
malicious root user from being able to run code in ring 0 inside their
VM.  The hope in that case was that in doing so they can indirectly
shrink the attack surface between virtual machine and hypervisor.
They hoped to limit the ways the guest could interact to only those
methods the linux kernel implemented.

They want to launch a vm running a kernel they chose and make sure
root inside the vm could not run some other kernel or run arbitrary
code in kernel space.  It's wasn't something they solved completely.
If it was, all of this secure boot work would be finished.  Which is
why we are having these discussions to understand all of the way that
you an Alan seem to have to get around the secure boot restrictions.
And look for solutions to retain functionality which meeting the
security goal of 'prevent uid=0 to ring 0 privilege escalation.
So will secure boot help with above use case you mentioned? I think
until and unless you lock down user space too on host, it will not be
possible.

On the flip side, one might be able to launch windows in qemu (compromised
noe) and might fool user into thinking it is booted natively and steal
login credentials and other stuff.

Thanks
Vivek
Message details and related content
On Fri, 2012-11-02 at 16:54 +0000, Matthew Garrett wrote:
On Fri, Nov 02, 2012 at 04:52:44PM +0000, James Bottomley wrote:
quoted
The first question is how many compromises do you need.  Without
co-operation from windows, you don't get to install something in the
boot system, so if you're looking for a single compromise vector, the
only realistic attack is to trick the user into booting a hacked linux
system from USB or DVD.
You run a binary. It pops up a box saying "Windows needs your permission 
to continue", just like almost every other Windows binary that's any 
use. Done.
And if all the loaders do some type of present user test on a virgin
system, how do you propose to get that message up there?

James

Message details and related content
On Fri, Nov 02, 2012 at 05:48:31PM +0000, James Bottomley wrote:
On Fri, 2012-11-02 at 16:54 +0000, Matthew Garrett wrote:
quoted
On Fri, Nov 02, 2012 at 04:52:44PM +0000, James Bottomley wrote:
quoted
The first question is how many compromises do you need.  Without
co-operation from windows, you don't get to install something in the
boot system, so if you're looking for a single compromise vector, the
only realistic attack is to trick the user into booting a hacked linux
system from USB or DVD.
You run a binary. It pops up a box saying "Windows needs your permission 
to continue", just like almost every other Windows binary that's any 
use. Done.
And if all the loaders do some type of present user test on a virgin
system, how do you propose to get that message up there?
? That's the message generated by the Windows access control mechanism 
when you run a binary that requests elevated privileges.

-- 
Matthew Garrett | mjg59@srcf.ucam.org
Message details and related content
On Fri, 2012-11-02 at 17:54 +0000, Matthew Garrett wrote:
On Fri, Nov 02, 2012 at 05:48:31PM +0000, James Bottomley wrote:
quoted
On Fri, 2012-11-02 at 16:54 +0000, Matthew Garrett wrote:
quoted
On Fri, Nov 02, 2012 at 04:52:44PM +0000, James Bottomley wrote:
quoted
The first question is how many compromises do you need.  Without
co-operation from windows, you don't get to install something in the
boot system, so if you're looking for a single compromise vector, the
only realistic attack is to trick the user into booting a hacked linux
system from USB or DVD.
You run a binary. It pops up a box saying "Windows needs your permission 
to continue", just like almost every other Windows binary that's any 
use. Done.
And if all the loaders do some type of present user test on a virgin
system, how do you propose to get that message up there?
? That's the message generated by the Windows access control mechanism 
when you run a binary that requests elevated privileges.
So that's a windows attack vector using a windows binary? I can't really
see how it's relevant to the secure boot discussion then.

James


Message details and related content
On Fri, Nov 02, 2012 at 05:57:38PM +0000, James Bottomley wrote:
On Fri, 2012-11-02 at 17:54 +0000, Matthew Garrett wrote:
quoted
? That's the message generated by the Windows access control mechanism 
when you run a binary that requests elevated privileges.
So that's a windows attack vector using a windows binary? I can't really
see how it's relevant to the secure boot discussion then.
A user runs a binary that elevates itself to admin. Absent any flaws in 
Windows (cough), that should be all it can do in a Secure Boot world. 
But if you can drop a small trusted Linux system in there and use that 
to boot a compromised Windows kernel, it can make itself persistent.

-- 
Matthew Garrett | mjg59@srcf.ucam.org
Message details and related content
On Fri, Nov 02, 2012 at 05:22:41PM +0100, Jiri Kosina wrote:
On Fri, 2 Nov 2012, Vivek Goyal wrote:
quoted
quoted
quoted
"crash" utility has module which allows reading kernel memory. So leaking
this private key will be easier then you are thinking it to be.
That's not upstream, right?
Yes, checked with Dave, it is not upstream. Well, still it is a concern
for distro kernel.
Well, that's about /dev/crash, right?
Yes, I was talking about /dev/crash.
How about /proc/kcore?
Yes, we will have to lock down /proc/kcore too if we go the private
key solution way.

Thanks
Vivek
Message details and related content
I know I started it, but Windows really isn't necessary to see value,
even if it is what pushed the timing.

A user installs a package as root.  Absent any flaws in the Linux
kernel (cough) that should be all it can do in a Secure Boot world.
But if you can drop a small trusted Linux system in there and use that
to boot a compromised Linux kernel, it can make itself persistent.

And like I said, I know there are cloud providers out there who want
EXACTLY this type of system.  One in which root in the guest is
untrusted and they want to keep them out of ring 0.
Message details and related content
On Fri, 2012-11-02 at 18:04 +0000, Matthew Garrett wrote:
On Fri, Nov 02, 2012 at 05:57:38PM +0000, James Bottomley wrote:
quoted
On Fri, 2012-11-02 at 17:54 +0000, Matthew Garrett wrote:
quoted
? That's the message generated by the Windows access control mechanism 
when you run a binary that requests elevated privileges.
So that's a windows attack vector using a windows binary? I can't really
see how it's relevant to the secure boot discussion then.
A user runs a binary that elevates itself to admin. Absent any flaws in 
Windows (cough), that should be all it can do in a Secure Boot world. 
But if you can drop a small trusted Linux system in there and use that 
to boot a compromised Windows kernel, it can make itself persistent.
We seem to be talking past each other.  Assume you managed to install a
Linux boot system on the windows machine.  If the linux boot requires
present user on first boot (either because the key of the bootloader
isn't in db or because the MOK database isn't initialised), you still
don't have a compromise because the loader won't start automatically.

James


Message details and related content
On Fri, Nov 02, 2012 at 11:38:23PM +0000, James Bottomley wrote:
On Fri, 2012-11-02 at 18:04 +0000, Matthew Garrett wrote:
quoted
A user runs a binary that elevates itself to admin. Absent any flaws in 
Windows (cough), that should be all it can do in a Secure Boot world. 
But if you can drop a small trusted Linux system in there and use that 
to boot a compromised Windows kernel, it can make itself persistent.
We seem to be talking past each other.  Assume you managed to install a
Linux boot system on the windows machine.  If the linux boot requires
present user on first boot (either because the key of the bootloader
isn't in db or because the MOK database isn't initialised), you still
don't have a compromise because the loader won't start automatically.
Why would an attacker use one of those Linux systems? There's going to 
be plenty available that don't have that restriction.

-- 
Matthew Garrett | mjg59@srcf.ucam.org
Message details and related content
On Sat, 2012-11-03 at 00:22 +0000, Matthew Garrett wrote:
On Fri, Nov 02, 2012 at 11:38:23PM +0000, James Bottomley wrote:
quoted
On Fri, 2012-11-02 at 18:04 +0000, Matthew Garrett wrote:
quoted
A user runs a binary that elevates itself to admin. Absent any flaws in 
Windows (cough), that should be all it can do in a Secure Boot world. 
But if you can drop a small trusted Linux system in there and use that 
to boot a compromised Windows kernel, it can make itself persistent.
We seem to be talking past each other.  Assume you managed to install a
Linux boot system on the windows machine.  If the linux boot requires
present user on first boot (either because the key of the bootloader
isn't in db or because the MOK database isn't initialised), you still
don't have a compromise because the loader won't start automatically.
Why would an attacker use one of those Linux systems? There's going to 
be plenty available that don't have that restriction.
It's called best practices.  If someone else releases something that
doesn't conform to them, then it's their signing key in jeopardy, not
yours.  You surely must see that the goal of securing "everything"
against "anything" isn't achievable because if someone releases a
bootloader not conforming to the best practices, why would they have
bothered to include your secure boot lockdowns in their kernel.  In
other words, you lost ab initio, so it's pointless to cite this type of
thing as a rationale for a kernel lockdown patch.

James


Message details and related content
On Sat, Nov 03, 2012 at 12:03:56PM +0000, James Bottomley wrote:
On Sat, 2012-11-03 at 00:22 +0000, Matthew Garrett wrote:
quoted
Why would an attacker use one of those Linux systems? There's going to 
be plenty available that don't have that restriction.
It's called best practices.  If someone else releases something that
doesn't conform to them, then it's their signing key in jeopardy, not
yours.  You surely must see that the goal of securing "everything"
against "anything" isn't achievable because if someone releases a
bootloader not conforming to the best practices, why would they have
bothered to include your secure boot lockdowns in their kernel.  In
other words, you lost ab initio, so it's pointless to cite this type of
thing as a rationale for a kernel lockdown patch.
I... what? Our signed bootloader will boot our signed kernel without any 
physically present end-user involvement. We therefore need to make it 
as difficult as practically possible for an attacker to use our signed 
bootloader and our signed kernel as an attack vector against other 
operating systems, which includes worrying about hibernate and kexec. If 
people want to support this use case then patches to deal with that need 
to be present in the upstream kernel.

-- 
Matthew Garrett | mjg59@srcf.ucam.org
Message details and related content
On Sat, 2012-11-03 at 13:46 +0000, Matthew Garrett wrote:
On Sat, Nov 03, 2012 at 12:03:56PM +0000, James Bottomley wrote:
quoted
On Sat, 2012-11-03 at 00:22 +0000, Matthew Garrett wrote:
quoted
Why would an attacker use one of those Linux systems? There's going to 
be plenty available that don't have that restriction.
It's called best practices.  If someone else releases something that
doesn't conform to them, then it's their signing key in jeopardy, not
yours.  You surely must see that the goal of securing "everything"
against "anything" isn't achievable because if someone releases a
bootloader not conforming to the best practices, why would they have
bothered to include your secure boot lockdowns in their kernel.  In
other words, you lost ab initio, so it's pointless to cite this type of
thing as a rationale for a kernel lockdown patch.
I... what? Our signed bootloader will boot our signed kernel without any 
physically present end-user involvement. We therefore need to make it 
as difficult as practically possible for an attacker to use our signed 
bootloader and our signed kernel as an attack vector against other 
operating systems, which includes worrying about hibernate and kexec. If 
people want to support this use case then patches to deal with that need 
to be present in the upstream kernel.
Right, but what I'm telling you is that by deciding to allow automatic
first boot, you're causing the windows attack vector problem.  You could
easily do a present user test only on first boot which would eliminate
it.  Instead, we get all of this.

By analogy, it's like an architect trying to design a house to be secure
without a front door lock.  If you just secure the front door, you don't
necessarily need all the internal security.  There is certainly a market
for houses with good internal security, but not everyone wants the
hassle, so trying to make every house that way is counterproductive.
It's also not so useful to the people who want specialist internal
security because they're willing to use much more specialised systems
than you have to deploy generally.

In short, if you'd just separate the problem into

     1. What do we have to do to prevent Linux being used to attack
        windows and thus getting our key revoked from,
     2. What specialised systems can we put in place to enhance linux
        security with secure boot for those who want it

It becomes a lot simpler than trying to do a one size fits all solution.

James

Message details and related content
On Fri, 2 Nov 2012, Vivek Goyal wrote:
quoted
With secure boot enabled, then the kernel should refuse to let an
unsigned kexec load new images, and kexec itself should refuse to
load unsigned images.
Yep, good in theory. Now that basically means reimplementing kexec-tools
in kernel. 
Why is "when kernel has been securely booted, the in-kernel kexec 
mechanism has to verify the signature of the supplied image before 
kexecing it" not enough? (basically the same thing we are doing for signed 
modules already).

-- 
Jiri Kosina
SUSE Labs
Message details and related content
On Sat, Nov 03, 2012 at 10:56:40PM +0000, James Bottomley wrote:
On Sat, 2012-11-03 at 13:46 +0000, Matthew Garrett wrote:
quoted
I... what? Our signed bootloader will boot our signed kernel without any 
physically present end-user involvement. We therefore need to make it 
as difficult as practically possible for an attacker to use our signed 
bootloader and our signed kernel as an attack vector against other 
operating systems, which includes worrying about hibernate and kexec. If 
people want to support this use case then patches to deal with that need 
to be present in the upstream kernel.
Right, but what I'm telling you is that by deciding to allow automatic
first boot, you're causing the windows attack vector problem.  You could
easily do a present user test only on first boot which would eliminate
it.  Instead, we get all of this.
Your definition of "Best practices" is "Automated installs are 
impossible"? Have you ever actually spoken to a user?

-- 
Matthew Garrett | mjg59@srcf.ucam.org
Message details and related content
On Sun, 2012-11-04 at 04:28 +0000, Matthew Garrett wrote:
On Sat, Nov 03, 2012 at 10:56:40PM +0000, James Bottomley wrote:
quoted
On Sat, 2012-11-03 at 13:46 +0000, Matthew Garrett wrote:
quoted
I... what? Our signed bootloader will boot our signed kernel without any 
physically present end-user involvement. We therefore need to make it 
as difficult as practically possible for an attacker to use our signed 
bootloader and our signed kernel as an attack vector against other 
operating systems, which includes worrying about hibernate and kexec. If 
people want to support this use case then patches to deal with that need 
to be present in the upstream kernel.
Right, but what I'm telling you is that by deciding to allow automatic
first boot, you're causing the windows attack vector problem.  You could
easily do a present user test only on first boot which would eliminate
it.  Instead, we get all of this.
Your definition of "Best practices" is "Automated installs are 
impossible"? Have you ever actually spoken to a user?
Are you sure you've spoken to the right users if you think they use a
distro boot system to do automated installs?

I've actually had more than enough experience with automated installs
over my career: they're either done by paying someone or using a
provisioning system.  In either case, they provision a static image and
boot environment description, including EFI boot services variables, so
you can provision a default MOK database if you want the ignition image
not to pause on firstboot.

There is obviously the question of making the provisioning systems
secure, but it's a separate one from making boot secure.

James

Message details and related content
On Sun 2012-11-04 04:28:02, Matthew Garrett wrote:
On Sat, Nov 03, 2012 at 10:56:40PM +0000, James Bottomley wrote:
quoted
On Sat, 2012-11-03 at 13:46 +0000, Matthew Garrett wrote:
quoted
I... what? Our signed bootloader will boot our signed kernel without any 
physically present end-user involvement. We therefore need to make it 
as difficult as practically possible for an attacker to use our signed 
bootloader and our signed kernel as an attack vector against other 
operating systems, which includes worrying about hibernate and kexec. If 
people want to support this use case then patches to deal with that need 
to be present in the upstream kernel.
Right, but what I'm telling you is that by deciding to allow automatic
first boot, you're causing the windows attack vector problem.  You could
easily do a present user test only on first boot which would eliminate
it.  Instead, we get all of this.
Your definition of "Best practices" is "Automated installs are 
impossible"? Have you ever actually spoken to a user?
Always polite Matthew...

Anyway, problem with introducing random signatures all over the kernel
is that it does not _work_. You'll end up signing all the userspace,
too. So far you want to sign kexec, soon you'll discover you need to
sign s2disk, too, and then you realize X, wine and dosemu needs the
same treatment. fwvm95 comes next.

								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Message details and related content
On Sun, Nov 04, 2012 at 09:14:47AM +0000, James Bottomley wrote:
I've actually had more than enough experience with automated installs
over my career: they're either done by paying someone or using a
provisioning system.  In either case, they provision a static image and
boot environment description, including EFI boot services variables, so
you can provision a default MOK database if you want the ignition image
not to pause on firstboot.
And now you've moved the attack vector to a copy of your provisioning 
system instead.
There is obviously the question of making the provisioning systems
secure, but it's a separate one from making boot secure.
You don't get to punt on making the kernel secure by simply asserting 
that some other system can be secure instead. The chain of trust needs 
to go all the way back - if your security model is based on all installs 
needing a physically present end user, all installs need a physically 
present end user. That's not acceptable, so we need a different security 
model.

-- 
Matthew Garrett | mjg59@srcf.ucam.org
Message details and related content
On Sun, 2012-11-04 at 13:52 +0000, Matthew Garrett wrote:
On Sun, Nov 04, 2012 at 09:14:47AM +0000, James Bottomley wrote:
quoted
I've actually had more than enough experience with automated installs
over my career: they're either done by paying someone or using a
provisioning system.  In either case, they provision a static image and
boot environment description, including EFI boot services variables, so
you can provision a default MOK database if you want the ignition image
not to pause on firstboot.
And now you've moved the attack vector to a copy of your provisioning 
system instead.
Well, no, it always exists: a lot of provisioning systems install efi
(or previously dos) based agents not linux kernels.  However it's a
different vector since the efi agents tend to want to PXE boot and
contact the image server.
quoted
There is obviously the question of making the provisioning systems
secure, but it's a separate one from making boot secure.
You don't get to punt on making the kernel secure by simply asserting 
that some other system can be secure instead. The chain of trust needs 
to go all the way back - if your security model is based on all installs 
needing a physically present end user, all installs need a physically 
present end user. That's not acceptable, so we need a different security 
model.
I didn't.  I advocated a simple security model which you asserted
wouldn't allow unattended installs, so I explained how they could be
done.  

James

Message details and related content
On Mon, Nov 05, 2012 at 09:20:17AM +0100, James Bottomley wrote:
On Sun, 2012-11-04 at 13:52 +0000, Matthew Garrett wrote:
quoted
You don't get to punt on making the kernel secure by simply asserting 
that some other system can be secure instead. The chain of trust needs 
to go all the way back - if your security model is based on all installs 
needing a physically present end user, all installs need a physically 
present end user. That's not acceptable, so we need a different security 
model.
I didn't.  I advocated a simple security model which you asserted
wouldn't allow unattended installs, so I explained how they could be
done.  
You've explained that a hypothetical piece of software could handle key 
provisioning without providing any explanation for how it would be able 
to do so in a secure manner.

-- 
Matthew Garrett | mjg59@srcf.ucam.org
Message details and related content
At Thu, 1 Nov 2012 13:18:49 +0000,
Alan Cox wrote:
quoted
I think it make sense because the private key is still protected by
signer. Any hacker who modified firmware is still need use private key
to generate signature, but hacker's private key is impossible to match
with the public key that kernel used to verify firmware.

And, I afraid we have no choice that we need put the firmware signature
in a separate file. Contacting with those company's legal department
will be very time-consuming, and I am not sure all company will agree we
put the signature with firmware then distribute.
Then you'd better stop storing it on disk because your disk drive is FEC
encoding it and adding a CRC 8)

It does want checking with a lawyer but my understanding is that if you
have a file which is a package that contains the firmware and a signature
then there is not generally a problem, any more than putting it in an RPM
file - it's packaging/aggregation. This should be referred to the Linux
Foundation folks perhaps - no point designing something badly to work
around a non existant issue.

Also the interface needs to consider that a lot of device firmware is
already signed. Nobody notices because they don't ever try and do their
own thus many drivers don't need extra signatures in fact.
Besides the legal concern, embedding the signature into the firmware
makes the file incompatible with old kernel that has no support for
signed firmware.  That's the reason I put the files into a new
location in my test patch, /lib/firmware/signed/.  Having a separate
signature file would make this easier.

I cooked again quickly firmware loader code for the separate signature
files.  I'm going to send a series of test patches.


thanks,

Takashi

[PATCH RFC 0/4] Add firmware signature file check

Revisions (2)
  1. rfc current
  2. v2 [diff against previous]
Message details and related content
Hi,

this is a patch series to add the support for firmware signature
check.  At this time, the kernel checks extra signature file (*.sig)
for each firmware, instead of embedded signature.
It's just a quick hack using the existing module signing mechanism,
thus provided only as a proof of concept for now.

To be noted, it doesn't support the firmwares via udev but only the
direct loading, and the check for built-in firmware is missing, too.


Takashi

[PATCH RFC 1/4] scripts/sign-file: Allow specifying hash algorithm via -a option

Message details and related content
Signed-off-by: Takashi Iwai <redacted>
---
 scripts/sign-file | 57 ++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 40 insertions(+), 17 deletions(-)
diff --git a/scripts/sign-file b/scripts/sign-file
index 87ca59d..45c771d 100755
--- a/scripts/sign-file
+++ b/scripts/sign-file
@@ -4,21 +4,31 @@
 #
 # Format:
 #
-#	./scripts/sign-file [-v] <key> <x509> <module> [<dest>]
+#	./scripts/sign-file [-v] [-a algo] <key> <x509> <module> [<dest>]
 #
 #
 use strict;
 use FileHandle;
 use IPC::Open2;
+use Getopt::Long;
 
-my $verbose = 0;
-if ($#ARGV >= 0 && $ARGV[0] eq "-v") {
-    $verbose = 1;
-    shift;
+sub usage()
+{
+    print "Format: ./scripts/sign-file [options] <key> <x509> <module> [<dest>]
+    -v       verbose output
+    -a algo  specify hash algorithm
+";
+    exit;
 }
 
-die "Format: ./scripts/sign-file [-v] <key> <x509> <module> [<dest>]\n"
-    if ($#ARGV != 2 && $#ARGV != 3);
+my $verbose = 0;
+my $hashalgo = "";
+
+GetOptions(
+    'v|verbose' => \$verbose,
+    'a|algo=s' => \$hashalgo) || usage();
+
+usage() if ($#ARGV != 2 && $#ARGV != 3);
 
 my $private_key = $ARGV[0];
 my $x509 = $ARGV[1];
@@ -32,10 +42,7 @@ die "Can't read module\n" unless (-r $module);
 #
 # Read the kernel configuration
 #
-my %config = (
-    CONFIG_MODULE_SIG_SHA512 => 1
-    );
-
+my %config;
 if (-r ".config") {
     open(FD, "<.config") || die ".config";
     while (<FD>) {
@@ -46,6 +53,22 @@ if (-r ".config") {
     close(FD);
 }
 
+if ($hashalgo eq "") {
+    if (exists $config{"CONFIG_MODULE_SIG_SHA1"}) {
+	$hashalgo="sha1";
+    } elsif (exists $config{"CONFIG_MODULE_SIG_SHA224"}) {
+	$hashalgo="sha224";
+    } elsif (exists $config{"CONFIG_MODULE_SIG_SHA256"}) {
+	$hashalgo="sha256";
+    } elsif (exists $config{"CONFIG_MODULE_SIG_SHA384"}) {
+	$hashalgo="sha384";
+    } elsif (exists $config{"CONFIG_MODULE_SIG_SHA512"}) {
+	$hashalgo="sha512";
+    } else {
+	die "Can't determine hash algorithm";
+    }
+}
+
 #
 # Function to read the contents of a file into a variable.
 #
@@ -322,35 +345,35 @@ my $id_type = 1;	# Identifier type: X.509
 # Digest the data
 #
 my ($dgst, $prologue) = ();
-if (exists $config{"CONFIG_MODULE_SIG_SHA1"}) {
+if ($hashalgo eq "sha1") {
     $prologue = pack("C*",
 		     0x30, 0x21, 0x30, 0x09, 0x06, 0x05,
 		     0x2B, 0x0E, 0x03, 0x02, 0x1A,
 		     0x05, 0x00, 0x04, 0x14);
     $dgst = "-sha1";
     $hash = 2;
-} elsif (exists $config{"CONFIG_MODULE_SIG_SHA224"}) {
+} elsif ($hashalgo eq "sha224") {
     $prologue = pack("C*",
 		     0x30, 0x2d, 0x30, 0x0d, 0x06, 0x09,
 		     0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04,
 		     0x05, 0x00, 0x04, 0x1C);
     $dgst = "-sha224";
     $hash = 7;
-} elsif (exists $config{"CONFIG_MODULE_SIG_SHA256"}) {
+} elsif ($hashalgo eq "sha256") {
     $prologue = pack("C*",
 		     0x30, 0x31, 0x30, 0x0d, 0x06, 0x09,
 		     0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01,
 		     0x05, 0x00, 0x04, 0x20);
     $dgst = "-sha256";
     $hash = 4;
-} elsif (exists $config{"CONFIG_MODULE_SIG_SHA384"}) {
+} elsif ($hashalgo eq "sha384") {
     $prologue = pack("C*",
 		     0x30, 0x41, 0x30, 0x0d, 0x06, 0x09,
 		     0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02,
 		     0x05, 0x00, 0x04, 0x30);
     $dgst = "-sha384";
     $hash = 5;
-} elsif (exists $config{"CONFIG_MODULE_SIG_SHA512"}) {
+} elsif ($hashalgo eq "sha512") {
     $prologue = pack("C*",
 		     0x30, 0x51, 0x30, 0x0d, 0x06, 0x09,
 		     0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03,
@@ -358,7 +381,7 @@ if (exists $config{"CONFIG_MODULE_SIG_SHA1"}) {
     $dgst = "-sha512";
     $hash = 6;
 } else {
-    die "Can't determine hash algorithm";
+    die "Invalid hash algorithm $hashalgo";
 }
 
 #
-- 
1.8.0

[PATCH RFC 2/4] scripts/sign-file: Support firmware signing

Message details and related content
Add -f option to give a firmware signature file.

Signed-off-by: Takashi Iwai <redacted>
---
 scripts/sign-file | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)
diff --git a/scripts/sign-file b/scripts/sign-file
index 45c771d..c1c96e7 100755
--- a/scripts/sign-file
+++ b/scripts/sign-file
@@ -4,7 +4,7 @@
 #
 # Format:
 #
-#	./scripts/sign-file [-v] [-a algo] <key> <x509> <module> [<dest>]
+#	./scripts/sign-file [-v] [-f] [-a algo] <key> <x509> <module> [<dest>]
 #
 #
 use strict;
@@ -16,16 +16,19 @@ sub usage()
 {
     print "Format: ./scripts/sign-file [options] <key> <x509> <module> [<dest>]
     -v       verbose output
+    -f       create a firmware signature file
     -a algo  specify hash algorithm
 ";
     exit;
 }
 
 my $verbose = 0;
+my $sign_fw = 0;
 my $hashalgo = "";
 
 GetOptions(
     'v|verbose' => \$verbose,
+    'f|firmware' => \$sign_fw,
     'a|algo=s' => \$hashalgo) || usage();
 
 usage() if ($#ARGV != 2 && $#ARGV != 3);
@@ -33,11 +36,12 @@ usage() if ($#ARGV != 2 && $#ARGV != 3);
 my $private_key = $ARGV[0];
 my $x509 = $ARGV[1];
 my $module = $ARGV[2];
-my $dest = ($#ARGV == 3) ? $ARGV[3] : $ARGV[2] . "~";
+my $dest = $ARGV[3] ? $ARGV[3] : $ARGV[2] . ".sig";
+my $mode_name = $sign_fw ? "firmware" : "module";
 
 die "Can't read private key\n" unless (-r $private_key);
 die "Can't read X.509 certificate\n" unless (-r $x509);
-die "Can't read module\n" unless (-r $module);
+die "Can't read $mode_name\n" unless (-r $module);
 
 #
 # Read the kernel configuration
@@ -416,7 +420,9 @@ die "openssl rsautl died: $?" if ($? >> 8);
 #
 my $unsigned_module = read_file($module);
 
-my $magic_number = "~Module signature appended~\n";
+my $magic_number = $sign_fw ? 
+    "~Linux firmware signature~\n" :
+    "~Module signature appended~\n";
 
 my $info = pack("CCCCCxxxN",
 		$algo, $hash, $id_type,
@@ -425,7 +431,7 @@ my $info = pack("CCCCCxxxN",
 		length($signature));
 
 if ($verbose) {
-    print "Size of unsigned module: ", length($unsigned_module), "\n";
+    print "Size of unsigned $mode_name: ", length($unsigned_module), "\n";
     print "Size of signer's name  : ", length($signers_name), "\n";
     print "Size of key identifier : ", length($key_identifier), "\n";
     print "Size of signature      : ", length($signature), "\n";
@@ -437,7 +443,16 @@ if ($verbose) {
 
 open(FD, ">$dest") || die $dest;
 binmode FD;
-print FD
+if ($sign_fw) {
+    print FD
+    $magic_number,
+    $info,
+    $signers_name,
+    $key_identifier,
+    $signature
+    ;
+} else {
+    print FD
     $unsigned_module,
     $signers_name,
     $key_identifier,
@@ -445,8 +460,9 @@ print FD
     $info,
     $magic_number
     ;
+}
 close FD || die $dest;
 
-if ($#ARGV != 3) {
+if (!$sign_fw && $#ARGV != 3) {
     rename($dest, $module) || die $module;
 }
-- 
1.8.0

[PATCH RFC 3/4] firmware: Add a signature check

Message details and related content
Add a feature to check the firmware signature, specified via Kconfig
CONFIG_FIRMWARE_SIG.  The signature check is performed only for the
direct fw loading without udev.  Also no check for built-in firmware
blobs is implemented yet.

Signed-off-by: Takashi Iwai <redacted>
---
 drivers/base/Kconfig          |  6 +++++
 drivers/base/firmware_class.c | 56 +++++++++++++++++++++++++++++++++++---
 include/linux/firmware.h      |  7 +++++
 kernel/module_signing.c       | 63 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 128 insertions(+), 4 deletions(-)
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index b34b5cd..3696fd7 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -145,6 +145,12 @@ config EXTRA_FIRMWARE_DIR
 	  this option you can point it elsewhere, such as /lib/firmware/ or
 	  some other directory containing the firmware files.
 
+config FIRMWARE_SIG
+	bool "Firmware signature verification"
+	depends on FW_LOADER && MODULE_SIG
+	help
+	  Enable firmware signature check.
+
 config DEBUG_DRIVER
 	bool "Driver Core verbose debug messages"
 	depends on DEBUG_KERNEL
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 8945f4e..575bc4c 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -36,6 +36,11 @@ MODULE_AUTHOR("Manuel Estrada Sainz");
 MODULE_DESCRIPTION("Multi purpose firmware loading support");
 MODULE_LICENSE("GPL");
 
+#ifdef CONFIG_FIRMWARE_SIG
+static bool sig_enforce;
+module_param(sig_enforce, bool, 0644);
+#endif
+
 /* Builtin firmware support */
 
 #ifdef CONFIG_FW_LOADER
@@ -287,7 +292,7 @@ static noinline long fw_file_size(struct file *file)
 	return st.size;
 }
 
-static bool fw_read_file_contents(struct file *file, struct firmware_buf *fw_buf)
+static bool fw_read_file_contents(struct file *file, void **bufp, size_t *sizep)
 {
 	long size;
 	char *buf;
@@ -302,11 +307,39 @@ static bool fw_read_file_contents(struct file *file, struct firmware_buf *fw_buf
 		vfree(buf);
 		return false;
 	}
-	fw_buf->data = buf;
-	fw_buf->size = size;
+	*bufp = buf;
+	*sizep = size;
 	return true;
 }
 
+#ifdef CONFIG_FIRMWARE_SIG
+static bool verify_signature(struct firmware_buf *buf, const char *path)
+{
+	const unsigned long markerlen = sizeof(FIRMWARE_SIG_STRING) - 1;
+	struct file *file;
+	void *sig_data;
+	size_t sig_size;
+	bool success;
+
+	file = filp_open(path, O_RDONLY, 0);
+	if (IS_ERR(file))
+		return false;
+
+	success = fw_read_file_contents(file, &sig_data, &sig_size);
+	fput(file);
+	if (success) {
+		if (sig_size > markerlen &&
+		    !memcmp(sig_data, FIRMWARE_SIG_STRING, markerlen))
+			success = !fw_verify_sig(buf->data, buf->size,
+						 sig_data + markerlen,
+						 sig_size - markerlen);
+		pr_debug("verified signature %s: %d\n", path, success);
+		vfree(sig_data);
+	}
+	return success;
+}
+#endif /* CONFIG_FIRMWARE_SIG */
+
 static bool fw_get_filesystem_firmware(struct firmware_buf *buf)
 {
 	int i;
@@ -320,8 +353,23 @@ static bool fw_get_filesystem_firmware(struct firmware_buf *buf)
 		file = filp_open(path, O_RDONLY, 0);
 		if (IS_ERR(file))
 			continue;
-		success = fw_read_file_contents(file, buf);
+		success = fw_read_file_contents(file, &buf->data, &buf->size);
 		fput(file);
+#ifdef CONFIG_FIRMWARE_SIG
+		if (success) {
+			snprintf(path, PATH_MAX, "%s/%s.sig", fw_path[i],
+				 buf->fw_id);
+			if (!verify_signature(buf, path)) {
+				pr_err("Invalid signature file %s\n", path);
+				if (sig_enforce) {
+					vfree(buf->data);
+					buf->data = NULL;
+					buf->size = 0;
+					success = false;
+				}
+			}
+		}
+#endif /* CONFIG_FIRMWARE_SIG */
 		if (success)
 			break;
 	}
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index e4279fe..2e9e457 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -79,4 +79,11 @@ static inline int uncache_firmware(const char *name)
 }
 #endif
 
+#ifdef CONFIG_FIRMWARE_SIG
+#define FIRMWARE_SIG_STRING "~Linux firmware signature~\n"
+/* defined in kernel/module_signing.c */
+int fw_verify_sig(const void *fw_data, size_t fw_size,
+		  const void *sig_data, size_t sig_size);
+#endif
+
 #endif
diff --git a/kernel/module_signing.c b/kernel/module_signing.c
index ea1b1df..7994452 100644
--- a/kernel/module_signing.c
+++ b/kernel/module_signing.c
@@ -11,6 +11,7 @@
 
 #include <linux/kernel.h>
 #include <linux/err.h>
+#include <linux/export.h>
 #include <crypto/public_key.h>
 #include <crypto/hash.h>
 #include <keys/asymmetric-type.h>
@@ -247,3 +248,65 @@ error_put_key:
 	pr_devel("<==%s() = %d\n", __func__, ret);
 	return ret;	
 }
+
+#ifdef CONFIG_FIRMWARE_SIG
+/*
+ * Verify the firmware signature, similar like module signature check
+ * but it's stored in a separate file
+ */
+int fw_verify_sig(const void *fw_data, size_t fw_size,
+		  const void *sig_data, size_t sig_size)
+{
+	struct public_key_signature *pks;
+	struct module_signature ms;
+	struct key *key;
+	size_t sig_len;
+	int ret;
+
+	if (sig_size <= sizeof(ms))
+		return -EBADMSG;
+
+	memcpy(&ms, sig_data, sizeof(ms));
+	sig_data += sizeof(ms);
+	sig_size -= sizeof(ms);
+
+	sig_len = be32_to_cpu(ms.sig_len);
+	if (sig_size < sig_len + (size_t)ms.signer_len + ms.key_id_len)
+		return -EBADMSG;
+
+	/* For the moment, only support RSA and X.509 identifiers */
+	if (ms.algo != PKEY_ALGO_RSA ||
+	    ms.id_type != PKEY_ID_X509)
+		return -ENOPKG;
+
+	if (ms.hash >= PKEY_HASH__LAST ||
+	    !pkey_hash_algo[ms.hash])
+		return -ENOPKG;
+
+	key = request_asymmetric_key(sig_data, ms.signer_len,
+				     sig_data + ms.signer_len, ms.key_id_len);
+	if (IS_ERR(key))
+		return PTR_ERR(key);
+
+	pks = mod_make_digest(ms.hash, fw_data, fw_size);
+	if (IS_ERR(pks)) {
+		ret = PTR_ERR(pks);
+		goto error_put_key;
+	}
+
+	sig_data += ms.signer_len + ms.key_id_len;
+	ret = mod_extract_mpi_array(pks, sig_data, sig_len);
+	if (ret < 0)
+		goto error_free_pks;
+
+	ret = verify_signature(key, pks);
+
+error_free_pks:
+	mpi_free(pks->rsa.s);
+	kfree(pks);
+error_put_key:
+	key_put(key);
+	return ret;
+}
+EXPORT_SYMBOL_GPL(fw_verify_sig);
+#endif /* CONFIG_FIRMWARE_SIG */
-- 
1.8.0

[PATCH RFC 4/4] firmware: Install signature files automatically

Message details and related content
... when CONFIG_FIRMWARE_SIG is set.

Signed-off-by: Takashi Iwai <redacted>
---
 Makefile                |  6 ++++++
 scripts/Makefile.fwinst | 18 ++++++++++++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index a1ccf22..c6d7a3e 100644
--- a/Makefile
+++ b/Makefile
@@ -729,6 +729,12 @@ mod_sign_cmd = true
 endif
 export mod_sign_cmd
 
+ifeq ($(CONFIG_FIRMWARE_SIG),y)
+fw_sign_cmd = perl $(srctree)/scripts/sign-file -f $(MODSECKEY) $(MODPUBKEY)
+else
+fw_sign_cmd = true
+endif
+export fw_sign_cmd
 
 ifeq ($(KBUILD_EXTMOD),)
 core-y		+= kernel/ mm/ fs/ ipc/ security/ crypto/ block/
diff --git a/scripts/Makefile.fwinst b/scripts/Makefile.fwinst
index 4d908d1..df256f0 100644
--- a/scripts/Makefile.fwinst
+++ b/scripts/Makefile.fwinst
@@ -29,6 +29,20 @@ installed-mod-fw := $(addprefix $(INSTALL_FW_PATH)/,$(mod-fw))
 installed-fw := $(addprefix $(INSTALL_FW_PATH)/,$(fw-shipped-all))
 installed-fw-dirs := $(sort $(dir $(installed-fw))) $(INSTALL_FW_PATH)/./
 
+ifeq ($(CONFIG_FIRMWARE_SIG),y)
+installed-fw-sig := $(patsubst %,%.sig, $(installed-fw))
+installed-mod-fw-sig := $(patsubst %,%.sig, $(installed-mod-fw))
+else
+installed-fw-sig :=
+installed-mod-fw-sig :=
+endif
+
+quiet_cmd_fwsig = FWSIG $@
+      cmd_fwsig = $(fw_sign_cmd) $(patsubst %.sig,%,$@) $@
+
+%.sig: %
+	$(call cmd,fwsig)
+
 # Workaround for make < 3.81, where .SECONDEXPANSION doesn't work.
 PHONY += $(INSTALL_FW_PATH)/$$(%) install-all-dirs
 $(INSTALL_FW_PATH)/$$(%): install-all-dirs
@@ -49,9 +63,9 @@ PHONY +=  __fw_install __fw_modinst FORCE
 
 .PHONY: $(PHONY)
 
-__fw_install: $(installed-fw)
+__fw_install: $(installed-fw) $(installed-fw-sig)
 
-__fw_modinst: $(installed-mod-fw)
+__fw_modinst: $(installed-mod-fw) $(installed-mod-fw-sig)
 	@:
 
 __fw_modbuild: $(addprefix $(obj)/,$(mod-fw))
-- 
1.8.0

Re: [PATCH RFC 0/4] Add firmware signature file check

Message details and related content
At Mon, 05 Nov 2012 18:18:24 +0100,
Takashi Iwai wrote:
Hi,

this is a patch series to add the support for firmware signature
check.  At this time, the kernel checks extra signature file (*.sig)
for each firmware, instead of embedded signature.
It's just a quick hack using the existing module signing mechanism,
thus provided only as a proof of concept for now.

To be noted, it doesn't support the firmwares via udev but only the
direct loading, and the check for built-in firmware is missing, too.
On the second thought, checking the signature for builtin firmwares is
superfluous.  And udev usage for firmware loading should be pretty
rare with 3.7 kernel.  So, locking down the udev loading case when
sig_enforce = true should suffice in most cases, I guess.


Takashi

Re: [PATCH RFC 0/4] Add firmware signature file check

Message details and related content
On Mon, Nov 5, 2012 at 12:18 PM, Takashi Iwai [off-list ref] wrote:
Hi,

this is a patch series to add the support for firmware signature
check.  At this time, the kernel checks extra signature file (*.sig)
for each firmware, instead of embedded signature.
It's just a quick hack using the existing module signing mechanism,
thus provided only as a proof of concept for now.

To be noted, it doesn't support the firmwares via udev but only the
direct loading, and the check for built-in firmware is missing, too.
Just to make sure I'm reading this correctly, it will sign any of the
firwmare files installed directly from the kernel tree if the option is
set.  So for the firmware in the linux-firmware tree we'd need to
either copy that into the kernel tree during build time, or duplicate the
signing bits in the linux-firmware tree itself.  However if we do the
latter, we'd probably need to use the same keys as the per-build kernel
key which means copying keys (ew) or tell the kernel to include a
separate firmware key in the extra list.

I feel like I'm rambling a bit, but I'm trying to work out how signed
firmware would look from a distro perspective.  A significant amount of
work has been done to decouple linux-firmware from the kernel tree and
if signed firmware is used it seems to couple them together one way or
another.  At the moment, using generated per-build keys to come up with
the firmware signatures seems a bit suboptimal in that regard.

josh

Re: [PATCH RFC 0/4] Add firmware signature file check

Message details and related content
Takashi Iwai [off-list ref] wrote:
this is a patch series to add the support for firmware signature
check.  At this time, the kernel checks extra signature file (*.sig)
for each firmware, instead of embedded signature.
It's just a quick hack using the existing module signing mechanism,
thus provided only as a proof of concept for now.
There is another way to do this.  If you look at the patches I proposed to
wrap keys in PE binaries, you'll find that that can handle PKCS#7 format
messages as that's what's in the sort of signed PE binary we're dealing with.

You could use this to put the firmware inside a signed-data PKCS#7 message.

David

Re: [PATCH RFC 0/4] Add firmware signature file check

Message details and related content
David Howells [off-list ref] wrote:
Takashi Iwai [off-list ref] wrote:
quoted
this is a patch series to add the support for firmware signature
check.  At this time, the kernel checks extra signature file (*.sig)
for each firmware, instead of embedded signature.
It's just a quick hack using the existing module signing mechanism,
thus provided only as a proof of concept for now.
There is another way to do this.  If you look at the patches I proposed to
wrap keys in PE binaries, you'll find that that can handle PKCS#7 format
messages as that's what's in the sort of signed PE binary we're dealing with.
See:

	http://git.kernel.org/?p=linux/kernel/git/dhowells/linux-modsign.git;a=shortlog;h=refs/heads/devel-pekey
You could use this to put the firmware inside a signed-data PKCS#7 message.
Note that the ASN.1 decoder in the kernel would need altering to handle
messages larger than 64KB.

David

Re: [PATCH RFC 0/4] Add firmware signature file check

Message details and related content
On Tue, Nov 6, 2012 at 1:18 AM, Takashi Iwai [off-list ref] wrote:
To be noted, it doesn't support the firmwares via udev but only the
direct loading, and the check for built-in firmware is missing, too.
Generally, both direct loading and udev may request one same firmware
image. And after check failed, current firmware load will fallback on udev
to complete loading, so looks a check-failed firmware still can be loaded
into kernel no matter if there is firmware signature check or not.


Thanks,
--
Ming Lei

Re: [PATCH RFC 3/4] firmware: Add a signature check

Message details and related content
On Mon, 2012-11-05 at 18:20 +0100, Takashi Iwai wrote:
quoted hunk
Add a feature to check the firmware signature, specified via Kconfig
CONFIG_FIRMWARE_SIG.  The signature check is performed only for the
direct fw loading without udev.  Also no check for built-in firmware
blobs is implemented yet.

Signed-off-by: Takashi Iwai <redacted>
---
 drivers/base/Kconfig          |  6 +++++
 drivers/base/firmware_class.c | 56 +++++++++++++++++++++++++++++++++++---
 include/linux/firmware.h      |  7 +++++
 kernel/module_signing.c       | 63 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 128 insertions(+), 4 deletions(-)
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index b34b5cd..3696fd7 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -145,6 +145,12 @@ config EXTRA_FIRMWARE_DIR
 	  this option you can point it elsewhere, such as /lib/firmware/ or
 	  some other directory containing the firmware files.

+config FIRMWARE_SIG
+	bool "Firmware signature verification"
+	depends on FW_LOADER && MODULE_SIG
+	help
+	  Enable firmware signature check.
+
 config DEBUG_DRIVER
 	bool "Driver Core verbose debug messages"
 	depends on DEBUG_KERNEL
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 8945f4e..575bc4c 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -36,6 +36,11 @@ MODULE_AUTHOR("Manuel Estrada Sainz");
 MODULE_DESCRIPTION("Multi purpose firmware loading support");
 MODULE_LICENSE("GPL");

+#ifdef CONFIG_FIRMWARE_SIG
+static bool sig_enforce;

79 more quoted lines

The existing kernel modules are read by userspace into a buffer, which
is passed to the kernel.  As there is no way of verifying what was read
by userspace is the same as what was passed to the kernel, the signature
verification is done, in the kernel, on the buffer contents.  The new
kernel module syscall passes a file descriptor.  With commit "41110a4
ima: support new kernel module syscall" the kernel module signature is
measured/appraised like any other file in the IMA policy.

Although the default policy should already be measuring/appraising the
firmware, because of the open, you might want to add a new hook
FIRMWARE_CHECK here, for finer grain IMA policy control.

thanks,

Mimi
quoted hunk
 		if (success)
 			break;
 	}
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index e4279fe..2e9e457 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -79,4 +79,11 @@ static inline int uncache_firmware(const char *name)
 }
 #endif

+#ifdef CONFIG_FIRMWARE_SIG
+#define FIRMWARE_SIG_STRING "~Linux firmware signature~\n"
+/* defined in kernel/module_signing.c */
+int fw_verify_sig(const void *fw_data, size_t fw_size,
+		  const void *sig_data, size_t sig_size);
+#endif
+
 #endif
diff --git a/kernel/module_signing.c b/kernel/module_signing.c
index ea1b1df..7994452 100644
--- a/kernel/module_signing.c
+++ b/kernel/module_signing.c
@@ -11,6 +11,7 @@

 #include <linux/kernel.h>
 #include <linux/err.h>
+#include <linux/export.h>
 #include <crypto/public_key.h>
 #include <crypto/hash.h>
 #include <keys/asymmetric-type.h>
@@ -247,3 +248,65 @@ error_put_key:
 	pr_devel("<==%s() = %d\n", __func__, ret);
 	return ret;	
 }
+
+#ifdef CONFIG_FIRMWARE_SIG
+/*
+ * Verify the firmware signature, similar like module signature check
+ * but it's stored in a separate file

57 more quoted lines


Re: [PATCH RFC 0/4] Add firmware signature file check

Message details and related content
2012/11/6 Ming Lei [off-list ref]:
On Tue, Nov 6, 2012 at 1:18 AM, Takashi Iwai [off-list ref] wrote:
quoted
To be noted, it doesn't support the firmwares via udev but only the
direct loading, and the check for built-in firmware is missing, too.
Generally, both direct loading and udev may request one same firmware
image. And after check failed, current firmware load will fallback on udev
to complete loading, so looks a check-failed firmware still can be loaded
into kernel no matter if there is firmware signature check or not.


Thanks,
--
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
The udev direct write firmware through data attribute, maybe we can do
the same signature verification in firmware_data_write? The following
patch didn't test yet.


Thanks
Joey Lee
From 035dde5fadc9e7f4b7811b18d3a5094ef88e8bbb Mon Sep 17 00:00:00 2001
From: Lee, Chun-Yi <jlee@suse.com>
Date: Tue, 6 Nov 2012 13:07:04 +0800
Subject: [PATCH] firmware: Add signature check to firmware_data_write

---
 drivers/base/firmware_class.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 8945f4e..40d8cc6 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -621,6 +621,7 @@ static ssize_t firmware_data_write(struct file
*filp, struct kobject *kobj,
        struct firmware_priv *fw_priv = to_firmware_priv(dev);
        struct firmware_buf *buf;
        ssize_t retval;
+       bool success = false;

        if (!capable(CAP_SYS_RAWIO))
                return -EPERM;
@@ -655,6 +656,23 @@ static ssize_t firmware_data_write(struct file
*filp, struct kobject *kobj,
        }

        buf->size = max_t(size_t, offset, buf->size);
+
+#ifdef CONFIG_FIRMWARE_SIG
+       for (i = 0; i < ARRAY_SIZE(fw_path); i++) {
+               snprintf(path, PATH_MAX, "%s/%s.sig", fw_path[i], buf->fw_id);
+               if (verify_signature(buf, path))
+                       success = true;
+       }
+       if (!success) {
+               pr_err("Invalid signature file %s\n", path);
+               if (sig_enforce) {
+                       vfree(buf->data);
+                       buf->data = NULL;
+                       buf->size = 0;
+               }
+               retval = -ENOENT;
+       }
+#endif /* CONFIG_FIRMWARE_SIG */
 out:
        mutex_unlock(&fw_lock);
        return retval;
-- 
1.6.4.2

Re: [PATCH RFC 0/4] Add firmware signature file check

Message details and related content
At Mon, 5 Nov 2012 15:43:09 -0500,
Josh Boyer wrote:
On Mon, Nov 5, 2012 at 12:18 PM, Takashi Iwai [off-list ref] wrote:
quoted
Hi,

this is a patch series to add the support for firmware signature
check.  At this time, the kernel checks extra signature file (*.sig)
for each firmware, instead of embedded signature.
It's just a quick hack using the existing module signing mechanism,
thus provided only as a proof of concept for now.

To be noted, it doesn't support the firmwares via udev but only the
direct loading, and the check for built-in firmware is missing, too.
Just to make sure I'm reading this correctly, it will sign any of the
firwmare files installed directly from the kernel tree if the option is
set.  So for the firmware in the linux-firmware tree we'd need to
either copy that into the kernel tree during build time, or duplicate the
signing bits in the linux-firmware tree itself.  However if we do the
latter, we'd probably need to use the same keys as the per-build kernel
key which means copying keys (ew) or tell the kernel to include a
separate firmware key in the extra list.
Yes, the situation is as same as the external module builds.
I feel like I'm rambling a bit, but I'm trying to work out how signed
firmware would look from a distro perspective.  A significant amount of
work has been done to decouple linux-firmware from the kernel tree and
if signed firmware is used it seems to couple them together one way or
another.
Well, the primary question is whether the firmware signature check is
required or not.  Of course, these patches assume that it is for
secure boot lockdown :)
 At the moment, using generated per-build keys to come up with
the firmware signatures seems a bit suboptimal in that regard.
But how would distro sign modules that are built externally?
It should be the pretty same situation.

I thought that the current module signing is already supported (at
least accepted) by distro, even for external modules.  Isn't it?


thanks,

Takashi

Re: [PATCH RFC 0/4] Add firmware signature file check

Message details and related content
At Tue, 06 Nov 2012 00:01:52 +0000,
David Howells wrote:
Takashi Iwai [off-list ref] wrote:
quoted
this is a patch series to add the support for firmware signature
check.  At this time, the kernel checks extra signature file (*.sig)
for each firmware, instead of embedded signature.
It's just a quick hack using the existing module signing mechanism,
thus provided only as a proof of concept for now.
There is another way to do this.  If you look at the patches I proposed to
wrap keys in PE binaries, you'll find that that can handle PKCS#7 format
messages as that's what's in the sort of signed PE binary we're dealing with.

You could use this to put the firmware inside a signed-data PKCS#7 message.
Yeah, embedding the signature is more straightforward.  Actually I
tried the embedded signature (just like module) at first, then a
couple of concerns arose:

- Legally unclear about "modifying" the firmware data or file,

- The signed firmware is no longer compatible with the older kernel,
  thus bad for distro packaging.


thanks,

Takashi

Re: [PATCH RFC 0/4] Add firmware signature file check

Message details and related content
At Tue, 6 Nov 2012 10:30:26 +0800,
Ming Lei wrote:
On Tue, Nov 6, 2012 at 1:18 AM, Takashi Iwai [off-list ref] wrote:
quoted
To be noted, it doesn't support the firmwares via udev but only the
direct loading, and the check for built-in firmware is missing, too.
Generally, both direct loading and udev may request one same firmware
image. And after check failed, current firmware load will fallback on udev
to complete loading, so looks a check-failed firmware still can be loaded
into kernel no matter if there is firmware signature check or not.
Yeah, it's just uncovered in the patch.  As a easy solution, apply the
patch like below to disallow the udev fw loading when signature check
is enforced.


thanks,

Takashi

---
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 575bc4c..93121c3 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -912,6 +912,13 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent,
 		goto handle_fw;
 	}
 
+	/* signature check isn't handled via udev fw loading */
+	if (sig_enforce) {
+		fw_load_abort(fw_priv);
+		direct_load = 1;
+		goto handle_fw;
+	}
+
 	/* fall back on userspace loading */
 	buf->fmt = PAGE_BUF;
 

Re: [PATCH RFC 0/4] Add firmware signature file check

Message details and related content
On Tue, Nov 6, 2012 at 3:03 PM, Takashi Iwai [off-list ref] wrote:
quoted hunk
Yeah, it's just uncovered in the patch.  As a easy solution, apply the
patch like below to disallow the udev fw loading when signature check
is enforced.


thanks,

Takashi

---
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 575bc4c..93121c3 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -912,6 +912,13 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent,
                goto handle_fw;
        }

+       /* signature check isn't handled via udev fw loading */
+       if (sig_enforce) {
+               fw_load_abort(fw_priv);
+               direct_load = 1;
+               goto handle_fw;
+       }
+
The above might be wrong if the firmware file doesn't exist in default
search paths. You should skip loading from user space only if
verify_signature() returns false. And the udev loading should be
resorted to if there is no such firmware file in default search paths.
        /* fall back on userspace loading */
        buf->fmt = PAGE_BUF;

Thanks,
-- 
Ming Lei

Re: [PATCH RFC 0/4] Add firmware signature file check

Message details and related content
At Tue, 6 Nov 2012 15:16:43 +0800,
Ming Lei wrote:
On Tue, Nov 6, 2012 at 3:03 PM, Takashi Iwai [off-list ref] wrote:
quoted
Yeah, it's just uncovered in the patch.  As a easy solution, apply the
patch like below to disallow the udev fw loading when signature check
is enforced.


thanks,

Takashi

---
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 575bc4c..93121c3 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -912,6 +912,13 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent,
                goto handle_fw;
        }

+       /* signature check isn't handled via udev fw loading */
+       if (sig_enforce) {
+               fw_load_abort(fw_priv);
+               direct_load = 1;
+               goto handle_fw;
+       }
+
The above might be wrong if the firmware file doesn't exist in default
search paths.
Heh, I didn't call it's a perfect patch.  It's just an easy solution,
as mentioned.
You should skip loading from user space only if
verify_signature() returns false. And the udev loading should be
resorted to if there is no such firmware file in default search paths.
... and the kernel should ask udev again for the corresponding
signature.  I'm too lazy to implement that just for unknown corner
cases, so put the patch like above.

Honestly speaking, I have a feeling that we should rather go for
getting rid of udev fw loading.  The fw loader code is overly complex
just for udev handshaking. 

Do you know how many firmwares still rely on udev...?


thanks,

Takashi

Re: [PATCH RFC 0/4] Add firmware signature file check

Message details and related content
On Tue, Nov 6, 2012 at 3:32 PM, Takashi Iwai [off-list ref] wrote:
At Tue, 6 Nov 2012 15:16:43 +0800,
Ming Lei wrote:
quoted
On Tue, Nov 6, 2012 at 3:03 PM, Takashi Iwai [off-list ref] wrote:
quoted
Yeah, it's just uncovered in the patch.  As a easy solution, apply the
patch like below to disallow the udev fw loading when signature check
is enforced.


thanks,

Takashi

---
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 575bc4c..93121c3 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -912,6 +912,13 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent,
                goto handle_fw;
        }

+       /* signature check isn't handled via udev fw loading */
+       if (sig_enforce) {
+               fw_load_abort(fw_priv);
+               direct_load = 1;
+               goto handle_fw;
+       }
+
The above might be wrong if the firmware file doesn't exist in default
search paths.
Heh, I didn't call it's a perfect patch.  It's just an easy solution,
as mentioned.
quoted
You should skip loading from user space only if
verify_signature() returns false. And the udev loading should be
resorted to if there is no such firmware file in default search paths.

3 more quoted lines

I mean you can't skip user space loading if there is no firmware file
in the default search path.  And you can do it if verify_signature()
returns false. So you needn't have to implement the signature for
user space loading.
I'm too lazy to implement that just for unknown corner
cases, so put the patch like above.
There might be some distributions in which the firmwares aren't stored
under the default search path, so your change may cause regression
on these distributions. And, it is a easy change in your patch to make
the situation working.

Also the default search path in firmware_class.c is from built-in path of
udev, and distributions may customize their firmware path by udev
configure option.
Honestly speaking, I have a feeling that we should rather go for
getting rid of udev fw loading.  The fw loader code is overly complex
Yes, I have the feeling too, but we need to make sure no regressions
introduced.
just for udev handshaking.

Do you know how many firmwares still rely on udev...?
Do you know how many distributions have switched to 3.7-rcX to
start using direct loading?

Thanks,
-- 
Ming Lei

Re: [PATCH RFC 0/4] Add firmware signature file check

Message details and related content
At Tue, 6 Nov 2012 16:04:50 +0800,
Ming Lei wrote:
On Tue, Nov 6, 2012 at 3:32 PM, Takashi Iwai [off-list ref] wrote:
quoted
At Tue, 6 Nov 2012 15:16:43 +0800,
Ming Lei wrote:
quoted
On Tue, Nov 6, 2012 at 3:03 PM, Takashi Iwai [off-list ref] wrote:
quoted
Yeah, it's just uncovered in the patch.  As a easy solution, apply the
patch like below to disallow the udev fw loading when signature check
is enforced.


thanks,

Takashi

---
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 575bc4c..93121c3 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -912,6 +912,13 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent,
                goto handle_fw;
        }

+       /* signature check isn't handled via udev fw loading */
+       if (sig_enforce) {
+               fw_load_abort(fw_priv);
+               direct_load = 1;
+               goto handle_fw;
+       }
+
The above might be wrong if the firmware file doesn't exist in default
search paths.
Heh, I didn't call it's a perfect patch.  It's just an easy solution,
as mentioned.
quoted
You should skip loading from user space only if

10 more quoted lines

Right, and it's intentionally dropped so.  For the non-default fw
path, it can be added via proc dynamically or via kconfig statically.
If the firmware is generated via udev, then it doesn't make sense to
check a static signature file.
quoted
I'm too lazy to implement that just for unknown corner
cases, so put the patch like above.
There might be some distributions in which the firmwares aren't stored
under the default search path, so your change may cause regression
on these distributions. And, it is a easy change in your patch to make
the situation working.
A "regression" can't happen in this case because the secure boot is
a completely new stuff :)  For normal boot, sig_enforce is false, so
no behavior change here (well my patch still applies the signature
check for direct fw loading, but it won't regress at least).
Also the default search path in firmware_class.c is from built-in path of
udev, and distributions may customize their firmware path by udev
configure option.
Well, the default paths in kernel can be changed to follow that as
well, no?
quoted
Honestly speaking, I have a feeling that we should rather go for
getting rid of udev fw loading.  The fw loader code is overly complex
Yes, I have the feeling too, but we need to make sure no regressions
introduced.
Right.  And I guess the exceptional firmware case is better found by
checking udev.  But it's a bit off topic from secure boot. 
quoted
just for udev handshaking.

Do you know how many firmwares still rely on udev...?
Do you know how many distributions have switched to 3.7-rcX to
start using direct loading?
Obviously no distro releases using 3.7-rc since it's still rc.
But what's your point?


Takashi

Re: [PATCH RFC 0/4] Add firmware signature file check

Message details and related content
On Tue, Nov 6, 2012 at 4:18 PM, Takashi Iwai [off-list ref] wrote:
Right, and it's intentionally dropped so.  For the non-default fw
path, it can be added via proc dynamically or via kconfig statically.
If the firmware is generated via udev, then it doesn't make sense to
check a static signature file.
kconfig should be better, and proc isn't a good way because it
is a bit late. Also the firmware might be loaded dynamically from other
where(network, ...). So it is better to fall back on user space if the
firmware file isn't found by direct loading even firmware signature
is enabled.
A "regression" can't happen in this case because the secure boot is
a completely new stuff :)  For normal boot, sig_enforce is false, so
no behavior change here (well my patch still applies the signature
check for direct fw loading, but it won't regress at least).
Got it, so FIRMWARE_SIG and MODULE_SIG should be enabled only
for secure boot.

The regression might still be triggered if falling back on user space is not
supported, see above.
quoted
Also the default search path in firmware_class.c is from built-in path of
udev, and distributions may customize their firmware path by udev
configure option.
Well, the default paths in kernel can be changed to follow that as
well, no?
quoted
quoted
Honestly speaking, I have a feeling that we should rather go for
getting rid of udev fw loading.  The fw loader code is overly complex
Yes, I have the feeling too, but we need to make sure no regressions
introduced.
Right.  And I guess the exceptional firmware case is better found by
checking udev.  But it's a bit off topic from secure boot.
Not sure, some distributions may not use udev at all. Some application
might need the firmware add/remove event. Some may not store the
firmware in fs.

So now it is difficult to say we can remove firmware loading from user
space. Better to just keep it.
Obviously no distro releases using 3.7-rc since it's still rc.
But what's your point?
I mean direct loading hasn't been tested completely, so we don't
know which distributions may fallback on user space loading.

Thanks,
-- 
Ming Lei

Re: [PATCH RFC 0/4] Add firmware signature file check

Message details and related content
At Tue, 6 Nov 2012 09:20:19 +0000,
Alan Cox wrote:
quoted
But how would distro sign modules that are built externally?
It should be the pretty same situation.
I would start with the "would" and lawyers and liability and then stop
worrying about the how. Absent someone actually intending to do it and
saying so.
Well, what I meant for external built modules are not about things
like nvidia, but rather normal (legal) drivers or updated modules that
are built from out-of-kernel source.  I'm sure that distros will
provide such update module packages on the secure boot system, too.

So, discussing about "how" isn't so bad even for now, since this shall
be anyway mandatory (for distros) once when the module signing is
deployed.


Takashi

Previous page

Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help