linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>, Greg KH <greg@kroah.com>,
	linux-kernel@vger.kernel.org, kexec@lists.infradead.org,
	hpa@zytor.com, Peter Jones <pjones@redhat.com>,
	Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH 4/6] kexec: A new system call, kexec_file_load, for in kernel kexec
Date: Tue, 26 Nov 2013 09:27:59 -0500	[thread overview]
Message-ID: <20131126142759.GA5473@redhat.com> (raw)
In-Reply-To: <87fvqj2vxz.fsf@xmission.com>

On Tue, Nov 26, 2013 at 04:23:36AM -0800, Eric W. Biederman wrote:
> Vivek Goyal <vgoyal@redhat.com> writes:
> 
> > On Fri, Nov 22, 2013 at 07:39:14PM -0800, Eric W. Biederman wrote:
> >
> > [..]
> >> > Hmm..., I am running out of ideas here. This is what I understand.
> >> >
> >> > - If I sign the bzImage (using PKCS1.5 signature), and later it is signed
> >> >   with authenticode format signatures, then PKCS1.5 signatures will not be
> >> >   valid as PE/COFF signing will do some modification to PE/COFF header in
> >> >   bzImage. And another problem is that then I don't have a way to find
> >> >   PKCS1.5 signature.
> >> >
> >> > - If bzImage is first signed with authenticode format signature and then
> >> >   signed using PKCS1.5 signature, then  authenticode format signature
> >> >   will become invalid as it will also hash the data appened at the end
> >> >   of file.
> >> >
> >> > So looks like both signatures can't co-exist on same file. That means
> >> > one signature has to be detached.
> >> >
> >> > I am beginning to think that create a kernel option which allows to choose
> >> > between attached and detached signatures. Extend kexec syscall to allow
> >> > a parameter to pass in detached signatures. If detached signatures are
> >> > not passed, then look for signatures at the end of file. That way, those
> >> > who are signing kernels using platform specific format (authenticode) in 
> >> > this case, they can generate detached signature while others can just
> >> > use attached signatures.
> >> >
> >> > Any thoughts on how this should be handled?
> >> 
> >> Inside of a modern bzImage there is an embedded ELF image.  How about in
> >> userspace we just strip out the embedded ELF image and write that to a
> >> file.  Then we can use the same signature checking scheme as we do for
> >> kernel modules.  And you only have to support one file format.
> >
> > I think there is a problem with that. And that we lose the additional
> > metadata info present in bzImage which is important.
> >
> > For example, knowing how much memory kernel will consume before it
> > sets up its own GDT and page tables (init_size) is very important. That
> > gives image loader lot of flexibility in figuring out where to place rest
> > of the components safely (initrd, GDT, page tables, ELF header segment, 
> > backup region etc).
> 
> The init_size should be reflected in the .bss of the ELF segments.  If
> not it is a bug when generating the kernel ELF headers and should be
> fixed.
> 
> For use by kexec I don't see any issues with just signing the embedded
> ELF image.

Hmm..., I will check this.

I have another concern though. If we extract it and write it to a file,
this assumes that we have a good destination where file can be written.
This atleast does not seem to be useful to chrome OS people where root
is read only and if a kernel is coming from root, then they know it
can be trusted.

Being able to write kernel to a file and then load it feels little odd to
me. Though this should be allowed but this should not be mandatory.

I think if we allow passing detached signature in kexec system call, then
it makes it much more flexible. We should be able to do what you are
suggesting at the same time it will also keep the possibility open for what
chromeOS developers are looking for.

