All of lore.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Vivek Goyal <vgoyal@redhat.com>
Cc: mjg59@srcf.ucam.org, kexec@lists.infradead.org,
	linux-kernel@vger.kernel.org, greg@kroah.com, hpa@zytor.com
Subject: Re: [PATCH 0/6] kexec: A new system call to allow in kernel loading
Date: Fri, 22 Nov 2013 05:34:03 -0800	[thread overview]
Message-ID: <87txf4y304.fsf@xmission.com> (raw)
In-Reply-To: <20131122015518.GA31921@redhat.com> (Vivek Goyal's message of "Thu, 21 Nov 2013 20:55:18 -0500")

Vivek Goyal <vgoyal@redhat.com> writes:

> On Thu, Nov 21, 2013 at 03:07:04PM -0800, Eric W. Biederman wrote:
>
> [..]
>> 
>> Before you are done we need an ELF loader.  bzImage really is very
>> uninteresting.  To the point I am not at all convinced that an in kernel
>> loader should support it.
>
> Hi Eric,
>
> Why ELF case is so interesting. I have not use kexec to boot ELF
> images in years and have not seen others using it too. In fact bzImage
> seems to be the most common kernel image format for x86, most of the distros
> ship and use.

ELF is interesting because it is the minimal file format that does
everything you need.   So especially for a proof of concept ELF needs to
come first.  There is an extra virtual address field in the ELF segment
header but otherwise ELF does not have any unnecessary fields.

ELF is interesting because it is the native kernel file format on all
architectures linux supports including x86.

ELF is interesting because producing an ELF image in practice requires
a trivial amount of tooling so it is a good general purpose format to
support.

> So first I did the loader for the common use case. There is no reason 
> that one can't write another loader for ELF images. It just bloats
> the code. Hence I thought that other image loaders can follow slowly. I am
> not sure why do you say that bzImage is uninteresting. 

If you boot anything that isn't a linux kernel bzImage on x86 bzImage is
not the solution you are using.  Furthermore because bzImage is a bunch
of hacks thrown together bzImage keeps evolving in weird and strange
ways.  The complexity of supporting bzImage only grows through the
years.

At the end of the day we will probably need to support bzImage in some
form (possibly just going so far as in userspace extracting the embedded
ELF image) as there are support benefits of only having one blob you
sling around.

But let's first start with the sane general case before worring about x86
legacy weirdness.

For a long term stable ABI to support booting things other than the
linux kernel bzImage is not my first choice.

>> There is also a huge missing piece of this in that your purgatory is not
>> checking a hash of the loaded image before jumping too it.  Without that
>> this is a huge regression at least for the kexec on panic case.  We
>> absolutely need to check that the kernel sitting around in memory has
>> not been corrupted before we let it run very far.
>
> Agreed. This should not be hard. It is just a matter of calcualting
> digest of segments. I will store it in kimge and verify digest again
> before passing control to control page. Will fix it in next version.

Nak.  The verification needs to happen in purgatory. 

The verification needs to happen in code whose runtime environment is
does not depend on random parts of the kernel.  Anything else is a
regression in maintainability and reliability.

It is the wrong direction to add any code to what needs to run in the
known broken environment of the kernel when a panic happens.

Which means that you almost certainly need to go to the trouble of
supporting the complexity needed to support purgatory code written in C.

(For those just tuning in purgatory is our term for the code that runs
between the kernels to do those things that can not happen a priori).

Eric

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

WARNING: multiple messages have this Message-ID (diff)
From: ebiederm@xmission.com (Eric W. Biederman)
To: Vivek Goyal <vgoyal@redhat.com>
Cc: linux-kernel@vger.kernel.org, kexec@lists.infradead.org,
	hpa@zytor.com, mjg59@srcf.ucam.org, greg@kroah.com
Subject: Re: [PATCH 0/6] kexec: A new system call to allow in kernel loading
Date: Fri, 22 Nov 2013 05:34:03 -0800	[thread overview]
Message-ID: <87txf4y304.fsf@xmission.com> (raw)
In-Reply-To: <20131122015518.GA31921@redhat.com> (Vivek Goyal's message of "Thu, 21 Nov 2013 20:55:18 -0500")

Vivek Goyal <vgoyal@redhat.com> writes:

> On Thu, Nov 21, 2013 at 03:07:04PM -0800, Eric W. Biederman wrote:
>
> [..]
>> 
>> Before you are done we need an ELF loader.  bzImage really is very
>> uninteresting.  To the point I am not at all convinced that an in kernel
>> loader should support it.
>
> Hi Eric,
>
> Why ELF case is so interesting. I have not use kexec to boot ELF
> images in years and have not seen others using it too. In fact bzImage
> seems to be the most common kernel image format for x86, most of the distros
> ship and use.

ELF is interesting because it is the minimal file format that does
everything you need.   So especially for a proof of concept ELF needs to
come first.  There is an extra virtual address field in the ELF segment
header but otherwise ELF does not have any unnecessary fields.

ELF is interesting because it is the native kernel file format on all
architectures linux supports including x86.

ELF is interesting because producing an ELF image in practice requires
a trivial amount of tooling so it is a good general purpose format to
support.

> So first I did the loader for the common use case. There is no reason 
> that one can't write another loader for ELF images. It just bloats
> the code. Hence I thought that other image loaders can follow slowly. I am
> not sure why do you say that bzImage is uninteresting. 

If you boot anything that isn't a linux kernel bzImage on x86 bzImage is
not the solution you are using.  Furthermore because bzImage is a bunch
of hacks thrown together bzImage keeps evolving in weird and strange
ways.  The complexity of supporting bzImage only grows through the
years.

At the end of the day we will probably need to support bzImage in some
form (possibly just going so far as in userspace extracting the embedded
ELF image) as there are support benefits of only having one blob you
sling around.

But let's first start with the sane general case before worring about x86
legacy weirdness.

For a long term stable ABI to support booting things other than the
linux kernel bzImage is not my first choice.

>> There is also a huge missing piece of this in that your purgatory is not
>> checking a hash of the loaded image before jumping too it.  Without that
>> this is a huge regression at least for the kexec on panic case.  We
>> absolutely need to check that the kernel sitting around in memory has
>> not been corrupted before we let it run very far.
>
> Agreed. This should not be hard. It is just a matter of calcualting
> digest of segments. I will store it in kimge and verify digest again
> before passing control to control page. Will fix it in next version.

Nak.  The verification needs to happen in purgatory. 

The verification needs to happen in code whose runtime environment is
does not depend on random parts of the kernel.  Anything else is a
regression in maintainability and reliability.

It is the wrong direction to add any code to what needs to run in the
known broken environment of the kernel when a panic happens.

Which means that you almost certainly need to go to the trouble of
supporting the complexity needed to support purgatory code written in C.

(For those just tuning in purgatory is our term for the code that runs
between the kernels to do those things that can not happen a priori).

Eric

  parent reply	other threads:[~2013-11-22 13:34 UTC|newest]

Thread overview: 180+ 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 ` Vivek Goyal
2013-11-20 17:50 ` [PATCH 1/6] kexec: Export vmcoreinfo note size properly Vivek Goyal
2013-11-20 17:50   ` Vivek Goyal
2013-11-21 18:59   ` Greg KH
2013-11-21 18:59     ` Greg KH
2013-11-21 19:08     ` Vivek Goyal
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   ` 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   ` 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-20 17:50   ` Vivek Goyal
2013-11-21 19:03   ` Greg KH
2013-11-21 19:03     ` Greg KH
2013-11-21 19:06     ` Matthew Garrett
2013-11-21 19:06       ` Matthew Garrett
2013-11-21 19:13       ` Vivek Goyal
2013-11-21 19:13         ` Vivek Goyal
2013-11-21 19:19         ` Matthew Garrett
2013-11-21 19:19           ` Matthew Garrett
2013-11-21 19:24           ` Vivek Goyal
2013-11-21 19:24             ` Vivek Goyal
2013-11-22 18:57           ` Vivek Goyal
2013-11-22 18:57             ` Vivek Goyal
2013-11-23  3:39             ` Eric W. Biederman
2013-11-23  3:39               ` Eric W. Biederman
2013-11-25 16:39               ` Vivek Goyal
2013-11-25 16:39                 ` Vivek Goyal
2013-11-26 12:23                 ` Eric W. Biederman
2013-11-26 12:23                   ` Eric W. Biederman
2013-11-26 14:27                   ` Vivek Goyal
2013-11-26 14:27                     ` Vivek Goyal
2013-12-19 12:54                     ` Torsten Duwe
2013-12-19 12:54                       ` Torsten Duwe
2013-12-20 14:19                       ` Vivek Goyal
2013-12-20 14:19                         ` Vivek Goyal
2013-12-20 23:11                         ` Eric W. Biederman
2013-12-20 23:11                           ` Eric W. Biederman
2013-12-20 23:20                           ` Kees Cook
2013-12-20 23:20                             ` Kees Cook
2013-12-21 11:38                             ` Torsten Duwe
2013-12-21 11:38                               ` Torsten Duwe
2014-01-02 20:39                             ` Vivek Goyal
2014-01-02 20:39                               ` Vivek Goyal
2014-01-02 20:56                               ` H. Peter Anvin
2014-01-02 20:56                                 ` H. Peter Anvin
2014-01-06 21:33                                 ` Josh Boyer
2014-01-06 21:33                                   ` Josh Boyer
2014-01-07  4:22                                   ` H. Peter Anvin
2014-01-07  4:22                                     ` H. Peter Anvin
2013-12-20 23:20                           ` H. Peter Anvin
2013-12-20 23:20                             ` H. Peter Anvin
2013-12-21  1:32                             ` Eric W. Biederman
2013-12-21  1:32                               ` Eric W. Biederman
2013-12-21  3:32                               ` H. Peter Anvin
2013-12-21  3:32                                 ` H. Peter Anvin
2013-12-21 12:15                                 ` Torsten Duwe
2013-12-21 12:15                                   ` Torsten Duwe
2013-11-21 19:16     ` Vivek Goyal
2013-11-21 19:16       ` Vivek Goyal
2013-11-22  1:03     ` Kees Cook
2013-11-22  1:03       ` Kees Cook
2013-11-22  2:13       ` Vivek Goyal
2013-11-22  2:13         ` Vivek Goyal
2013-11-22 20:42   ` Jiri Kosina
2013-11-22 20:42     ` Jiri Kosina
2014-01-17 19:17     ` Vivek Goyal
2014-01-17 19:17       ` Vivek Goyal
2013-11-29  3:10   ` Baoquan He
2013-11-29  3:10     ` Baoquan He
2013-12-02 15:27     ` WANG Chao
2013-12-02 15:27       ` WANG Chao
2013-12-02 15:44     ` Vivek Goyal
2013-12-02 15:44       ` Vivek Goyal
2013-12-04  1:35       ` Baoquan He
2013-12-04  1:35         ` Baoquan He
2013-12-04 17:19         ` Vivek Goyal
2013-12-04 17:19           ` Vivek Goyal
2013-12-04  1:56   ` Baoquan He
2013-12-04  1:56     ` Baoquan He
2013-12-04  8:19     ` Baoquan He
2013-12-04  8:19       ` Baoquan He
2013-12-04 17:32     ` Vivek Goyal
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-20 17:50   ` Vivek Goyal
2013-11-21 19:07   ` Greg KH
2013-11-21 19:07     ` Greg KH
2013-11-21 19:21     ` Vivek Goyal
2013-11-21 19:21       ` Vivek Goyal
2013-11-22 15:24       ` H. Peter Anvin
2013-11-22 15:24         ` H. Peter Anvin
2013-11-28 11:35   ` Baoquan He
2013-11-28 11:35     ` Baoquan He
2013-12-02 15:36     ` Vivek Goyal
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-20 17:50   ` Vivek Goyal
2013-11-28 11:28   ` Baoquan He
2013-11-28 11:28     ` Baoquan He
2013-12-02 15:30     ` Vivek Goyal
2013-12-02 15:30       ` Vivek Goyal
2013-12-04  1:51       ` Baoquan He
2013-12-04  1:51         ` Baoquan He
2013-12-04 17:20         ` Vivek Goyal
2013-12-04 17:20           ` Vivek Goyal
2013-12-04  1:41   ` Baoquan He
2013-12-04  1:41     ` Baoquan He
2013-12-04 17:19     ` Vivek Goyal
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 18:58   ` Greg KH
2013-11-21 19:07   ` Vivek Goyal
2013-11-21 19:07     ` Vivek Goyal
2013-11-21 19:46     ` Vivek Goyal
2013-11-21 19:46       ` Vivek Goyal
2013-11-21 19:06 ` Geert Uytterhoeven
2013-11-21 19:06   ` Geert Uytterhoeven
2013-11-21 19:14   ` Vivek Goyal
2013-11-21 19:14     ` Vivek Goyal
2013-11-21 23:07 ` Eric W. Biederman
2013-11-21 23:07   ` Eric W. Biederman
2013-11-22  1:28   ` H. Peter Anvin
2013-11-22  1:28     ` H. Peter Anvin
2013-11-22  2:35     ` Vivek Goyal
2013-11-22  2:35       ` Vivek Goyal
2013-11-22  2:40       ` H. Peter Anvin
2013-11-22  2:40         ` H. Peter Anvin
2013-11-22  1:55   ` Vivek Goyal
2013-11-22  1:55     ` Vivek Goyal
2013-11-22  9:09     ` Geert Uytterhoeven
2013-11-22  9:09       ` Geert Uytterhoeven
2013-11-22 13:30       ` Jiri Kosina
2013-11-22 13:30         ` Jiri Kosina
2013-11-22 13:46         ` Vivek Goyal
2013-11-22 13:46           ` Vivek Goyal
2013-11-22 13:50           ` Jiri Kosina
2013-11-22 13:50             ` Jiri Kosina
2013-11-22 15:33             ` Vivek Goyal
2013-11-22 15:33               ` Vivek Goyal
2013-11-22 17:45               ` Kees Cook
2013-11-22 17:45                 ` Kees Cook
2013-11-22 13:43       ` Vivek Goyal
2013-11-22 13:43         ` Vivek Goyal
2013-11-22 15:25         ` Geert Uytterhoeven
2013-11-22 15:25           ` Geert Uytterhoeven
2013-11-22 15:33           ` Jiri Kosina
2013-11-22 15:33             ` Jiri Kosina
2013-11-22 15:57             ` Eric Paris
2013-11-22 15:57               ` Eric Paris
2013-11-22 16:04               ` Jiri Kosina
2013-11-22 16:04                 ` Jiri Kosina
2013-11-22 16:08                 ` Vivek Goyal
2013-11-22 16:08                   ` Vivek Goyal
2013-11-22 13:34     ` Eric W. Biederman [this message]
2013-11-22 13:34       ` Eric W. Biederman
2013-11-22 14:19       ` Vivek Goyal
2013-11-22 14:19         ` Vivek Goyal
2013-11-22 19:48         ` Greg KH
2013-11-22 19:48           ` Greg KH
2013-11-23  3:23         ` Eric W. Biederman
2013-11-23  3:23           ` Eric W. Biederman
2013-12-04 19:34           ` Vivek Goyal
2013-12-04 19:34             ` Vivek Goyal
2013-12-05  4:10             ` Eric W. Biederman
2013-12-05  4:10               ` Eric W. Biederman
2013-11-25 10:04       ` Michael Holzheu
2013-11-25 10:04         ` Michael Holzheu
2013-11-25 15:36         ` Vivek Goyal
2013-11-25 15:36           ` Vivek Goyal
2013-11-25 16:15           ` Michael Holzheu
2013-11-25 16:15             ` Michael Holzheu
2013-11-22  0:55 ` HATAYAMA Daisuke
2013-11-22  0:55   ` HATAYAMA Daisuke
2013-11-22  2:03   ` Vivek Goyal
2013-11-22  2:03     ` Vivek Goyal
2013-12-03 13:23 ` Baoquan He
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=87txf4y304.fsf@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=greg@kroah.com \
    --cc=hpa@zytor.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=vgoyal@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.