public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: Dave Young <dyoung@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Josh Boyer <jwboyer@fedoraproject.org>,
	David Howells <dhowells@redhat.com>,
	kexec <kexec@lists.infradead.org>,
	"Linux-Kernel@Vger. Kernel. Org" <linux-kernel@vger.kernel.org>,
	Petr Tesarik <ptesarik@suse.cz>
Subject: Re: kexec_load(2) bypasses signature verification
Date: Fri, 19 Jun 2015 09:09:05 -0400	[thread overview]
Message-ID: <20150619130905.GA13714@redhat.com> (raw)
In-Reply-To: <20150619070431.GI4636@dhcp-128-32.nay.redhat.com>

On Fri, Jun 19, 2015 at 03:04:31PM +0800, Dave Young wrote:
> On 06/16/15 at 09:47pm, Vivek Goyal wrote:
> > On Tue, Jun 16, 2015 at 08:32:37PM -0500, Eric W. Biederman wrote:
> > > Vivek Goyal <vgoyal@redhat.com> writes:
> > > 
> > > > On Tue, Jun 16, 2015 at 02:38:31PM -0500, Eric W. Biederman wrote:
> > > >> 
> > > >> Adding Vivek as he is the one who implemented kexec_file_load.
> > > >> I was hoping he would respond to this thread, and it looks like he
> > > >> simply has not ever been Cc'd.
> > > >> 
> > > >> Theodore Ts'o <tytso@mit.edu> writes:
> > > >> 
> > > >> > On Mon, Jun 15, 2015 at 09:37:05AM -0400, Josh Boyer wrote:
> > > >> >> The bits that actually read Secure Boot state out of the UEFI
> > > >> >> variables, and apply protections to the machine to avoid compromise
> > > >> >> under the SB threat model.  Things like disabling the old kexec...
> > > >> >
> > > >> > I don't have any real interest in using Secure Boot, but I *am*
> > > >> > interested in using CONFIG_KEXEC_VERIFY_SIG[1].  So perhaps we need to
> > > >> > have something similar to what we have with signed modules in terms of
> > > >> > CONFIG_MODULE_SIG_FORCE and module/sig_enforce, but for
> > > >> > KEXEC_VERIFY_SIG.  This would mean creating a separate flag
> > > >> > independent of the one Linus suggested for Secure Boot, but since we
> > > >> > have one for signed modules, we do have precedent for this sort of
> > > >> > thing.
> > > >> 
> > > >> My overall request with respect to kexec has been that we implement
> > > >> things that make sense outside of the bizarre threat model of the Linux
> > > >> folks who were talking about secure boot.
> > > >> 
> > > >> nI have not navigated the labyrinth of config options but having a way to
> > > >> only boot signed things with kexec seems a completely sensible way to
> > > >> operate in the context of signed images.
> > > >> 
> > > >> I don't know how much that will help given that actors with sufficient
> > > >> resources have demonstrated the ability to steal private keys, but
> > > >> assuming binary signing is an effective technique (or why else do it)
> > > >> then having an option to limit kexec to only loading signed images seems
> > > >> sensible.
> > > >
> > > > I went through the mail chain on web and here are my thoughts.
> > > >
> > > > - So yes, upstream does not have the logic which automatically disables
> > > >   the old syscall (kexec_load()) on secureboot systems. Distributions
> > > >   carry those patches.
> > > >
> > > > - This KEXEC_VERIFY_SIG option only cotrols the behavior for
> > > >   kexec_file_load() syscall and is not meant to directly affect any
> > > >   behavior of old syscall (kexec_load()). I think I should have named
> > > >   it KEXEC_FILE_VERIFY_SIG. Though help text makes it clear.
> > > >   "Verify kernel signature during kexec_file_load() syscall".
> > > >
> > > > - I think disabling old system call if KEXEC_VERIFY_SIG() is set
> > > >   will break existing setup which use old system call by default, except
> > > >   the case of secureboot system. And old syscall path is well tested
> > > >   and new syscall might not be in a position to support all the corner
> > > >   cases, atleast as of now.
> > > >
> > > > Ted, 
> > > >
> > > > So looks like you are looking for a system/option where you just want to
> > > > always make use of kexec_file_load() and disable kexec_load(). This sounds
> > > > like you want a kernel where kexec_load() is compiled out and you want
> > > > only kexec_file_load() in.
> > > >
> > > > Right now one can't do that becase kexec_file_load() depends on
> > > > CONFIG_KEXEC option.
> > > >
> > > > I am wondering that how about making CONFIG_KEXEC_FILE_LOAD independent
> > > > of CONFIG_KEXEC. That way one can set CONFIG_KEXEC_VERIFY_SIG=y, and
> > > > only signed kernel can be kexeced on that system.
> > > >
> > > > This should gel well with long term strategy of deprecating kexec_load()
> > > > at some point of time when kexec_file_load() is ready to completely
> > > > replace it.
> > > 
> > > Interesting.
> > > 
> > > I suspect that what we want is to have CONFIG_KEXEC for the core
> > > and additional CONFIG_KEXEC_LOAD option that covers that kexec_load call.
> > > 
> > > That should make it trivially easy to disable the kexec_load system call
> > > in cases where people care.
> > 
> > Or, we could create another option CONFIG_KEXEC_CORE/CONFIG_KEXEC_COMMON
> > which will be automatically selected when either CONFIG_KEXEC or
> > CONIG_KEXEC_FILE are selected.
> > 
> > All common code can go under this option and rest can go under respective
> > config options.
> > 
> > That way, those who have CONFIG_KEXEC=y in old config files will not be
> > broken. They don't have to learn about new options at all.
> 
> Vivek, It is slight better for reusing old config file, but CONFIG_KEXEC_LOAD
> sounds better. Do we have to maintain the compability for kconfig?
> 
> KEXEC_COMMON/KEXEC/KEXEC_FILE_LOAD is a little confusing. CONFIG_KEXEC
> should be the common kexec stuff naturally, it is strange to use CONFIG_KEXEC
> for only kexec_load syscall.