Thanks
Vivek

  reply	other threads:[~2013-11-26 14:28 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-20 17:50 [PATCH 0/6] kexec: A new system call to allow in kernel loading Vivek Goyal
2013-11-20 17:50 ` [PATCH 1/6] kexec: Export vmcoreinfo note size properly Vivek Goyal
2013-11-21 18:59   ` Greg KH
2013-11-21 19:08     ` Vivek Goyal
2013-11-20 17:50 ` [PATCH 2/6] kexec: Move segment verification code in a separate function Vivek Goyal
2013-11-20 17:50 ` [PATCH 3/6] resource: Provide new functions to walk through resources Vivek Goyal
2013-11-20 17:50 ` [PATCH 4/6] kexec: A new system call, kexec_file_load, for in kernel kexec Vivek Goyal
2013-11-21 19:03   ` Greg KH
2013-11-21 19:06     ` Matthew Garrett
2013-11-21 19:13       ` Vivek Goyal
2013-11-21 19:19         ` Matthew Garrett
2013-11-21 19:24           ` Vivek Goyal
2013-11-22 18:57           ` Vivek Goyal
2013-11-23  3:39             ` Eric W. Biederman
2013-11-25 16:39               ` Vivek Goyal
2013-11-26 12:23                 ` Eric W. Biederman
2013-11-26 14:27                   ` Vivek Goyal [this message]
2013-12-19 12:54                     ` Torsten Duwe
2013-12-20 14:19                       ` Vivek Goyal
2013-12-20 23:11                         ` Eric W. Biederman
2013-12-20 23:20                           ` Kees Cook
2013-12-21 11:38                             ` Torsten Duwe
2014-01-02 20:39                             ` Vivek Goyal
2014-01-02 20:56                               ` H. Peter Anvin
2014-01-06 21:33                                 ` Josh Boyer
2014-01-07  4:22                                   ` H. Peter Anvin
2013-12-20 23:20                           ` H. Peter Anvin
2013-12-21  1:32                             ` Eric W. Biederman
2013-12-21  3:32                               ` H. Peter Anvin
2013-12-21 12:15                                 ` Torsten Duwe
2013-11-21 19:16     ` Vivek Goyal
2013-11-22  1:03     ` Kees Cook
2013-11-22  2:13       ` Vivek Goyal
2013-11-22 20:42   ` Jiri Kosina
2014-01-17 19:17     ` Vivek Goyal
2013-11-29  3:10   ` Baoquan He
2013-12-02 15:27     ` WANG Chao
2013-12-02 15:44     ` Vivek Goyal
2013-12-04  1:35       ` Baoquan He
2013-12-04 17:19         ` Vivek Goyal
2013-12-04  1:56   ` Baoquan He
2013-12-04  8:19     ` Baoquan He
2013-12-04 17:32     ` Vivek Goyal
2013-11-20 17:50 ` [PATCH 5/6] kexec-bzImage: Support for loading bzImage using 64bit entry Vivek Goyal
2013-11-21 19:07   ` Greg KH
2013-11-21 19:21     ` Vivek Goyal
2013-11-22 15:24       ` H. Peter Anvin
2013-11-28 11:35   ` Baoquan He
2013-12-02 15:36     ` Vivek Goyal
2013-11-20 17:50 ` [PATCH 6/6] kexec: Support for Kexec on panic using new system call Vivek Goyal
2013-11-28 11:28   ` Baoquan He
2013-12-02 15:30     ` Vivek Goyal
2013-12-04  1:51       ` Baoquan He
2013-12-04 17:20         ` Vivek Goyal
2013-12-04  1:41   ` Baoquan He
2013-12-04 17:19     ` Vivek Goyal
2013-11-21 18:58 ` [PATCH 0/6] kexec: A new system call to allow in kernel loading Greg KH
2013-11-21 19:07   ` Vivek Goyal
2013-11-21 19:46     ` Vivek Goyal
2013-11-21 19:06 ` Geert Uytterhoeven
2013-11-21 19:14   ` Vivek Goyal
2013-11-21 23:07 ` Eric W. Biederman
2013-11-22  1:28   ` H. Peter Anvin
2013-11-22  2:35     ` Vivek Goyal
2013-11-22  2:40       ` H. Peter Anvin
2013-11-22  1:55   ` Vivek Goyal
2013-11-22  9:09     ` Geert Uytterhoeven
2013-11-22 13:30       ` Jiri Kosina
2013-11-22 13:46         ` Vivek Goyal
2013-11-22 13:50           ` Jiri Kosina
2013-11-22 15:33             ` Vivek Goyal
2013-11-22 17:45               ` Kees Cook
2013-11-22 13:43       ` Vivek Goyal
2013-11-22 15:25         ` Geert Uytterhoeven
2013-11-22 15:33           ` Jiri Kosina
2013-11-22 15:57             ` Eric Paris
2013-11-22 16:04               ` Jiri Kosina
2013-11-22 16:08                 ` Vivek Goyal
2013-11-22 13:34     ` Eric W. Biederman
2013-11-22 14:19       ` Vivek Goyal
2013-11-22 19:48         ` Greg KH
2013-11-23  3:23         ` Eric W. Biederman
2013-12-04 19:34           ` Vivek Goyal
2013-12-05  4:10             ` Eric W. Biederman
2013-11-25 10:04       ` Michael Holzheu
2013-11-25 15:36         ` Vivek Goyal
2013-11-25 16:15           ` Michael Holzheu
2013-11-22  0:55 ` HATAYAMA Daisuke
2013-11-22  2:03   ` Vivek Goyal
2013-12-03 13:23 ` Baoquan He

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=20131126142759.GA5473@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=greg@kroah.com \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=pjones@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;
as well as URLs for NNTP newsgroup(s).