View Issue Details

IDProjectCategoryView StatusLast Update
0004989CentOS-6kernelpublic2011-07-22 09:09
Status newResolutionopen 
Product Version6.0 
Target VersionFixed in Version 
Summary0004989: Using mprotect across a 2MB page boundary locks up following memory access in the kernel
ix86_64 target

Compile and run the attached program (which has been preprocessed) to demonstrate the problem.

gcc centos_kernel_lock.i

The program uses mprotect to deny access rights to an 8KB region (two pages) that straddles a 2MB page boundary. It then writes a zero to the byte immediately following the pages with restricted access rights. The write never completes and oprofile will indicate that virtually 100% of the CPU time is being spent in the kernel.

TagsNo tags attached.


2011-07-20 15:29


centos_kernel_lock.i (35,812 bytes)

2011-07-21 06:39


centos_kernel_lock.c (2,736 bytes)


2011-07-21 14:49

reporter   ~0013024

I can make the test even simpler than this. It isn't necessary for the mprotect to straddle the 2MB boundary. If the region being mprotect'ed just starts on a 2MB boundary then it fails in the same way.


2011-07-22 09:09

reporter   ~0013026

I have found a work around for this apparent kernel bug. If as root you do:

echo never >/sys/kernel/mm/redhat_transparent_hugepage/enabled

then the issue goes away. Of course there may be a performance impact of disabling the use of huge pages.

Issue History

Date Modified Username Field Change
2011-07-20 15:29 rwhitton New Issue
2011-07-20 15:29 rwhitton File Added: centos_kernel_lock.i
2011-07-21 06:39 rwhitton File Added: centos_kernel_lock.c
2011-07-21 14:49 rwhitton Note Added: 0013024
2011-07-22 09:09 rwhitton Note Added: 0013026