[Devel] [PATCH rh7] Port diff-ms-pagemap-do-not-leak-physical-addresses-to-non-privileged-userspace

Vladimir Davydov vdavydov at parallels.com
Tue Jun 2 05:32:08 PDT 2015


Author: Konstantin Khorenko
Email: khorenko at parallels.com
Subject: ms/pagemap: do not leak physical addresses to non-privileged userspace
Date: Mon, 23 Mar 2015 19:21:49 +0400

ms commit: ab676b7d6fbf4b294bf198fb27ade5b0e865c7ce

Original thread in LKML: https://lkml.org/lkml/2015/3/9/864

https://jira.sw.ru/browse/PSBM-32308

Signed-off-by: Konstantin Khorenko <khorenko at openvz.org>

  From: "Kirill A. Shutemov" <kirill.shutemov at linux.intel.com>
  Subject: pagemap: do not leak physical addresses to non-privileged userspace

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 at linux.intel.com>
Acked-by: Konstantin Khlebnikov <khlebnikov at openvz.org>
Acked-by: Andy Lutomirski <luto at amacapital.net>
Cc: Pavel Emelyanov <xemul at parallels.com>
Cc: Andrew Morton <akpm at linux-foundation.org>
Cc: Mark Seaborn <mseaborn at chromium.org>
Cc: stable at vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
=============================================================================

Related to https://jira.sw.ru/browse/PSBM-33640

Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
 fs/proc/task_mmu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 49ef0e109133..de50deee2e92 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -1238,6 +1238,10 @@ out:
 
 static int pagemap_open(struct inode *inode, struct file *file)
 {
+	/* do not disclose physical addresses: attack vector */
+	if (!capable(CAP_SYS_ADMIN))
+		return -EPERM;
+
 	pr_warn_once("Bits 55-60 of /proc/PID/pagemap entries are about "
 			"to stop being page-shift some time soon. See the "
 			"linux/Documentation/vm/pagemap.txt for details.\n");
-- 
2.1.4




More information about the Devel mailing list