Bug 113335

Summary: mlock value in limits.conf has no effect on ulimit -l
Product: Red Hat Enterprise Linux 3 Reporter: Greg Marsden <greg.marsden>
Component: pamAssignee: Nalin Dahyabhai <nalin>
Status: CLOSED DUPLICATE QA Contact: Jay Turner <jturner>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: guru.anbalagane, jcaruso, srevivo
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-02-21 19:00:43 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Greg Marsden 2004-01-12 20:15:03 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5)
Gecko/20031120 Firebird/0.7

Description of problem:
Setting memlock value in limits.conf does not affect ulimit -l value

[0] gmarsden@ca-build2:~$ ulimit -l
[0] gmarsden@ca-build2:~$ grep memlock /etc/security/limits.conf
#        - memlock - max locked-in-memory address space (KB)
*       soft    memlock         32768
*       hard    memlock         32768
[0] gmarsden@ca-build2:~$ su
[root@ca-build2 gmarsden]# ulimit -l 32768
[root@ca-build2 gmarsden]# su gmarsden
[0] gmarsden@ca-build2:~$ ulimit -l
[0] gmarsden@ca-build2:~$ ulimit -a
max locked memory     (kbytes, -l) 32768

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.see above

Additional info:

Workaround available (above) but not good

Comment 1 Greg Marsden 2004-01-13 18:33:01 UTC
"UsePrivilegeSeparation yes" does solve the problem, and uncovers
why this is happening: because ssh forks of a child process to handle
the authentication, that child process invokes the PAM routines but
doesn't have the permissions to set the proper ulimit values.  Then
when the process returns, ssh assumes that the limits have been set
already, and doesn't invoke the PAM stuff again. In this case,
whatever ulimit values are set when ssh is invoked, these values are
passed along to the new login session (this is not correct).

The "right" way to get around this is to tell sshd "UseLogin yes", as
this will reinvoke the pam limits stuff after the authentication
process returns.  The real right way, though, would be to fix either
pam or ssh to ensure that the right limits are set.

Comment 2 Greg Marsden 2004-01-13 19:13:02 UTC
That should read "UsePrivilegeSeparation no" in the first line.

Comment 3 Greg Marsden 2004-04-07 19:14:26 UTC
This is fixed in SSH version 3.8, not sure if it's been packaged for
distribution though.

Comment 4 John Caruso 2004-07-15 01:21:02 UTC
Me too.

This bug can have *very* serious implications for Oracle sites 
running large SGAs; see bug 127897 for details.

Comment 5 Neil Horman 2004-08-26 13:39:14 UTC

*** This bug has been marked as a duplicate of 116133 ***

Comment 6 Red Hat Bugzilla 2006-02-21 19:00:43 UTC
Changed to 'CLOSED' state since 'RESOLVED' has been deprecated.