linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Vivek Goyal <vgoyal@redhat.com>
Cc: Matthew Garrett <mjg@redhat.com>,
	Mimi Zohar <zohar@linux.vnet.ibm.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>,
	Dmitry Kasatkin <dmitry.kasatkin@intel.com>,
	Roberto Sassu <roberto.sassu@polito.it>,
	Kees Cook <keescook@chromium.org>,
	Peter Jones <pjones@redhat.com>
Subject: Re: Kdump with signed images
Date: Wed, 14 Nov 2012 21:09:51 -0800	[thread overview]
Message-ID: <87ehjvfo4g.fsf@xmission.com> (raw)
In-Reply-To: <20121109143938.GD4842@redhat.com> (Vivek Goyal's message of "Fri, 9 Nov 2012 09:39:38 -0500")

Vivek Goyal <vgoyal@redhat.com> writes:

> On Thu, Nov 08, 2012 at 01:03:17PM -0800, Eric W. Biederman wrote:
>> Vivek Goyal <vgoyal@redhat.com> writes:
>> 
>> > On Thu, Nov 08, 2012 at 02:40:50PM -0500, Vivek Goyal wrote:
>> >> On Tue, Nov 06, 2012 at 03:51:59PM -0800, Eric W. Biederman wrote:
>> >> 
>> >> [..]
>> >> 
>> >> Thnking more about executable signature verification, I have another question.
>> >> 
>> >> While verifyign the signature, we will have to read the whole executable
>> >> in memory. That sounds bad as we are in kernel mode and will not be killed
>> >> and if sombody is trying to execute a malformed exceptionally large
>> >> executable, system will start killing other processess. We can potentially
>> >> lock all the memory in kernel just by trying to execute a signed huge
>> >> executable. Not good.
>> >> 
>> >
>> > Also, even if we try to read in whole executable, can't an hacker modify
>> > pages in swap disk and then they will be faulted back in and bingo hacker
>> > is running its unsigned code. (assuming root has been compromised otherwise
>> > why do we have to do all this exercise).
>> 
>> You make a decent case for an implicit mlockall(MCL_FUTURE) being
>> required of signed executables, that are going to be granted privileges
>> based on signature verification.
>
> implicity lockall for signed executables sounds reasonable to avoid the
> swap hack.
>
>> 
>> As for size if the executable won't fit in memory, there is no point in
>> checking the signature.
>
> Well I am worried about malformed executables. One can sign a huge
> executable (which is never meant to run successfully) and cause all
> kind of memory issues. 

Good point what to do with executables with invalid sigantures.  From
another reply it sounded like one of the bits of IMA/EVM had already
addressed part of that.

> Can we first look at the signature, decrypt it using certificates in
> kernel ring, and if we find out that executable was signed by any
> of the certificates, only then we go on to read in whole executable
> and try to calculate the digest. May be at the time of signing we can put
>  a string, say "LINUX", along with digest and then sing/encrypt it. Upon
> decryption we can check if LINUX is there and if yes, we know it was
> signed by the certifcate loaded in kernel and then go on to load the
> full executable and calculate digest.

> Not sure if above is doable or not but if it is, it might reduce the
> risk significantly as we will not try to integrity verify executables
> not signed by genuine certificates.

Known plaintext in the signed blob should allow that.  I would be very
careful with that because it sounds like the kind of thing that opens
you up to plain-text attacks, but that is mostly my parania and lack of
experience speaking.

>> It should be fairly straight forward to make the signature checking
>> process preemptable and killable.
>
> hmm..., not sure how to do this. Will have to read more code to understand
> process killing and see what can I do this while I am in kernel mode
> and I possibly might have done kernel memory allocations using
> vmalloc()/kmalloc() etc.

Well basically it is matter of using the killable version of waits
returning an error code as you unwind, and eventually either
force_sig(SIGKILL) or do_exit().

There are a lot of times where you can support SIGKILL and just cause
the process to exit where you can't handle signals.


Eric


  reply	other threads:[~2012-11-15  5:10 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 [this message]
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                   ` [RFC] Kdump with UEFI secure boot (Re: [PATCH v2] kdump: pass acpi_rsdp= to 2nd kernel for efi booting) 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=87ehjvfo4g.fsf@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=dmitry.kasatkin@intel.com \
    --cc=dyoung@redhat.com \
    --cc=horms@verge.net.au \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=kexec@lists.infradead.org \
    --cc=khalid@gonehiking.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg@redhat.com \
    --cc=pjones@redhat.com \
    --cc=roberto.sassu@polito.it \
    --cc=vgoyal@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).