linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.vnet.ibm.com>
To: "Luis R. Rodriguez" <mcgrof@kernel.org>
Cc: David Howells <dhowells@redhat.com>,
	linux-security-module <linux-security-module@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	"AKASHI, Takahiro" <takahiro.akashi@linaro.org>,
	Johannes Berg <johannes@sipsolutions.net>,
	James Bottomley <James.Bottomley@hansenpartnership.com>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [RFC PATCH v1] fw_lockdown: new micro LSM module to prevent loading unsigned firmware
Date: Sat, 11 Nov 2017 18:04:16 -0500	[thread overview]
Message-ID: <1510441456.3404.3.camel@linux.vnet.ibm.com> (raw)
In-Reply-To: <20171110223930.GT22894@wotan.suse.de>

On Fri, 2017-11-10 at 23:39 +0100, Luis R. Rodriguez wrote:
> On Fri, Nov 10, 2017 at 04:02:55PM -0500, Mimi Zohar wrote:
> > If the kernel is locked down and IMA-appraisal is not enabled, prevent
> > loading of unsigned firmware.
> > 
> > Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
> > ---
> > 
> > Changelog v1:
> > - Lots of minor changes Kconfig, Makefile, fw_lsm.c for such a small patch
> 
> <-- snip -->
> 
> > diff --git a/security/fw_lockdown/fw_lsm.c b/security/fw_lockdown/fw_lsm.c
> > new file mode 100644
> > index 000000000000..cce03a5c5280
> > --- /dev/null
> > +++ b/security/fw_lockdown/fw_lsm.c
> > @@ -0,0 +1,51 @@
> > +/*
> > + * fw_lockdown security module
> > + *
> > + * Copyright (C) 2017 IBM Corporation
> > + *
> > + * Authors:
> > + * Mimi Zohar <zohar@linux.vnet.ibm.com>
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License as published by
> > + * the Free Software Foundation; either version 2 of the License, or
> > + * (at your option) any later version.
> > + */
> > +
> > +#define pr_fmt(fmt) "fw_lockdown: " fmt
> > +
> > +#include <linux/module.h>
> > +#include <linux/ima.h>
> > +#include <linux/lsm_hooks.h>
> > +
> > +/**
> > + * fw_lockdown_read_file - prevent loading of unsigned firmware
> > + * @file: pointer to firmware
> > + * @read_id: caller identifier
> > + *
> > + * Prevent loading of unsigned firmware in lockdown mode.
> > + */
> > +static int fw_lockdown_read_file(struct file *file, enum kernel_read_file_id id)
> > +{
> > +	if (id == READING_FIRMWARE) {
> > +		if (!is_ima_appraise_enabled() &&
> > +		    !kernel_is_locked_down("Loading of unsigned firmware"))
> > +			return -EACCES;
> 
> I don't have kernel_is_locked_down() but I found it here:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/commit/?h=keys-lockdown&id=0ff5adf1e81135c4ed914d0a8b70124caed04142
> 

> 1) I don't see it taking any arguments

David reposted the patches https://lkml.org/lkml/2017/11/9/659 with
the change.  The latest version of the patches are in his efi-lock-
down branch.

> 2) Don't we want:
> 
> 	if (!is_ima_appraise_enabled() && kernel_is_locked_down())
> 		return -EACCES;
> 
> If, only if IMA appraisal is enabled would we enable kernel lockdown.

Yes, the kernel_is_locked_down() test needs to be inverted.

Mimi

  reply	other threads:[~2017-11-11 23:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-10 21:02 [RFC PATCH v1] fw_lockdown: new micro LSM module to prevent loading unsigned firmware Mimi Zohar
2017-11-10 22:39 ` Luis R. Rodriguez
2017-11-11 23:04   ` Mimi Zohar [this message]
2017-11-10 22:45 ` Casey Schaufler
2018-04-03  0:42 ` Andy Lutomirski
2018-04-03 16:56   ` Luis R. Rodriguez
2018-04-03 17:06     ` Luis R. Rodriguez

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=1510441456.3404.3.camel@linux.vnet.ibm.com \
    --to=zohar@linux.vnet.ibm.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=dhowells@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=takahiro.akashi@linaro.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;
as well as URLs for NNTP newsgroup(s).