Bug 439926 - do not limit locked memory when RLIMIT_MEMLOCK is RLIM_INFINITY
do not limit locked memory when RLIMIT_MEMLOCK is RLIM_INFINITY
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: kernel (Show other bugs)
All Linux
medium Severity medium
: rc
: ---
Assigned To: Larry Woodman
Martin Jenner
: OtherQA
Depends On:
Blocks: 442426
  Show dependency treegraph
Reported: 2008-03-31 19:50 EDT by Greg Marsden
Modified: 2008-07-24 15:28 EDT (History)
2 users (show)

See Also:
Fixed In Version: RHSA-2008-0665
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-07-24 15:28:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
do not limit locked memory (568 bytes, patch)
2008-03-31 19:50 EDT, Greg Marsden
no flags Details | Diff

  None (edit)
Description Greg Marsden 2008-03-31 19:50:12 EDT
This patch fixes a bug in mm/mlock.c on 32-bit architectures that prevents
a user from locking more than 4GB of shared memory, or allocating more
than 4GB of shared memory in hugepages, when rlim[RLIMIT_MEMLOCK] is

Signed-off-by: Herbert van den Bergh <herbert.van.den.bergh@oracle.com>
Acked-by: Chris Mason <chris.mason@oracle.com>

--- linux-2.6.22/mm/mlock.c.orig	2007-07-09 10:19:31.000000000 -0700
+++ linux-2.6.22/mm/mlock.c	2007-07-09 10:19:19.000000000 -0700
@@ -244,9 +244,12 @@ int user_shm_lock(size_t size, struct us
 	locked = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
 	lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur;
+	if (lock_limit == RLIM_INFINITY)
+		allowed = 1;
 	lock_limit >>= PAGE_SHIFT;
-	if (locked + user->locked_shm > lock_limit && !capable(CAP_IPC_LOCK))
+	if (!allowed &&
+	    locked + user->locked_shm > lock_limit && !capable(CAP_IPC_LOCK))
 		goto out;
 	user->locked_shm += locked;
Comment 1 Greg Marsden 2008-03-31 19:50:12 EDT
Created attachment 299796 [details]
do not limit locked memory
Comment 3 RHEL Product and Program Management 2008-04-14 11:00:52 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
Comment 7 Chris Ward 2008-06-05 11:56:57 EDT
~ Attention: ~ Feedback requested regarding this **High Priority** bug. 

A fix for this issue should be included in the latest packages contained in
RHEL4.7-Snapshot1--available now on partners.redhat.com.

After you (Red Hat Partner) have verified that this issue has been addressed,
submit a comment describing the passing results of your test in appropriate
detail, along with which snapshot and package version tested. The bugzilla will
be updated by Red Hat Quality Engineering for you when this information has been

If you believe this issue has not properly fixed or you are unable to verify the
issue for any reason, please add a comment describing the most recent issues you
are experiencing, along with which snapshot and package version tested. 

If you believe the bug has not been fixed, change the status of the bug to ASSIGNED.

If you are receiving this message in Issue Tracker, please reply with a message
to Issue Tracker about your results and bugzilla will be updated for you. 

If you need assistance accessing ftp://partners.redhat.com, please contact your
Partner Manager.

Thank you
Red Hat QE Partner Management
Comment 8 Chris Ward 2008-06-06 04:30:48 EDT
Correction: This bug is **Medium Priority**. Sorry.
Comment 10 errata-xmlrpc 2008-07-24 15:28:36 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


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