Skip to content

Conversation

@emeks-dev
Copy link

Description

This resolves #21

Shared memory is a high-performance inter process communication (IPC) mechanism that involves allocating ram regions accessible to multiple independent processes.
This is not the default way for IPC, as the OS kernel seeks to isolate the memory allocated to each process. It does this by allowing the use of different resources to achieve communication, such as pipes, files, sockets and queues. These methods require the kernel to copy and move information back and forth between processes, which can be expensive and/or slow.
Thus using shared memory we allow independent processes to read and write the information at the same memory region, gaining speed and efficiency. Processes access this space as if they were using local memory.
Its important to note that this can be an attack vector, as other processes can compromise the information read by other processes without kernel interference. Also, for maintaining data integrity, processes must implement their own synchronization mechanisms to coordinate access and prevent race conditions.

Despite this mechanism potentially seeming to permissive, shared memory is extensively used by modern applications and processes because of its performance benefits.
Databases uses them for tasks like caching data and transactions logs, and for facilitating IPC between worker processes and the main application. Web server also rely on this for rapidly sharing configuration data, session states and cached web content across multiple independent worker processes to handle client requests.

Changes

  • Including a one shot systemd service to remount the /dev/shm to be only ro, noexec. (this was the only clean way to achive this as during the boot of the system a process was mounting the /dev/shm to be writable and without noexec option.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Analize Securing Shared Memory

3 participants