public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 0/3] extend kexec_file_load system call
Date: Tue, 12 Jul 2016 16:02:46 +0200	[thread overview]
Message-ID: <1911992.H2WpLRr2Fi@wuerfel> (raw)
In-Reply-To: <87furf7ztv.fsf@x220.int.ebiederm.org>

On Tuesday, July 12, 2016 8:25:48 AM CEST Eric W. Biederman wrote:
> AKASHI Takahiro <takahiro.akashi@linaro.org> writes:
> 
> > Device tree blob must be passed to a second kernel on DTB-capable
> > archs, like powerpc and arm64, but the current kernel interface
> > lacks this support.
> >   
> > This patch extends kexec_file_load system call by adding an extra
> > argument to this syscall so that an arbitrary number of file descriptors
> > can be handed out from user space to the kernel.
> >
> > See the background [1].
> >
> > Please note that the new interface looks quite similar to the current
> > system call, but that it won't always mean that it provides the "binary
> > compatibility."
> >
> > [1] http://lists.infradead.org/pipermail/kexec/2016-June/016276.html
> 
> So this design is wrong.  The kernel already has the device tree blob,
> you should not be extracting it from the kernel munging it, and then
> reinserting it in the kernel if you want signatures and everything to
> pass.
> 
> What x86 does is pass it's equivalent of the device tree blob from one
> kernel to another directly and behind the scenes.  It does not go
> through userspace for this.
> 
> Until a persuasive case can be made for going around the kernel and
> probably adding a feature (like code execution) that can be used to
> defeat the signature scheme I am going to nack this.
> 
> Nacked-by: "Eric W. Biederman" <ebiederm@xmission.com>
> 
> I am happy to see support for other architectures, but for the sake of
> not moving some code in the kernel let's not build an attackable
> infrastructure.
> 

For historic context, the flattened devicetree format that we now use
to pass data about the system from boot loader to kernel was initially
introduced specifically for the purpose of enabling kexec:

