Bug 222623 - mlock call needs root previlage to lock the memory pages.
mlock call needs root previlage to lock the memory pages.
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: kernel (Show other bugs)
4.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Kernel Maintainer List
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-01-15 06:09 EST by Pramila
Modified: 2007-11-30 17:07 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-02-09 15:36:18 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Pramila 2007-01-15 06:09:16 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:
1.
#include <unistd.h>
#include <sys/shm.h>
main()
    {
    int id;
    key_t key;
    char proc_id = 'C';
    int size = 0x5000;
    int flags = 0664 | IPC_CREAT;              /* read-only for others */
    int mlock_status;
    int shmdt_status;
    void        *addr;
    int         shmctl_status;
    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)
		printf("mlock failed!");

    shmdt_status = shmdt( (const void *) addr);
    shmctl (id, IPC_RMID, NULL);
    }

2.run this program as a non root users.
3.
  
Actual results:


Expected results:


Additional info:
Comment 1 Dennis Gregorovic 2007-01-15 10:49:24 EST
redhat-release is not the correct component for this.  Perhaps you meant 'kernel'?
Comment 2 Jason Baron 2007-02-09 15:36:18 EST
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.

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