[Devel] [PATCH RHEL7 COMMIT] ms/pagemap: Port diff-ms-pagemap-do-not-leak-physical-addresses-to-non-privileged-userspace

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jun 5 02:20:47 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.9
------>
commit 9f6baee587c23d8574eb45e0f8537a0b0431d1a5
Author: Vladimir Davydov <vdavydov at parallels.com>
Date:   Fri Jun 5 13:20:47 2015 +0400

    ms/pagemap: Port diff-ms-pagemap-do-not-leak-physical-addresses-to-non-privileged-userspace
    
    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 49ef0e1..de50dee 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");



More information about the Devel mailing list