All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <kees.cook@canonical.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Joe Perches <joe@perches.com>,
	Dan Rosenberg <drosenberg@vsecurity.com>,
	LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
	Eugene Teo <eugeneteo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] Fix dmesg_restrict build failure with CONFIG_EMBEDDED=y and CONFIG_PRINTK=n
Date: Sat, 13 Nov 2010 18:44:44 -0800	[thread overview]
Message-ID: <20101114024444.GG13854@outflux.net> (raw)
In-Reply-To: <AANLkTi=ut2O+mCbs1jOyg-aP=E+48h1B-MH8NxK5XyVf@mail.gmail.com>

On Sat, Nov 13, 2010 at 09:50:22AM -0800, Linus Torvalds wrote:
> So I would suggest guarding the whole thing, and just returning 0 if
> CONFIG_PRINTK isn't set. Or preferably just move the dmesg_restrict
> test into do_syslog, and stop playing stupid games with
> "security_syslog()", which actually goes away if you disable the you
> disable CONFIG_SECURITY.
> 
> SECURITY_DMESG_RESTRICT is totally independent of CONFIG_SECURITY, so
> doing it in security_syslog() was a bug to begin with.
> 
> Or we should make SECURITY_DMESG_RESTRICT _depend_ on CONFIG_SECURITY,
> and move it entirely into security/commoncap.c, and not pollute
> kernel/printk.c at all with it.

It seems saner to put it in commoncaps to me, but either way, it must happen
after the from_file and OPEN test or it will break /proc/kmesg readers who
open and drop privs (as done with sysklogd, etc).

> +	if (dmesg_restrict && !capable(CAP_SYS_ADMIN))
> +		return -EPERM;
> +
>...
>  {
>  	if (type != SYSLOG_ACTION_OPEN && from_file)
>  		return 0;
> -	if (dmesg_restrict && !capable(CAP_SYS_ADMIN))
> -		return -EPERM;

i.e.

if (dmesg_restrict && (!from_file || type == SYSLOG_ACTION_OPEN) &&
    !capable(CAP_SYS_ADMIN))

-Kees

-- 
Kees Cook
Ubuntu Security Team

      parent reply	other threads:[~2010-11-14  2:45 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-13 17:26 [PATCH] Fix dmesg_restrict build failure with CONFIG_EMBEDDED=y and CONFIG_PRINTK=n Joe Perches
2010-11-13 17:50 ` Linus Torvalds
2010-11-13 18:25   ` Dan Rosenberg
2010-11-13 20:22     ` Linus Torvalds
2010-11-14  3:05       ` Kees Cook
2010-11-14 12:35       ` Ingo Molnar
2010-11-13 19:51   ` Joe Perches
2010-11-13 20:01     ` Joe Perches
2010-11-13 20:31     ` Linus Torvalds
2010-11-15  1:16       ` James Morris
2010-11-15 17:04       ` Eric Paris
2010-11-15 17:34         ` Eric Paris
2010-11-15 17:41           ` Linus Torvalds
2010-11-15 17:45             ` Eric Paris
2010-11-15 18:20               ` Linus Torvalds
2010-11-15 22:13               ` James Morris
2010-11-15 22:43                 ` Eric Paris
2010-11-15 22:58                   ` James Morris
2010-11-15 23:08                     ` Eric Paris
2010-11-15 22:16             ` James Morris
2010-11-15 22:36               ` Linus Torvalds
2010-11-15 22:51                 ` James Morris
2010-11-14  2:44   ` Kees Cook [this message]

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=20101114024444.GG13854@outflux.net \
    --to=kees.cook@canonical.com \
    --cc=akpm@linux-foundation.org \
    --cc=drosenberg@vsecurity.com \
    --cc=eugeneteo@kernel.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.