Skip to contentSkip to conversation

Rationale for RLIMIT_MEMLOCK?

DISCUSSION Michael Kerrisk 1 participant 1 message Feb 3, 2006

lore
Share & tools
lore
#0 lore raw
Quoted 1 line
Quoted 1 line

Matthias Andree <[email protected]> wrote:

[...]

Quoted 7 lines

The complete story is, condensed, and with return values, for a setuid-root application:

  geteuid() == 0;
  mlockall(MLC_CURRENT|MLC_FUTURE) == (success);
  seteuid(500) == (success);
  valloc(64512 + pagesize) == NULL (failure);

[...]

A late follow-up to this thread. I've added the following text to the mlockall() manual pag under BUGS:

Since kernel 2.6.9, if a privileged process calls mlockall(MCL_FUTURE) and later drops privileges (CAP_IPC_LOCK), then subsequent memory allocations (e.g., mmap(2), sbrk(2)) will fail if the RLIMIT_MEMLOCK resource limit is encountered.

The change will be in man-pages 2.23.

Cheers,

Michael

Signature · 8 lines
Michael Kerrisk
maintainer of Linux man pages Sections 2, 3, 4, 5, and 7 

Want to help with man page maintenance?  
Grab the latest tarball at
ftp://ftp.win.tue.nl/pub/linux-local/manpages/, 
read the HOWTOHELP file and grep the source 
files for 'FIXME'.