public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: kexec@lists.infradead.org, horms@verge.net.au,
	"H. Peter Anvin" <hpa@zytor.com>,
	Khalid Aziz <khalid@gonehiking.org>,
	Dave Young <dyoung@redhat.com>, Matthew Garrett <mjg@redhat.com>
Subject: Re: [RFC] Kdump with UEFI secure boot (Re: [PATCH v2] kdump: pass acpi_rsdp= to 2nd kernel for efi booting)
Date: Fri, 19 Oct 2012 10:31:12 -0400	[thread overview]
Message-ID: <20121019143112.GB27052@redhat.com> (raw)
In-Reply-To: <877gqnnnf0.fsf@xmission.com>

On Thu, Oct 18, 2012 at 08:36:19PM -0700, Eric W. Biederman wrote:

[..]
> Handling the file formats etc in kernel space in inflexible.
> 
> Given that what we load current at no time is exactly what is in the
> executable but is the executable plus it's ``arguments'' I have to agree
> with that assesment.
> 
> In practice we have all kinds of argument passing conventions and those
> conventions prevent the kernel from executing another linux kernel
> directly, even if we had the other pieces in place.

Can we pass all argument in one kexec segment and let associated image
format handlers parse the arguments. 

> 
> Not to mention things like the SHA512 checksum that we do to verify the
> kdump kernel has not been corrupted.

As we will be preparing all the segments intenally and also preparing
the purgatory(or equivalent) in kernel, we can alaways calculate the
checksum in kernel tool IOW, there is no reason that why can't we do
existing verifications in kernel.

> 
> >>  So we either need to
> >> find a way to trust the /sbin/kexec binary
> >
> > This would be the key. How do we trust /sbin/kexec. We don't have any
> > infrastrucutre to sign user space executables. Code for signing modules
> > got just in after a long battle. 
> 
> There are 3 options for trusting /sbin/kexec.  There are IMA and EMA,
> and it is conceivable to have ELF note sections with signatures for
> executables.

Can you please tell more about what is EMA and IMA. I did quick google
and could not find much.

Adding signatures to ELF should be possible. I guess this is similar
to signed PE/COFF images. Just that convention changes that how images
are signed and where exactly signatures are stored.

I do see some references to elfsign and elfverify during search. Have
not dived in to figure out what exactly they are.

I think bigger issue here is that creating that generic system of signing
user space executables and kernel verifying it. Then we end up creating
even more complicated and more locked down system.

> 
> 
> >> and do the signature
> >> verification there on a per file type basis,
> >
> > This will be possible only if we figure a way out to trust /sbin/kexec
> > otherwise trust chain is broken.
> 
> Not so.  When loading an executable in general we don't process
> relocation entries.  Which means the bits in the file and the bits
> actually loaded in memory match.  Since we are passing the bits through
> /sbin/kexec if we also pass through the signature bits all should be
> well.

So are you saying that let /sbin/kexec still load all the segments. It
will also load the attached signatures/certificates in a separate
segment and kernel can calculate hash and do verification? If yes,
few issues. here.

- What happens to purgatory code. It is unsigned piece of code which
  runs in kernel?

If you meant something else, can you please explain a bit more.

> 
> Modulo argument passing.
> 
> If we can pass in two signed executable blobs we can also perform
> trusted argument conversions.

Again lost here. Which two executable blobs you are referring to. One
is signed kernel executable, which is other one.

[..]
> > If we are ok with the idea of passing executables and initramfs to
> > kernel, then kernel can do the placement. That means fields "mem and
> > memsz fields of kexec_segment will be free. We can possibly overload
> > memsz field and pass flags to represent segment type. This will happen
> > only if user chooses kernel as bootloader functionality.
> 
> Which sounds nice initially but I don't think the notion of the kernel
> being a general purpose bootloader holds up to well.  It doesn't provide
> an easy place to put all of the weird cases.
> 
> If we are going to pass in a file it probably makes sense to do a
> variation of kexec_load that passes in a file descriptor, a filename
> could work but I don't think we want those races.
> 
> But then we get how do we pass in a different kernel command line and
> an initrd.  Things that were simple start quickly becoming complex.

Expecting three segments as input. Kernel executable, initrd and one
segment which contains all arguemnts (separated by new line) including
command line. Will that be generic enough to cover all kind of cases?

[..]
> So at this point my recommendation would be:
> 
> - Target images where the bits are passed straight through.
> 
> - Add support for passing the initial kernels parameters through to the
>   kexec'd image.
> 
> - Add support for passing the executable image signed signature through
>   to the kernel, and the conversion code signed signature through to the
>   kernel.

What is conversion code here? Are you referring to /sbin/kexec here which
breaks down kernel executables into segments? If yes, are you saying that
sign /sbin/kexec and pass its signature along with kernel signature?

But that does not help as any program can get the signature of /sbin/kexec
and pass it to kernel as its own signatures. 

I might be completely into weeds here. So little elaboration will help
me understand your ideas better.

