Red Hat Bugzilla – Bug 222623
mlock call needs root previlage to lock the memory pages.
Last modified: 2007-11-30 17:07:28 EST
Description of problem: Our requirement is that mlock should work for normal
users. Other OS like Solaris support this.
Version-Release number of selected component (if applicable): RHEL 4.
How reproducible: Always
Steps to Reproduce:
char proc_id = 'C';
int size = 0x5000;
int flags = 0664 | IPC_CREAT; /* read-only for others */
struct shmid_ds foo;
key = ftok ("~creator/ipckey", proc_id);
id = shmget (key, size, flags);
addr = shmat(id, (const void *) NULL, (int) 0);
/*shmctl_status = shmctl( id, SHM_LOCK, &foo);*/
if ( (mlock( (const void *)addr, (size_t) size)) != 0)
shmdt_status = shmdt( (const void *) addr);
shmctl (id, IPC_RMID, NULL);
2.run this program as a non root users.
redhat-release is not the correct component for this. Perhaps you meant 'kernel'?
hmmm, you can set user limits in the shell using the 'ulimit' command up to the
hard limit which is 32 kb by default for mlock. HOwever, the administrator can
up thish limit per-user vi /etc/security/limits.conf file.