public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Kyle McMartin <kyle@mcmartin.ca>
Cc: zohar@us.ibm.com, linux-kernel@vger.kernel.org,
	eparis@redhat.com, torvalds@linux-foundation.org,
	James Morris <jmorris@namei.org>,
	Rusty Russell <rusty@rustcorp.com.au>
Subject: Re: [PATCH] allow disabling IMA at runtime
Date: Wed, 26 Aug 2009 17:02:25 -0700	[thread overview]
Message-ID: <20090826170225.7574759e.akpm@linux-foundation.org> (raw)
In-Reply-To: <20090826021005.GD19494@bombadil.infradead.org>

On Tue, 25 Aug 2009 22:10:05 -0400
Kyle McMartin <kyle@mcmartin.ca> wrote:

> From: Kyle McMartin <kyle@redhat.com>
> 
> Due to a memory leak in IMA that we're currently debugging in Fedora
> rawhide, it would be nice to be able to disable that support at runtime.
> Currently it's only able to be built in, and there's no toggle to avoid
> initializing it.
> 
> Provide one, in order to enhance debuggability. If a user can reboot a
> machine and edit its command line, one can do a far sight worse things
> than disabling a security precaution.
> 

nits:

> 
> ---
> diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
> index 7936b80..0d1b1ed 100644
> --- a/Documentation/kernel-parameters.txt
> +++ b/Documentation/kernel-parameters.txt
> @@ -926,6 +926,11 @@ and is between 256 and 4096 characters. It is defined in the file
>  	ihash_entries=	[KNL]
>  			Set number of hash buckets for inode cache.
>  
> +	ima=		[IMA]
> +			Format: { "0" | "1" }
> +			0 -- disable IMA.
> +			1 -- enable IMA. (default)
> +
>  	ima_audit=	[IMA]
>  			Format: { "0" | "1" }
>  			0 -- integrity auditing messages. (Default)
> diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
> index 101c512..cc7603e 100644
> --- a/security/integrity/ima/ima_main.c
> +++ b/security/integrity/ima/ima_main.c
> @@ -339,10 +339,27 @@ int ima_bprm_check(struct linux_binprm *bprm)
>  	return 0;
>  }
>  
> +static int ima_disabled = 0;
> +static int __init ima_enabled(char *str)
> +{
> +	unsigned long enabled;
> +
> +	if (!strict_strtoul(str, 0, &enabled))
> +		ima_disabled = enabled ? 0 : 1;
> +	return 1;
> +}

- documentation says "0 or 1" but the implementation says "0 or non-zero".

- implementation returns `1' whether or not the argument was
  successfully parsed.

  What happens if a __setup() functions returns non-1?

  <spends a while fossicking through prehistory and RustyCode>

  From my reading of kernel/params.c:parse_args(), every __setup()
  function which returns `1' should result in printk("%s: `%s' invalid
  for parameter `%s'), so I'm all confused and giving up.

> +__setup("ima=", ima_enabled);

Are we supposed to use core_param() nowadays?

>  static int __init init_ima(void)
>  {
>  	int error;
>  
> +	if (ima_disabled) {
> +		pr_info("IMA disabled at user request.\n");
> +		return 0;
> +	}
> +
>  	ima_iintcache_init();
>  	error = ima_init();
>  	ima_initialized = 1;


  parent reply	other threads:[~2009-08-27  0:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-26  2:10 [PATCH] allow disabling IMA at runtime Kyle McMartin
2009-08-26 12:07 ` Mimi Zohar
2009-08-26 12:17   ` Eric Paris
2009-08-27  0:02 ` Andrew Morton [this message]
2009-08-27  5:47   ` James Morris
2009-08-27 10:19   ` Rusty Russell
  -- strict thread matches above, loose matches on Subject: below --
2009-08-27 12:30 David Safford
2009-08-27 12:57 ` Eric Paris

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=20090826170225.7574759e.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=eparis@redhat.com \
    --cc=jmorris@namei.org \
    --cc=kyle@mcmartin.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=torvalds@linux-foundation.org \
    --cc=zohar@us.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