The LSM IPC object specific hooks define the alloc_security() and free_security() functions to manage the security field in each object's kern_ipc_perm data structure. An IPC object is created with an initial ``get'' request, which triggers the object specific alloc_security. If the ``get'' request finds an already existing object, the associate() hook is called to check permissions before returning the object.
IPC object control commands, shmctl(2), semctl(2), and msgctl(2) are mediated by object specific ``ctl'' hooks. For example, when a SHM_LOCK request is issued, the shm_security_ops shmctl() hook is checked for permission prior to completing the request.
Any attempt to change a semaphore count is protected by the sem_security_ops semop() hook. Attaching to a shared memory segment is protected by the shm_security_ops shmat() hook. Sending and receiving messages on a message queue are protected by the msg_queue_security_ops msgsnd() and msgrcv() hooks. The individual messages are considered as well as the queue when verifying permission. When a new message is created, the msg_msg_security_ops alloc_security() hook allocates the security field stored in the actual message data structure. Upon receipt, the msgrcv() hook can verify the security field on both the queue and the message.