Gentoo Logo

Linux kernel do_mremap local privilege escalation vulnerability


1.  Gentoo Linux Security Advisory

Version Information

Advisory Reference GLSA 200403-02 / Kernel
Release Date March 05, 2004
Latest Revision May 22, 2006: 03
Impact high
Exploitable local
Package Vulnerable versions Unaffected versions Architecture(s)
sys-kernel/aa-sources < 2.4.23-r1 >= 2.4.23-r1* All supported architectures
sys-kernel/alpha-sources < 2.4.21-r4 >= 2.4.21-r4 All supported architectures
sys-kernel/ck-sources < 2.6.2-r1 = 2.4.24-r1, >= 2.6.2-r1* All supported architectures
sys-kernel/compaq-sources < >= All supported architectures
sys-kernel/development-sources < 2.6.3_rc1 >= 2.6.3_rc1 All supported architectures
sys-kernel/gaming-sources < 2.4.20-r8 >= 2.4.20-r8 All supported architectures
sys-kernel/gentoo-dev-sources < 2.6.3_rc1 >= 2.6.3_rc1 All supported architectures
sys-kernel/gentoo-sources < 2.4.22-r7 = 2.4.19-r11, = 2.4.20-r12, >= 2.4.22-r7 All supported architectures
sys-kernel/grsec-sources < >= All supported architectures
sys-kernel/gs-sources < 2.4.25_pre7-r2 >= 2.4.25_pre7-r2 All supported architectures
sys-kernel/hardened-sources < 2.4.24-r1 >= 2.4.24-r1 All supported architectures
sys-kernel/hppa-dev-sources < 2.6.2_p3-r1 >= 2.6.2_p3-r1 All supported architectures
sys-kernel/hppa-sources < 2.4.24_p0-r1 >= 2.4.24_p0-r1 All supported architectures
sys-kernel/ia64-sources < 2.4.24-r1 >= 2.4.24-r1 All supported architectures
sys-kernel/mips-prepatch-sources < 2.4.25_pre6-r1 >= 2.4.25_pre6-r1 All supported architectures
sys-kernel/mips-sources < 2.4.25_rc4 >= 2.4.25_rc4 All supported architectures
sys-kernel/mm-sources < 2.6.3_rc1-r1 >= 2.6.3_rc1-r1 All supported architectures
sys-kernel/openmosix-sources < 2.4.22-r4 >= 2.4.22-r4 All supported architectures
sys-kernel/pac-sources < 2.4.23-r3 >= 2.4.23-r3 All supported architectures
sys-kernel/planet-ccrma-sources < 2.4.21-r5 >= 2.4.21-r5 All supported architectures
sys-kernel/ppc-development-sources < 2.6.3_rc1-r1 >= 2.6.3_rc1-r1 All supported architectures
sys-kernel/ppc-sources < 2.4.24-r1 >= 2.4.24-r1 All supported architectures
sys-kernel/ppc-sources-benh < 2.4.22-r5 >= 2.4.22-r5 All supported architectures
sys-kernel/ppc-sources-crypto < 2.4.20-r3 >= 2.4.20-r3 All supported architectures
sys-kernel/ppc-sources-dev < 2.4.24-r2 >= 2.4.24-r2 All supported architectures
sys-kernel/selinux-sources < 2.4.24-r2 >= 2.4.24-r2 All supported architectures
sys-kernel/sparc-dev-sources < 2.6.3_rc1 >= 2.6.3_rc1 All supported architectures
sys-kernel/sparc-sources < 2.4.24-r2 >= 2.4.24-r2 All supported architectures
sys-kernel/usermode-sources < 2.6.3-r1 revision >= 2.4.24-r1, revision >= 2.4.26, >= 2.6.3-r1 All supported architectures
sys-kernel/vanilla-prepatch-sources < 2.4.25_rc4 >= 2.4.25_rc4 All supported architectures
sys-kernel/vanilla-sources < 2.4.25 >= 2.4.25 All supported architectures
sys-kernel/win4lin-sources < 2.6.2-r1 = 2.4.23-r2, >= 2.6.2-r1 All supported architectures
sys-kernel/wolk-sources < 4.10_pre7-r3 = 4.9-r4, >= 4.10_pre7-r3 All supported architectures
sys-kernel/xfs-sources < 2.4.24-r2 >= 2.4.24-r2 All supported architectures

Warning: *: Needs to be manually updated

Related bugreports: #42024


A critical security vulnerability has been found in recent Linux kernels by Paul Starzetz of iSEC Security Research which allows for local privilege escalations.

2.  Impact Information


The Linux kernel is responsible for memory management in a working system - to allow this, processes are allowed to allocate and unallocate memory.


The memory subsystem allows for shrinking, growing, and moving of chunks of memory along any of the allocated memory areas which the kernel posesses.

To accomplish this, the do_mremap code calls the do_munmap() kernel function to remove any old memory mappings in the new location - but, the code doesn't check the return value of the do_munmap() function which may fail if the maximum number of available virtual memory area descriptors has been exceeded.

Due to the missing return value check after trying to unmap the middle of the first memory area, the corresponding page table entries from the second new area are inserted into the page table locations described by the first old one, thus they are subject to page protection flags of the first area. As a result, arbitrary code can be executed.


Arbitrary code with normal non-super-user privelerges may be able to exploit this vulnerability and may disrupt the operation of other parts of the kernel memory management subroutines finally leading to unexpected behavior.

Since no special privileges are required to use the mremap() and mummap() system calls any process may misuse this unexpected behavior to disrupt the kernel memory management subsystem. Proper exploitation of this vulnerability may lead to local privilege escalation allowing for the execution of arbitrary code with kernel level root access.

Proof-of-concept exploit code has been created and successfully tested, permitting root escalation on vulnerable systems. As a result, all users should upgrade their kernels to new or patched versions.

3.  Resolution Information


Users who are unable to upgrade their kernels may attempt to use "sysctl -w vm.max_map_count=1000000", however, this is a temporary fix which only solves the problem by increasing the number of memory areas that can be created by each process. Because of the static nature of this workaround, it is not recommended and users are urged to upgrade their systems to the latest avaiable patched sources.


Users are encouraged to upgrade to the latest available sources for their system:

Code Listing 3.1: Resolution

# emerge sync
# emerge -pv your-favourite-sources
# emerge your-favourite-sources
# # Follow usual procedure for compiling and installing a kernel.
# # If you use genkernel, run genkernel as you would do normally.

# # IF YOUR KERNEL IS MARKED as "remerge required!" THEN

4.  References


Page updated March 05, 2004

Summary: This is a Gentoo Linux Security Advisory

Security Team
Contact Address

Donate to support our development efforts.

Copyright 2001-2015 Gentoo Foundation, Inc. Questions, Comments? Contact us.