mq_timedreceive_time32¶
Intro¶
mq_timedreceive_time32()
- receives the oldest of the highest priority messages stored in the message queue specified by mqdes.
Description¶
The mq_timedreceive_time32()
system call atomically removes the oldest of the highest priority messages from the message queue specified by the mqdes
argument, places it in the memory pointed to by u_msg_ptr
, and returns its priority in the integer pointed to by msg_prio
. The msg_len
argument specifies the size in bytes of the storage pointed to by u_msg_ptr
; this space must be greater than or equal to the mq_msgsize attribute of the message queue. The u_abs_timeout
argument points to a structure that specifies the absolute timeout of the call.
It can provide synchronization and communication between processes, like avoiding busy waiting and non-sharing of resources between different threads. While there are many advantage to using this system call, one downside of it is that it does not ensure real-time delivery of the message. Also, it is vulnerable to the time of check, time of use (TOCTOU) vulnerability.
Arguments¶
mqdes
:mqd_t
[K] - Descriptor of the message queue.u_msg_ptr
:char*
[K] - Points to the buffer where the oldest/highest priority message will be stored.msg_len
:unsigned int
[K] - Length in bytes of the buffer.u_msg_prio
:unsigned int*
[K] - Pointer to an integer that stores the priority of the received message.u_abs_timeout
:struct old_timespec32*
[K] - Specifies the absolute timeout of the call.
Available Tags¶
- K - Originated from kernel-space.
Hooks¶
mq_timedreceive_time32¶
Type¶
Kprobe + Kretprobe
Purpose¶
Hook the mq_timedreceive_time32()
system call to measure performance metrics (e.g. latency) and receive messages as expected.
Example Use Case¶
mq_timedreceive_time32()
can be used to provide synchronization between different processes and threads. For example, it can be used in a web browser application to receive data from a server that has the same message queue descriptor as the process.
Issues¶
- It does not ensure real-time delivery of the messages.
- It is vulnerable to the time of check, time of use (TOCTOU) vulnerability.
Related Events¶
mq_timedsend_time32()
- sends a message with absolute timeout to a message queue.mq_open()
- used to open or create a message queue.
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.