msgget¶
Intro¶
msgget - Get a System V message queue identifier
Description¶
The msgget() system call returns the message queue identifier associated with the value of the key argument. If key is equal to IPC_PRIVATE, the message queue identifier is created and associated with an internal key value and both are returned. If the System V message queue identifier and key exists and the user does not have the required permissions to access the queue, the system call fails and the return value is -1. If multiple processes attempt to create a message queue with the same key value, each process will get the same message queue identifier and the same internal key value. If a message queue identifier exists for a given key value and msgflg specifies IPC_CREAT and IPC_EXCL, the call will fail.
There are a few drawbacks related to msgget() that should be mentioned. Firstly, the IPC_PRIVATE key should not be used as it is shared across all connections. Secondly, the message queue identifier associated with the key not being available when held by the server can result in unintended consequences. Lastly, the System V message queue identifier identifier is limited in size, meaning that only a relatively small number of queues can be created on a particular system.
Arguments¶
key
:key_t
- Identifier for the System V message queue.msgflg
:int
- A flag that can include any of the following flags: IPC_CREAT, IPC_EXCL, or IPC_NOWAIT.
Available Tags¶
- U - Originated from user space
- TOCTOU - Vulnerable to TOCTOU (time of check, time of use)
Hooks¶
sys_msgget¶
Type¶
kprobes
Purpose¶
To identify calls to the sys_msgget function
Example Use Case¶
The msgget system call can be used to create a System V message queue identifier which can be used to help in the interprocess communication among different processes running in the system.
Issues¶
One issue with the msgget system call is that it has limited numbers of message queues that can be created in a system depending on the size of the System V message queue identifier.
Related Events¶
- msgsnd
- msgrcv
This document was automatically generated by OpenAI and needs review. It might not be accurate and might contain errors. The authors of Tracee recommend that the user reads the "events.go" source file to understand the events and their arguments better.