On Open Firmware, the DT is extracted from running firmware and copied
into dynamically allocated data structures. After a kexec, the runtime
interface to the firmware is not available, so the flattened DT format
was created as a way to pass the same data in a binary blob to the new
kernel in a format that can be read from the kernel by walking the
directories in /proc/device-tree/*.

There are a couple of reasons for modifying the devicetree:

- For kboot/petitboot, you can have a kernel that is not booted through
  DT at all but hardwired to a particular machine, and that passes
  a DT for the entire hardware to the kernel that you actually want to
  run.

- for kdump, you need to tell the new kernel about the modified location
  of the memory, so the dump kernel doesn't overwrite the contents
  it wants to dump

- we typically ship devicetree sources for embedded machines with the
  kernel sources. As more hardware of the system gets enabled, the
  devicetree gains extra nodes and properties that describe the hardware
  more completely, so we need to use the latest DT blob to use all
  the drivers

- in some cases, kernels will fail to boot at all with an older version
  of the DT, or fail to use the devices that were working on the
  earlier kernel. This is usually considered a bug, but it's not rare

- In some cases, the kernel can update its DT at runtime, and the new
  settings are expected to be available in the new kernel too, though
  there are cases where you actually don't want the modified contents.

	Arnd

  parent reply	other threads:[~2016-07-12 14:02 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-12  1:41 [RFC 0/3] extend kexec_file_load system call AKASHI Takahiro
2016-07-12  1:41 ` [RFC 1/3] syscall: add kexec_file_load to generic unistd.h AKASHI Takahiro
2016-07-12  1:42 ` [RFC 2/3] kexec: add dtb info to struct kimage AKASHI Takahiro
2016-07-12  1:42 ` [RFC 3/3] kexec: extend kexec_file_load system call AKASHI Takahiro
2016-07-15 13:09   ` Vivek Goyal
2016-07-15 13:19     ` Mark Rutland
2016-07-18  2:30       ` Dave Young
2016-07-18 10:07         ` Mark Rutland
2016-07-19  0:55           ` Dave Young
2016-07-19 10:52             ` Mark Rutland
2016-07-19 12:24               ` Vivek Goyal
2016-07-19 12:47                 ` Mark Rutland
2016-07-19 13:26                   ` Vivek Goyal
2016-07-20 11:41         ` David Laight
2016-07-21  9:21           ` Russell King - ARM Linux
2016-07-18  2:33     ` Dave Young
2016-07-27  0:24   ` [PATCH v2 " Thiago Jung Bauermann
2016-08-05 20:46     ` Thiago Jung Bauermann
2016-07-12 13:25 ` [RFC 0/3] " Eric W. Biederman
2016-07-12 13:58   ` Thiago Jung Bauermann
2016-07-12 14:02     ` Vivek Goyal
2016-07-12 23:45       ` Stewart Smith
2016-07-13 13:27         ` Vivek Goyal
2016-07-12 14:02   ` Arnd Bergmann [this message]
2016-07-12 14:18     ` Vivek Goyal
2016-07-12 14:24       ` Arnd Bergmann
2016-07-12 14:50         ` Mark Rutland
2016-07-13  2:36           ` Dave Young
2016-07-13  8:01             ` Arnd Bergmann
2016-07-13  8:23               ` Stewart Smith
2016-07-13  9:41               ` Mark Rutland
2016-07-13 13:13                 ` Arnd Bergmann
2016-07-13 18:45                   ` Thiago Jung Bauermann
2016-07-13 19:59                     ` Arnd Bergmann
2016-07-14  2:18                       ` Thiago Jung Bauermann
2016-07-14  8:29                         ` Arnd Bergmann
2016-07-15  1:44                           ` Thiago Jung Bauermann
2016-07-15  7:31                             ` Arnd Bergmann
2016-07-15 13:26                               ` Vivek Goyal
2016-07-15 13:33                                 ` Mark Rutland
2016-07-15 15:29                                   ` Thiago Jung Bauermann
2016-07-15 15:47                                     ` Mark Rutland
2016-07-15 13:42                                 ` Russell King - ARM Linux
2016-07-15 20:26                                   ` Arnd Bergmann
2016-07-15 21:03                                     ` Thiago Jung Bauermann
2016-07-22  0:09                                       ` Thiago Jung Bauermann
2016-07-22  0:53                                         ` Jeremy Kerr
2016-07-22  2:54                                         ` Michael Ellerman
2016-07-22 20:41                                           ` Thiago Jung Bauermann
2016-07-15  8:49                   ` Russell King - ARM Linux
2016-07-15 13:03                     ` Vivek Goyal
2016-07-13  9:34             ` Mark Rutland
2016-07-13 17:38               ` AKASHI Takahiro
2016-07-13 17:58                 ` Mark Rutland
2016-07-13 19:57                   ` Arnd Bergmann
2016-07-14 12:42                     ` Mark Rutland
2016-07-14  1:54                 ` Dave Young
2016-07-14  1:50               ` Dave Young
2016-07-12 16:25   ` Thiago Jung Bauermann
2016-07-12 20:58     ` Petr Tesarik
2016-07-12 21:22       ` Eric W. Biederman
2016-07-12 21:36         ` Eric W. Biederman
2016-07-12 21:53         ` Petr Tesarik
2016-07-12 22:18       ` Russell King - ARM Linux
2016-07-13  4:59         ` Stewart Smith
2016-07-13  7:36           ` Russell King - ARM Linux
2016-07-13  7:47             ` Ard Biesheuvel
2016-07-13  8:09               ` Russell King - ARM Linux
2016-07-13  8:20               ` Stewart Smith
2016-07-13  7:55             ` Stewart Smith
2016-07-13  8:26               ` Russell King - ARM Linux
2016-07-13  8:36                 ` Dave Young
2016-07-13  8:57                 ` Petr Tesarik
2016-07-13 13:03                 ` Vivek Goyal
2016-07-13 17:40                   ` Russell King - ARM Linux
2016-07-13 18:22                     ` Vivek Goyal
2016-07-18 12:46                       ` Balbir Singh
2016-07-18 13:26                         ` Vivek Goyal
2016-07-18 13:38                           ` Vivek Goyal
2016-07-20  3:45                           ` Balbir Singh
2016-07-20  8:35                             ` Russell King - ARM Linux
2016-07-20 10:47                               ` Michael Ellerman
2016-07-20 11:12                               ` Arnd Bergmann
2016-07-20 15:50                                 ` Thiago Jung Bauermann
2016-07-20 12:46                               ` Vivek Goyal
2016-07-20 12:27                             ` Vivek Goyal
2016-07-12 23:41       ` Stewart Smith
2016-07-13 13:25         ` Vivek Goyal

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=1911992.H2WpLRr2Fi@wuerfel \
    --to=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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