• Hugh Dickins's avatar
    [PATCH] shmctl SHM_LOCK perms · 2637792e
    Hugh Dickins authored
    Michael Kerrisk has observed that at present any process can SHM_LOCK any
    shm segment of size within process RLIMIT_MEMLOCK, despite having no
    permissions on the segment: surprising, though not obviously evil.  And any
    process can SHM_UNLOCK any shm segment, despite no permissions on it: that
    is surely wrong.
    
    Unless CAP_IPC_LOCK, restrict both SHM_LOCK and SHM_UNLOCK to when the
    process euid matches the shm owner or creator: that seems the least
    surprising behaviour, which could be relaxed if a need appears later.
    Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    2637792e
shm.c 20.9 KB