提交 dd099793 编写于 作者: N Nick Kralevich 提交者: Greg Kroah-Hartman

staging: android: ram_console: honor dmesg_restrict

The Linux kernel has a setting called dmesg_restrict. When true,
only processes with CAP_SYSLOG can view the kernel dmesg logs. This
helps prevent leaking of kernel information into user space.

On Android, it's possible to bypass these restrictions by viewing
/proc/last_kmsg.

This change makes /proc/last_kmsg require the same permissions as
dmesg.

CC: Android Kernel Team <kernel-team@android.com>
Signed-off-by: NNick Kralevich <nnk@google.com>
Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 3a21138d
......@@ -99,6 +99,9 @@ static ssize_t ram_console_read_old(struct file *file, char __user *buf,
char *str;
int ret;
if (dmesg_restrict && !capable(CAP_SYSLOG))
return -EPERM;
/* Main last_kmsg log */
if (pos < old_log_size) {
count = min(len, (size_t)(old_log_size - pos));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册