Hi Dave,

I think as a user I would like my old config file to work with new kernel.
It is a good idea to keep old config options until and unless we have a
very good reason.

To me following should be reasonable.

CONFIG_KEXEC --> Enable old syscall
CONFIG_FILE_KEXEC --> Enable new syscall

In fact we might not have to introduce CONFIG_KEXEC_COMMON. We can
just use

#ifdef (CONFIG_KEXEC) | ifdef (CONFIG_FILE_KEXEC
  /* Common code between two syscalls */
#endif

That way we don't introduce any new config options and stick to existing
ones. 

Thanks
Vivek
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2015-06-19 13:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-15  3:50 kexec_load(2) bypasses signature verification Theodore Ts'o
2015-06-15 12:14 ` Josh Boyer
2015-06-15 13:17   ` Theodore Ts'o
2015-06-15 13:37     ` Josh Boyer
2015-06-15 20:01       ` Theodore Ts'o
2015-06-16 19:38         ` Eric W. Biederman
2015-06-16 20:27           ` Vivek Goyal
2015-06-17  1:32             ` Eric W. Biederman
2015-06-17  1:47               ` Vivek Goyal
2015-06-18  1:16                 ` Dave Young
2015-06-18  2:02                   ` Dave Young
2015-06-18 13:30                     ` Vivek Goyal
2015-06-18 14:41                       ` Eric W. Biederman
2015-06-19  6:21                       ` Dave Young
2015-06-19  8:18                         ` Dave Young
2015-06-19 13:09                           ` Vivek Goyal
2015-06-25  8:48                             ` Dave Young
2015-06-25 15:59                               ` Vivek Goyal
2015-06-26  1:59                                 ` Dave Young
2015-06-19  7:04                 ` Dave Young
2015-06-19 13:09                   ` Vivek Goyal [this message]
2015-06-17  3:26             ` Theodore Ts'o
2015-06-17 10:55         ` One Thousand Gnomes
2015-06-18  1:25         ` Dave Young

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=20150619130905.GA13714@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=dyoung@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=jwboyer@fedoraproject.org \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ptesarik@suse.cz \
    --cc=tytso@mit.edu \
    /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