mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Kees Cook <keescook@chromium.org>
Cc: Josh Boyer <jwboyer@redhat.com>, Eric Paris <eparis@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Christian Kujau <lists@nerdbynature.de>,
	"# 3.4.x" <stable@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kmsg: Honor dmesg_restrict sysctl on /dev/kmsg
Date: Fri, 22 Mar 2013 14:54:48 -0700	[thread overview]
Message-ID: <20130322145448.f44f9d10a36620c1c11535b7@linux-foundation.org> (raw)
In-Reply-To: <CAGXu5j+aADfSpBcz9=LVtREQQiW4d3Jd8t7nQKbih7oUhvQghg@mail.gmail.com>


poke.  Nothing got applied.  I'll drop
kmsg-honor-dmesg_restrict-sysctl-on-dev-kmsg.patch, see if that has any
effect ;) 


From: Josh Boyer <jwboyer@redhat.com>
Subject: kmsg: honor dmesg_restrict sysctl on /dev/kmsg

Originally, the addition of dmesg_restrict covered both the syslog
method of accessing dmesg, as well as /dev/kmsg itself.  This was done
indirectly by security_syslog calling cap_syslog before doing any LSM
checks.

However, commit 12b3052c3ee ("capabilities/syslog: open code cap_syslog
logic to fix build failure") moved the code around and pushed the checks
into the caller itself.  That seems to have inadvertently dropped the
checks for dmesg_restrict on /dev/kmsg.  Most people haven't noticed
because util-linux dmesg(1) defaults to using the syslog method for access
in older versions.  With util-linux 2.22 and a kernel newer than 3.5,
dmesg(1) defaults to reading directly from /dev/kmsg.

Fix this by making an explicit check in the devkmsg_open function.

This fixes https://bugzilla.redhat.com/show_bug.cgi?id=903192

Signed-off-by: Josh Boyer <jwboyer@redhat.com>
Reported-by: Christian Kujau <lists@nerdbynature.de>
Cc: Eric Paris <eparis@redhat.com>
Cc: James Morris <jmorris@namei.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 kernel/printk.c |    3 +++
 1 file changed, 3 insertions(+)

diff -puN kernel/printk.c~kmsg-honor-dmesg_restrict-sysctl-on-dev-kmsg kernel/printk.c
--- a/kernel/printk.c~kmsg-honor-dmesg_restrict-sysctl-on-dev-kmsg
+++ a/kernel/printk.c
@@ -620,6 +620,9 @@ static int devkmsg_open(struct inode *in
 	struct devkmsg_user *user;
 	int err;
 
+	if (dmesg_restrict && !capable(CAP_SYSLOG))
+		return -EACCES;
+
 	/* write-only does not need any file context */
 	if ((file->f_flags & O_ACCMODE) == O_WRONLY)
 		return 0;
_


  reply	other threads:[~2013-03-22 21:54 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-22 18:18 Josh Boyer
2013-02-27 17:54 ` Kees Cook
2013-02-27 18:01   ` Josh Boyer
2013-02-27 18:14     ` Kees Cook
2013-02-27 20:46       ` Eric Paris
2013-02-27 22:19         ` Josh Boyer
2013-02-27 22:34           ` Kees Cook
2013-03-22 21:54             ` Andrew Morton [this message]
2013-03-22 22:14               ` Josh Boyer
2013-04-01 23:51                 ` Kees Cook
2013-04-02  1:05                   ` Josh Boyer
2013-04-08 21:34                     ` Kees Cook
2013-04-09  0:50                       ` Josh Boyer
2013-04-09 15:48                         ` [PATCH v2] " Josh Boyer
2013-04-09 16:33                           ` Kees Cook
2013-04-24 17:44                             ` Kay Sievers
2013-04-24 17:58                               ` Josh Boyer
2013-04-24 19:50                                 ` Josh Boyer
2013-04-24 20:35                                 ` Kees Cook
2013-04-24 21:21                                   ` Josh Boyer
2013-04-24 21:36                                     ` Kees Cook
2013-04-24 21:51                                       ` Josh Boyer
2013-04-24 23:52                                         ` Kay Sievers
2013-04-24 21:30                                   ` Linus Torvalds
2013-04-24 21:41                                     ` Kees Cook
2013-04-24 22:01                                     ` Josh Boyer
2013-04-24 17:43                           ` Josh Boyer
2013-02-27 18:05 ` [PATCH] " Kees Cook
2013-02-27 18:13   ` Josh Boyer
2013-04-30 17:25 [PATCH] kmsg: honor " Kees Cook
2013-04-30 18:35 ` Josh Boyer
2013-04-30 18:54   ` Kees Cook
2013-05-07 16:27 ` Josh Boyer
2013-05-08 21:22 ` Andrew Morton
2013-05-08 21:26   ` Kees Cook
2013-05-08 21:32     ` Steven Rostedt

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=20130322145448.f44f9d10a36620c1c11535b7@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=eparis@redhat.com \
    --cc=jwboyer@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lists@nerdbynature.de \
    --cc=stable@vger.kernel.org \
    --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 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®