linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: Matthew Garrett <mjg@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	Khalid Aziz <khalid@gonehiking.org>,
	kexec@lists.infradead.org, horms@verge.net.au,
	Dave Young <dyoung@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	linux kernel mailing list <linux-kernel@vger.kernel.org>,
	Mimi Zohar <zohar@linux.vnet.ibm.com>,
	"Kasatkin, Dmitry" <dmitry.kasatkin@intel.com>
Subject: Re: [RFC] Kdump with UEFI secure boot (Re: [PATCH v2] kdump: pass acpi_rsdp= to 2nd kernel for efi booting)
Date: Thu, 25 Oct 2012 11:39:37 -0400	[thread overview]
Message-ID: <20121025153937.GE9377@redhat.com> (raw)
In-Reply-To: <20121023154123.GA30730@srcf.ucam.org>

On Tue, Oct 23, 2012 at 04:41:24PM +0100, Matthew Garrett wrote:
> On Tue, Oct 23, 2012 at 10:59:20AM -0400, Vivek Goyal wrote:
> 
> > But what about creation of a new program which can call kexec_load()
> > and execute an unsigned kernel. Doesn't look like that will be
> > prevented using IMA.
> 
> Right. Trusting userspace would require a new system call that passes in 
> a signature of the userspace binary, and the kernel would then have to 
> verify the ELF object in memory in order to ensure that it 
> matches the signature.

[ CC lkml and IMA/EVM developers ]

Not sure how much of this is feasible. There is initialized data which
can change. That means we shall have to exclude initialized data from
digest. And then initialized data can be changed by attacker.

I think in the context of kexec, purgatory (which is actually a
relocatable executable), is embedded in kexec binary as "const char
purgatory[]". I am assuming that it will show up as initialized data
in /sbin/kexec. And if we do not include initialized data in digest
calculation, then one can overwrite purgatory with its own executable
code and kexec will load it into the kernel and let it run at priviliged
level.

So looks like even above will not be foolproof. (Assuming we can do
this. I thought we lost all the elf headers after loading elf 
binary and now we don't know which mmpaed areas need to be included
in digest and which should not be).
 
> Verifying that the copy on the filesystem is 
> unmodified isn't adequate - an attacker could simply have paused the 
> process and injected code.

This is an interesting point. So even if we verify the signature of
/sbin/kexec, parent can change the code (using ptrace() interface?).
And we are again prone to attack. So this will work if we are doing
integrity/authenticity checks on all root processes and not just
one /sbin/kexec.

> Realistically, the only solution here is for 
> the kernel to verify that the kernel it's about to boot is signed and 
> for it not to take any untrusted executable code from userspace.

Hmm.., given above, looks like implementing a new system call to pass
in full kernel and initramfs (along with some command line or other
parameters), becomes interesting.

Thanks
Vivek

      parent reply	other threads:[~2012-10-25 16:23 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1350588121.30243.7.camel@rhapsody>
     [not found] ` <20121018193831.GD18147@redhat.com>
     [not found]   ` <874nlrv2ni.fsf@xmission.com>
     [not found]     ` <20121019020630.GA27052@redhat.com>
     [not found]       ` <877gqnnnf0.fsf@xmission.com>
     [not found]         ` <20121019143112.GB27052@redhat.com>
     [not found]           ` <871ugqb4gj.fsf@xmission.com>
     [not found]             ` <20121023131854.GA16496@redhat.com>
     [not found]               ` <20121023145920.GD16496@redhat.com>
     [not found]                 ` <87fw552mb4.fsf_-_@xmission.com>
2012-10-24 17:36                   ` Kdump with signed images 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
     [not found]                 ` <20121023154123.GA30730@srcf.ucam.org>
     [not found]                   ` <87d309xhmc.fsf_-_@xmission.com>
2012-10-24 17:19                     ` [RFC] " 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                   ` Vivek Goyal [this message]

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=20121025153937.GE9377@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=dmitry.kasatkin@intel.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=linux-kernel@vger.kernel.org \
    --cc=mjg@redhat.com \
    --cc=zohar@linux.vnet.ibm.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).