Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1368815

Re: [PATCH v2 5/5] LSM: LoadPin for kernel file loading restrictions

From Mimi Zohar <zohar@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 5/5] LSM: LoadPin for kernel file loading restrictions
Date 2016-03-31 23:30 +0200
Message-ID <riSka-2AW-9@gated-at.bofh.it> (permalink)
References <rhMJQ-4ie-15@gated-at.bofh.it> <rhMJR-4ie-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, 2016-03-28 at 14:14 -0700, Kees Cook wrote:

> +static const char *id_str[READING_MAX_ID] = {
> +	[READING_FIRMWARE] = "firmware",
> +	[READING_MODULE] = "kernel module",
> +	[READING_KEXEC_IMAGE] = "kexec image",
> +	[READING_KEXEC_INITRAMFS] = "kexec initramfs",
> +	[READING_POLICY] = "security policy",
> +};
> +
> +static int loadpin_read_file(struct file *file, enum kernel_read_file_id id)
> +{
> +	struct super_block *load_root;
> +	const char *origin;
> +
> +	if (id < 0 || id >= READING_MAX_ID)
> +		return -EINVAL;
> +

The kernel_read_file_id enumeration starts at 1.

> +	origin = id_str[id];
> +	if (!origin) {
> +		origin = "unknown";

Right, all the entries in the kernel_read_file_id enumeration are
currently listed in id_str.  Checking origin is needed for when id_str[]
isn't kept in sync with the enumeration.

Looks good!

Mimi

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v2 5/5] LSM: LoadPin for kernel file loading restrictions Kees Cook <keescook@chromium.org> - 2016-03-28 23:20 +0200
  Re: [PATCH v2 5/5] LSM: LoadPin for kernel file loading  restrictions Andrew Morton <akpm@linux-foundation.org> - 2016-03-28 23:40 +0200
    Re: [PATCH v2 5/5] LSM: LoadPin for kernel file loading restrictions Kees Cook <keescook@chromium.org> - 2016-03-29 00:00 +0200
    Re: [PATCH v2 5/5] LSM: LoadPin for kernel file loading restrictions Mimi Zohar <zohar@linux.vnet.ibm.com> - 2016-03-30 22:30 +0200
  Re: [PATCH v2 5/5] LSM: LoadPin for kernel file loading  restrictions Joe Perches <joe@perches.com> - 2016-03-29 01:30 +0200
  Re: [PATCH v2 5/5] LSM: LoadPin for kernel file loading restrictions Mimi Zohar <zohar@linux.vnet.ibm.com> - 2016-03-31 23:30 +0200

csiph-web