Bug 562582 (CVE-2010-0415) - CVE-2010-0415 kernel: sys_move_pages infoleak
Summary: CVE-2010-0415 kernel: sys_move_pages infoleak
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2010-0415
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard: reported=20100207,public=20100205,sou...
Depends On: 562588 562589 562590 562591
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-02-07 15:09 UTC by Eugene Teo (Security Response)
Modified: 2019-06-08 12:55 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-03-28 08:02:27 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2010:0147 normal SHIPPED_LIVE Important: kernel security and bug fix update 2010-03-17 00:18:44 UTC
Red Hat Product Errata RHSA-2010:0161 normal SHIPPED_LIVE Important: kernel-rt security and bug fix update 2010-03-23 15:42:25 UTC

Description Eugene Teo (Security Response) 2010-02-07 15:09:43 UTC
Description of problem:
Ramon de C. Valle spotted a problem in sys_move_pages, where "node" value is read from userspace, but not limited to the node set within the kernel itself.

Due to the bit tests in mm/migrate.c:do_move_pages it is easy to read out the kernel memory (as node can also be negative).

(The node_isset and node_state functions just map to test_bit, which has no limiter in the normal implementations.)

There also is (in my eyes) the chance we can corrupt kernel memory later on if we have all the right bits setup, but I did not research this further.

Issue was present starting as sys_move_pages was introduced in 2.6.18. Solved in mainline by commit below.

commit 6f5a55f1a6c5abee15a0e878e5c74d9f1569b8b0
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Fri Feb 5 16:16:50 2010 -0800

    Fix potential crash with sys_move_pages
    
    We incorrectly depended on the 'node_state/node_isset()' functions
    testing the node range, rather than checking it explicitly.  That's not
    reliable, even if it might often happen to work.  So do the proper
    explicit test.
    
    Reported-by: Marcus Meissner <meissner@suse.de>
    Acked-and-tested-by: Brice Goglin <Brice.Goglin@inria.fr>
    Acked-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
    Cc: stable@kernel.org
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Acknowledgements:

Red Hat would like to thank Ramon de C. Valle for reporting this issue.

Comment 2 Eugene Teo (Security Response) 2010-02-07 15:18:59 UTC
    868 /*
    869  * Move a list of pages in the address space of the currently executing
    870  * process.
    871  */
    872 asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages,
    873                         const void __user * __user *pages,
    874                         const int __user *nodes,
    875                         int __user *status, int flags)
    876 {
    877         int err = 0;
    878         int i;  
    879         struct task_struct *task;
    880         nodemask_t task_nodes;
[...]
    936         /* 
    937          * Get parameters from user space and initialize the pm
    938          * array. Return various errors if the user did something wrong.
    939          */
    940         for (i = 0; i < nr_pages; i++) {
    941                 const void *p;
    942 
    943                 err = -EFAULT;
    944                 if (get_user(p, pages + i))
    945                         goto out;
    946 
    947                 pm[i].addr = (unsigned long)p;
    948                 if (nodes) {
    949                         int node;
    950 
    951                         if (get_user(node, nodes + i))
    952                                 goto out;
    953 
^^ missing boundary checks
    954                         err = -ENODEV;
    955                         if (!node_online(node))
    956                                 goto out;
    957 
    958                         err = -EACCES;
    959                         if (!node_isset(node, task_nodes))
    960                                 goto out;
    961 
    962                         pm[i].node = node;
    963                 } else
    964                         pm[i].node = 0; /* anything to not match MAX_NUMNODES */
    965         }
    966         /* End marker */
    967         pm[nr_pages].node = MAX_NUMNODES;
    968 
    969         if (nodes)
    970                 err = do_move_pages(mm, pm, flags & MPOL_MF_MOVE_ALL);
    971         else
    972                 err = do_pages_stat(mm, pm);

Comment 4 Kyle McMartin 2010-02-07 20:36:34 UTC
Got it fixed in Fedora last night.

Comment 6 Fedora Update System 2010-02-09 22:14:51 UTC
kernel-2.6.31.12-174.2.17.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/kernel-2.6.31.12-174.2.17.fc12

Comment 7 Fedora Update System 2010-02-11 11:34:27 UTC
kernel-2.6.30.10-105.2.23.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/kernel-2.6.30.10-105.2.23.fc11

Comment 8 Fedora Update System 2010-02-11 12:03:55 UTC
kernel-2.6.31.12-174.2.19.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/kernel-2.6.31.12-174.2.19.fc12

Comment 9 Fedora Update System 2010-02-12 04:48:01 UTC
kernel-2.6.30.10-105.2.23.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2010-02-16 13:18:13 UTC
kernel-2.6.31.12-174.2.19.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 errata-xmlrpc 2010-03-17 00:18:57 UTC
This issue has been addressed in following products:

  Red Hat Enterprise Linux 5

Via RHSA-2010:0147 https://rhn.redhat.com/errata/RHSA-2010-0147.html

Comment 12 errata-xmlrpc 2010-03-23 15:42:36 UTC
This issue has been addressed in following products:

  MRG for RHEL-5

Via RHSA-2010:0161 https://rhn.redhat.com/errata/RHSA-2010-0161.html

Comment 13 Eugene Teo (Security Response) 2011-01-23 01:00:59 UTC
Statement:

This issue did not affect the versions of Linux kernel as shipped with Red Hat Enterprise Linux 3 and 4, as they do not include support for sys_move_pages. It was only introduced in kernel version 2.6.18 onwards. This issue was addressed in Red Hat Enterprise Linux 5 and Red Hat Enterprise MRG via https://rhn.redhat.com/errata/RHSA-2010-0147.html and https://rhn.redhat.com/errata/RHSA-2010-0161.html.


Note You need to log in before you can comment on or make changes to this bug.