public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Vivek Goyal <vgoyal@redhat.com>
Cc: matthew.garrett@nebula.com, d.kasatkin@samsung.com,
	kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org, ebiederm@xmission.com,
	hpa@zytor.com, akpm@linux-foundation.org,
	zohar@linux.vnet.ibm.com
Subject: Re: [PATCH 00/16] [RFC PATCH] Signed kexec support
Date: Thu, 12 Sep 2013 09:17:05 -0700	[thread overview]
Message-ID: <20130912161705.GA2650@kroah.com> (raw)
In-Reply-To: <20130912114336.GA28500@redhat.com>

On Thu, Sep 12, 2013 at 07:43:36AM -0400, Vivek Goyal wrote:
> On Wed, Sep 11, 2013 at 08:40:23PM -0700, Greg KH wrote:
> > On Tue, Sep 10, 2013 at 05:44:15PM -0400, Vivek Goyal wrote:
> > > Hi,
> > > 
> > > Matthew has been posting patches to lock down kernel either due to
> > > secureboot requirements or because of signed modules with signing
> > > enforced. In kernel lock down mode, kexec will be disabled and that
> > > means kdump will not work either.
> > > 
> > > These patches sign /sbin/kexec and kernel verifies the signature
> > > and allows loading a kernel if signature verification is successful.
> > > IOW, trust is extended to validly signed user space.
> > > 
> > > Currently it works only for statically linked applications.
> > 
> > That's a really big restriction, pretty much making it not workable for
> > distros at the moment to use.
> 
> It is a big restriction for general use case of signed user space but in
> this case I am planning to build /sbin/kexec statically and solve the
> kexec/kdump issue.
> 
> I have posted kexec-tools patches here.
> 
> https://lists.fedoraproject.org/pipermail/kernel/2013-September/004469.html
> 
> Once kernel patches get in, I plan to upstream kexec-tools patches too
> and then distros should be able to build /sbin/kexec statically and
> this should work.
> 
> Do you forsee a problem with that?

Your paranoia is admirable in these patches.  If they are accepted, that
is a good first step, but what about the other kexec variants out there?

> > Any chance to change this in the future?
> 
> It might but currently I don't have any plans. I see atleast two issues
> with that.
> 
> - If we allow dynamic linking for signed binaries, then dynamic libraries
>   will have to be signed too. I suspect in that case pretty much whole of
>   the user space will have to be signed. I am not sure if distros are
>   willing to do that.
> 
> - Currently a shared library can be written on disk (unlike executables)
>   while it is mapped. That means after signature verification a root just
>   has to open and write to shared library and modify code and defeat the
>   purpose of signature verfication.

Then the existing signature verification logic is broken if this is
possible.

> Probably these issues can be addressed if there is a need. Just that I
> have not looked into it.
> 
> > Or just rely on the existing
> > "signed binaries" functionality we have in the kernel today for the
> > kexec binary as well?  Wouldn't that be simpler?
> 
> Which signed binary mechanism are you referring to? Are you referring to
> using IMA for signature verification? If yes, there are some issues with
> that.

Yes, IMA.

> - IMA does not lock down signed binaries in memory. That means after
>   signature verification files can potentially be swapped out and be
>   attacked there and modified code then can be swapped back in.

How can you do that?  If this is the case, then IMA is pointless and
should be fixed.

> - IMA caches the signature appraisal resutls and reappraises the things
>   based on if file has been modified or not. But this does not detect any
>   raw writes to disk. So after signature verification root should be able
>   to do some raw writes to disk and IMA will think file signature are
>   just fine.

IMA should be fixed for this problem.

> - IMA does not have mechanism to keep track of signed applications and
>   a mechanism to disallow ptrace() by unsigned applications. That means
>   after signature verification root can just ptrace() signed binary and
>   modify its code/data.

Then IMA should be fixed.

> - IMA provides mechanism for file based signature verificaiton.
>   kexec-tools also needs to verify signature of new kernel being loaded.
>   Using IMA on bzImage file has same pitfalls where a file can be modified
>   after signature verification.
> 
>   That's why I have extended keyctl() so that signature verification can
>   be done on user space buffer. An application can first read a file in
>   buffer and then ask kernel to verify signature. And now root should not
>   be able to attack it.
> 
> So existing IMA does not seem to have been written for an environment
> where all the user space is not signed we don't trust root and root can
> attack a signed binary. And my patches try to fill that gap. 

