aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>2016-01-13 16:28:49 -0500
committerSimon Shields <keepcalm444@gmail.com>2016-03-10 22:01:30 +1100
commitb152bb944d40c369236e0d642f8296fdbacabfa2 (patch)
tree0bd576573427d04ff56241b83f22559380dde3b2 /fs
parent0280906bb6e2548b41cb6788e3ec62feb1749db8 (diff)
downloadkernel_samsung_smdk4412-b152bb944d40c369236e0d642f8296fdbacabfa2.tar.gz
kernel_samsung_smdk4412-b152bb944d40c369236e0d642f8296fdbacabfa2.tar.bz2
kernel_samsung_smdk4412-b152bb944d40c369236e0d642f8296fdbacabfa2.zip
BACKPORT: pagemap: do not leak physical addresses to non-privileged userspace
(cherry pick from commit ab676b7d6fbf4b294bf198fb27ade5b0e865c7ce) As pointed by recent post[1] on exploiting DRAM physical imperfection, /proc/PID/pagemap exposes sensitive information which can be used to do attacks. This disallows anybody without CAP_SYS_ADMIN to read the pagemap. [1] http://googleprojectzero.blogspot.com/2015/03/exploiting-dram-rowhammer-bug-to-gain.html [ Eventually we might want to do anything more finegrained, but for now this is the simple model. - Linus ] Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Acked-by: Konstantin Khlebnikov <khlebnikov@openvz.org> Acked-by: Andy Lutomirski <luto@amacapital.net> Cc: Pavel Emelyanov <xemul@parallels.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Mark Seaborn <mseaborn@chromium.org> Cc: stable@vger.kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Mark Salyzyn <salyzyn@google.com> Bug: 26038811 Change-Id: Icd68075a32ef6c9be1ae00ae9cf5a68bbe7f4e4f
Diffstat (limited to 'fs')
-rw-r--r--fs/proc/task_mmu.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 55a1f494711..00e7ac486d9 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -862,9 +862,18 @@ out:
return ret;
}
+static int pagemap_open(struct inode *inode, struct file *file)
+{
+ /* do not disclose physical addresses: attack vector */
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+ return 0;
+}
+
const struct file_operations proc_pagemap_operations = {
.llseek = mem_lseek, /* borrow this */
.read = pagemap_read,
+ .open = pagemap_open,
};
#endif /* CONFIG_PROC_PAGE_MONITOR */