Thanks
Vivek

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  reply	other threads:[~2012-10-19 14:31 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-18  3:10 [PATCH v2] kdump: pass acpi_rsdp= to 2nd kernel for efi booting Dave Young
2012-10-18 14:56 ` Khalid Aziz
2012-10-18 19:11   ` Vivek Goyal
2012-10-18 19:22     ` Khalid Aziz
2012-10-18 19:38       ` [RFC] Kdump with UEFI secure boot (Re: [PATCH v2] kdump: pass acpi_rsdp= to 2nd kernel for efi booting) Vivek Goyal
2012-10-18 19:55         ` Matthew Garrett
2012-10-18 22:25         ` Eric W. Biederman
2012-10-19  2:06           ` Vivek Goyal
2012-10-19  3:36             ` Eric W. Biederman
2012-10-19 14:31               ` Vivek Goyal [this message]
2012-10-22 20:43                 ` Vivek Goyal
2012-10-22 21:11                   ` Eric W. Biederman
2012-10-23  2:04                   ` Simon Horman
2012-10-23 13:24                     ` Vivek Goyal
2012-10-23 16:26                       ` [RFC] Kdump with signed images Eric W. Biederman
2012-10-23 17:39                         ` Vivek Goyal
2012-10-23 19:11                           ` Maxim Uvarov
2012-10-23 19:16                             ` Vivek Goyal
2012-10-22 21:07                 ` [RFC] Kdump with UEFI secure boot (Re: [PATCH v2] kdump: pass acpi_rsdp= to 2nd kernel for efi booting) Eric W. Biederman
2012-10-23 13:18                   ` Vivek Goyal
2012-10-23 14:59                     ` Vivek Goyal
2012-10-23 15:41                       ` Matthew Garrett
2012-10-23 16:44                         ` [RFC] Kdump with signed images Eric W. Biederman
2012-10-23 16:52                           ` Matthew Garrett
2012-10-24 17:19                           ` Vivek Goyal
2012-10-25  5:43                             ` Mimi Zohar
2012-10-25  6:44                               ` Kees Cook
2012-10-25  7:01                                 ` Mimi Zohar
2012-10-25 13:54                               ` Vivek Goyal
2012-10-25 19:06                                 ` Mimi Zohar
2012-10-25 15:39                         ` [RFC] Kdump with UEFI secure boot (Re: [PATCH v2] kdump: pass acpi_rsdp= to 2nd kernel for efi booting) Vivek Goyal
2012-10-23 16:19                       ` Kdump with signed images Eric W. Biederman
2012-10-23 16:31                         ` Matthew Garrett
2012-10-23 17:03                           ` Eric W. Biederman
2012-10-23 17:09                             ` Matthew Garrett
2012-10-24 17:36                         ` Vivek Goyal
2012-10-25  6:10                           ` Mimi Zohar
2012-10-25 14:10                             ` Vivek Goyal
2012-10-25 18:40                               ` Mimi Zohar
2012-10-25 18:55                                 ` Vivek Goyal
2012-10-26  1:15                                   ` Mimi Zohar
2012-10-26  2:39                                     ` Matthew Garrett
2012-10-26  3:30                                       ` Eric W. Biederman
2012-10-26 17:06                                       ` Vivek Goyal
2012-10-26 18:37                                         ` Mimi Zohar
2012-11-01 13:10                                           ` Vivek Goyal
2012-11-01 13:53                                             ` Vivek Goyal
2012-11-01 14:29                                               ` Mimi Zohar
2012-11-01 14:43                                                 ` Vivek Goyal
2012-11-01 14:52                                                   ` Matthew Garrett
2012-11-02 13:23                                                     ` Vivek Goyal
2012-11-02 14:29                                                       ` Balbir Singh
2012-11-02 14:36                                                         ` Vivek Goyal
2012-11-03  3:02                                                           ` Balbir Singh
2012-11-02 21:34                                                         ` H. Peter Anvin
2012-11-02 21:32                                                       ` Eric W. Biederman
2012-11-05 18:03                                                         ` Vivek Goyal
2012-11-05 19:44                                                           ` Eric W. Biederman
2012-11-05 20:42                                                             ` Vivek Goyal
2012-11-05 23:01                                                               ` H. Peter Anvin
2012-11-06 19:34                                                             ` Vivek Goyal
2012-11-06 23:51                                                               ` Eric W. Biederman
2012-11-08 19:40                                                                 ` Vivek Goyal
2012-11-08 19:45                                                                   ` Vivek Goyal
2012-11-08 21:03                                                                     ` Eric W. Biederman
2012-11-09 14:39                                                                       ` Vivek Goyal
2012-11-15  5:09                                                                         ` Eric W. Biederman
2012-11-15 12:56                                                                           ` Mimi Zohar
2012-11-08 20:46                                                                   ` Mimi Zohar
2012-11-01 14:51                                                 ` Vivek Goyal
2012-11-01 14:57                                                   ` Matthew Garrett
2012-11-01 15:10                                                     ` Khalid Aziz
2012-11-01 16:23                                                       ` Matthew Garrett
2012-11-02 16:57                                                         ` Khalid Aziz
2012-10-26 17:59                                       ` Mimi Zohar
2012-10-26 18:19                                         ` Matthew Garrett
2012-10-26 18:25                                           ` Mimi Zohar
2012-10-23 15:51                     ` [RFC] Kdump with UEFI secure boot (Re: [PATCH v2] kdump: pass acpi_rsdp= to 2nd kernel for efi booting) Eric W. Biederman
2012-10-23 17:18                       ` Vivek Goyal
2012-10-19 17:53               ` Vivek Goyal
2012-10-22 21:15                 ` Eric W. Biederman
2012-11-02 21:36                   ` H. Peter Anvin
2012-11-05 18:11                     ` Vivek Goyal
2012-11-05 19:54                       ` Eric W. Biederman

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20121019143112.GB27052@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=dyoung@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=horms@verge.net.au \
    --cc=hpa@zytor.com \
    --cc=kexec@lists.infradead.org \
    --cc=khalid@gonehiking.org \
    --cc=mjg@redhat.com \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox