From: Andrew Morton <akpm@linux-foundation.org>
To: Kees Cook <keescook@chromium.org>
Cc: James Morris <jmorris@namei.org>,
"Serge E. Hallyn" <serge@hallyn.com>,
Kalle Valo <kvalo@codeaurora.org>,
Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
Joe Perches <joe@perches.com>, Guenter Roeck <linux@roeck-us.net>,
Jiri Slaby <jslaby@suse.com>, Paul Moore <pmoore@redhat.com>,
Stephen Smalley <sds@tycho.nsa.gov>,
Mimi Zohar <zohar@linux.vnet.ibm.com>,
Casey Schaufler <casey@schaufler-ca.com>,
Andreas Gruenbacher <agruenba@redhat.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Ulf Hansson <ulf.hansson@linaro.org>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 5/5] LSM: LoadPin for kernel file loading restrictions
Date: Mon, 28 Mar 2016 14:38:33 -0700 [thread overview]
Message-ID: <20160328143833.911097dc39990ebe7a40b23d@linux-foundation.org> (raw)
In-Reply-To: <1459199662-16558-6-git-send-email-keescook@chromium.org>
On Mon, 28 Mar 2016 14:14:22 -0700 Kees Cook <keescook@chromium.org> wrote:
> This LSM enforces that kernel-loaded files (modules, firmware, etc)
> must all come from the same filesystem, with the expectation that
> such a filesystem is backed by a read-only device such as dm-verity
> or CDROM. This allows systems that have a verified and/or unchangeable
> filesystem to enforce module and firmware loading restrictions without
> needing to sign the files individually.
Patchset generally looks good to me. It's regrettable that a load of
stuff was added to lib/ for one obscure LSM but hopefully (doubtfully)
someone else will find a use for some of it.
I'll assume that James is handling all of this.
> --- /dev/null
> +++ b/security/loadpin/loadpin.c
> @@ -0,0 +1,206 @@
> +/*
> + * Module and Firmware Pinning Security Module
> + *
> + * Copyright 2011-2016 Google Inc.
> + *
> + * Author: Kees Cook <keescook@chromium.org>
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + */
> +
> +#define pr_fmt(fmt) "LoadPin: " fmt
> +
> +#include <linux/module.h>
> +#include <linux/fs.h>
> +#include <linux/fs_struct.h>
> +#include <linux/lsm_hooks.h>
> +#include <linux/mount.h>
> +#include <linux/path.h>
> +#include <linux/sched.h> /* current */
> +#include <linux/string_helpers.h>
> +
> +static void report_load(const char *origin, struct file *file, char *operation)
> +{
> + char *cmdline, *pathname;
> +
> + pathname = kstrdup_quotable_file(file);
> + cmdline = kstrdup_quotable_cmdline(current);
> +
> + pr_notice("%s %s obj=%s%s%s pid=%d cmdline=%s%s%s\n",
> + origin, operation,
> + (pathname && pathname[0] != '<') ? "\"" : "",
> + pathname,
> + (pathname && pathname[0] != '<') ? "\"" : "",
> + task_pid_nr(current),
> + cmdline ? "\"" : "", cmdline, cmdline ? "\"" : "");
> +
> + kfree(cmdline);
> + kfree(pathname);
> +}
> +
> +static int load_pinning = 1;
> +static struct super_block *pinned_root;
> +static DEFINE_SPINLOCK(pinned_root_spinlock);
> +
> +#ifdef CONFIG_SYSCTL
> +static int zero;
> +static int one = 1;
> +
> +static struct ctl_path loadpin_sysctl_path[] = {
> + { .procname = "kernel", },
> + { }
> +};
> +
> +static struct ctl_table loadpin_sysctl_table[] = {
> + {
> + .procname = "load_pinning",
> + .data = &load_pinning,
> + .maxlen = sizeof(int),
> + .mode = 0644,
> + .proc_handler = proc_dointvec_minmax,
> + .extra1 = &zero,
> + .extra2 = &one,
> + },
> + { }
> +};
There should be somewhere to document the new sysctl?
next prev parent reply other threads:[~2016-03-28 21:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-28 21:14 [PATCH v2 0/5] " Kees Cook
2016-03-28 21:14 ` [PATCH v2 1/5] string_helpers: add kstrdup_quotable Kees Cook
2016-03-28 23:30 ` Joe Perches
2016-04-06 23:50 ` Kees Cook
2016-03-28 21:14 ` [PATCH v2 2/5] string_helpers: add kstrdup_quotable_cmdline Kees Cook
2016-03-30 11:07 ` Andy Shevchenko
2016-03-30 11:11 ` Andy Shevchenko
2016-04-06 23:38 ` Kees Cook
2016-03-28 21:14 ` [PATCH v2 3/5] string_helpers: add kstrdup_quotable_file Kees Cook
2016-03-28 21:14 ` [PATCH v2 4/5] Yama: consolidate error reporting Kees Cook
2016-03-28 21:14 ` [PATCH v2 5/5] LSM: LoadPin for kernel file loading restrictions Kees Cook
2016-03-28 21:38 ` Andrew Morton [this message]
2016-03-28 21:58 ` Kees Cook
2016-03-30 20:24 ` Mimi Zohar
2016-03-28 23:20 ` Joe Perches
2016-03-31 21:24 ` Mimi Zohar
2016-04-04 19:31 ` Kees Cook
2016-04-04 23:03 ` Mimi Zohar
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=20160328143833.911097dc39990ebe7a40b23d@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=agruenba@redhat.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=casey@schaufler-ca.com \
--cc=jmorris@namei.org \
--cc=joe@perches.com \
--cc=jslaby@suse.com \
--cc=keescook@chromium.org \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=linux@roeck-us.net \
--cc=mchehab@osg.samsung.com \
--cc=pmoore@redhat.com \
--cc=sds@tycho.nsa.gov \
--cc=serge@hallyn.com \
--cc=ulf.hansson@linaro.org \
--cc=vkuznets@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
all inboxes | Powered by JetHome®