Re: [PATCH 07/11] kexec: Disable in a secure boot environment

From: Eric W. Biederman
Date: Tue Sep 04 2012 - 18:12:56 EST


Matthew Garrett <mjg59@xxxxxxxxxxxxx> writes:

> On Tue, Sep 04, 2012 at 02:13:54PM -0700, Eric W. Biederman wrote:
>> Matthew Garrett <mjg59@xxxxxxxxxxxxx> writes:
>> > And
>> > secondly, there are already several non-EFI platforms that want to enact
>> > a policy preventing root from being able to arbitrarily replace the
>> > kernel. Given that people are doing this in the wild, it makes sense to
>> > move towards offering that policy in the mainline kernel.
>>
>> Either this code makes sense without an appeal to EFI or this code makes
>> no sense.
>
> The driving force behind this code right now is that our choices are
> either (1) do something like this, or (2) disable kexec entirely.

Actually there is an interesting question here. Why does even EFI secure
boot justify this? If I install my own key in EFI I should be able to
boot a kernel that does anything I want it to. My machine doing what I
want it to is the point of trusted boot is it not?

> Like I
> said, long term we'd want to provide appropriate technical mechanisms to
> make kexec usable in a world where people want to be able to trust their
> kernel, and we have people working on that. But that being our
> motivation for the implementation doesn't mean that other parties won't
> have uses for it, and I'd like to find a solution that satisfies them as
> well.

I expect you want to make that that medium term. Enterprise distros
don't ship without kexec-on-panic. Too often long term seems to be
something that no one ever gets around to in kernel development.

>> It is fine for jumping through the EFI trusted boot hoops to be your
>> motivation, but EFI policy should not be the justification for kernel
>> implementation details.
>
> Sure it is. The kernel exists to provide the functionality that people
> require, and UEFI imposes that requirement on the people. It's like
> saying gcc policy shouldn't be the justification for kernel
> implementation details. We don't control the gcc developers, but we have
> to consume what they provide us with.

This isn't efi specific code. We need to be able to think about what
is happening with a local analysis so we can see if it is correct.

This is slightly violated already as pointed out elsewhere,
as CAP_SECURE_BOOT means we did not boot securely.

>> So please rework this to come from an angle that makes sense all by
>> itself.
>
> I'm afraid I have no idea what you're asking for here. Some vendors want
> to be able to ensure that kexec is only used to load trusted code. Right
> now there's no mechanism for ensuring that, so why not at least provide
> a mechanism for them to turn it off at runtime?

There is a mechanism to turn it off at runtime CAP_SYS_BOOT.

In general booting anything else besides what you are running is equally
bad.

What I am asking for is a mechanism that makes sense without having to
think about EFI. Without having to think about the silly hoops people
are going through because of the impending launch of windows 8.

As Alan says a capability doesn't seem horrible. But if we use a
capability it needs to be a well named capability, and the semantics
of the capability need to make inherent sense.

I have the basic question, why can't I trust the root who has all
capabilities? What makes the root user more trusted than the linux
kernel. Especially when typically the root user is the owner of
the machine.

There is a element here where it seems implementing the policy you
are proposing will start encouraging people to start hoarding kernel
bugs instead of reporting them. So implementing this policy might
make the kernel in net less secure. How is that prevented?

Ultimately the question is.

This is Unix. In Unix we give root rope and let him hang himself
or shoot himself in the foot (not that we encourage it).

Why are we now implementing a security model where we don't trust root?

What is gained from a security model where root is untrusted?

Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/