It sounds like your changes should go into the IMA core code to resolve
the issues there, as I'm sure they want to also protect from the issues
you have pointed out here.  Have you talked to those developers about
this?

thanks,

greg k-h

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

  reply	other threads:[~2013-09-12 16:17 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-10 21:44 [PATCH 00/16] [RFC PATCH] Signed kexec support Vivek Goyal
2013-09-10 21:44 ` [PATCH 01/16] mm: vm_brk(), align the length to page boundary Vivek Goyal
2013-09-10 21:44 ` [PATCH 02/16] integrity: Add a function to determine digital signature length Vivek Goyal
2013-09-10 21:44 ` [PATCH 03/16] ima: Allow adding more memory locking metadata after digital signature v2 Vivek Goyal
2013-09-10 21:44 ` [PATCH 04/16] integrity: Allow digital signature verification with a given keyring ptr Vivek Goyal
2013-09-11 17:34   ` Mimi Zohar
2013-09-10 21:44 ` [PATCH 05/16] integrity: Export a function to retrieve hash algo used in digital signature Vivek Goyal
2013-09-10 21:44 ` [PATCH 06/16] ima: export new IMA functions for signature verification Vivek Goyal
2013-09-10 21:44 ` [PATCH 07/16] mm: Define a task flag MMF_VM_LOCKED for memlocked tasks and don't allow munlock Vivek Goyal
2013-09-10 21:44 ` [PATCH 08/16] binfmt_elf: Elf executable signature verification Vivek Goyal
2013-09-10 21:44 ` [PATCH 09/16] ima: define functions to appraise memory buffer contents Vivek Goyal
2013-09-10 21:44 ` [PATCH 10/16] keyctl: Introduce a new operation KEYCTL_VERIFY_SIGNATURE Vivek Goyal
2013-09-10 21:44 ` [PATCH 11/16] ptrace: Do not allow ptrace() from unsigned process to signed one Vivek Goyal
2013-09-10 21:44 ` [PATCH 12/16] binfmt_elf: Do not mark process signed if binary has elf interpreter Vivek Goyal
2013-09-10 21:44 ` [PATCH 13/16] kexec: Allow only signed processes to call sys_kexec() in secureboot mode Vivek Goyal
2013-09-10 21:44 ` [PATCH 14/16] kexec: Export sysfs attributes for secureboot and secure modules to user space Vivek Goyal
2013-09-10 22:40   ` Greg KH
2013-09-11 13:44     ` Vivek Goyal
2013-09-10 22:57   ` Josh Boyer
2013-09-11 13:51     ` Vivek Goyal
2013-09-10 21:44 ` [PATCH 15/16] bootparam: Pass acpi_rsdp pointer in bootparam Vivek Goyal
2013-09-10 22:52   ` H. Peter Anvin
2013-09-11 11:44     ` Borislav Petkov
2013-09-11 13:45       ` Vivek Goyal
2013-09-11 14:32         ` Borislav Petkov
2013-09-12  7:34           ` Dave Young
2013-09-12 12:53             ` Borislav Petkov
2013-09-12 13:19               ` Vivek Goyal
2013-09-12 14:25                 ` Borislav Petkov
2013-09-12 14:34               ` Matthew Garrett
2013-09-12 14:42                 ` Borislav Petkov
2013-09-13  7:12               ` Dave Young
2013-09-13 11:26                 ` Borislav Petkov
2013-09-10 21:44 ` [PATCH 16/16] mount: Add a flag to not follow symlink at the end of mount point Vivek Goyal
2013-09-12  3:40 ` [PATCH 00/16] [RFC PATCH] Signed kexec support Greg KH
2013-09-12 11:43   ` Vivek Goyal
2013-09-12 16:17     ` Greg KH [this message]
2013-09-12 18:24       ` Mimi Zohar
2013-09-16 14:28         ` Vivek Goyal
2013-09-18 14:51           ` Andrea Adami
2013-09-23 17:15             ` Vivek Goyal
2013-09-16 14:24       ` 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=20130912161705.GA2650@kroah.com \
    --to=greg@kroah.com \
    --cc=akpm@linux-foundation.org \
    --cc=d.kasatkin@samsung.com \
    --cc=ebiederm@xmission.com \
    --cc=hpa@zytor.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=matthew.garrett@nebula.com \
    --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