The patch titled Subject: kmsg: honor dmesg_restrict sysctl on /dev/kmsg has been added to the -mm tree. Its filename is kmsg-honor-dmesg_restrict-sysctl-on-dev-kmsg.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Josh Boyer <jwboyer@xxxxxxxxxx> 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@xxxxxxxxxx> Reported-by: Christian Kujau <lists@xxxxxxxxxxxxxxx> Cc: Eric Paris <eparis@xxxxxxxxxx> Cc: James Morris <jmorris@xxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- 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 @@ -621,6 +621,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; _ Patches currently in -mm which might be from jwboyer@xxxxxxxxxx are origin.patch linux-next.patch kmsg-honor-dmesg_restrict-sysctl-on-dev-kmsg.patch aio-v2-fix-kioctx-not-being-freed-after-cancellation-at-exit-time.patch aio-v3-fix-kioctx-not-being-freed-after-cancellation-at-exit-time.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html