eclipse-score / eclipse-score/communication
Set `CLOEXEC` on file descriptors
- Dominant language
- C++
- Stars
- 62
- Forks
- 97
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 72
Description
### What
Currently, when offering a service, the communication library opens several file descriptors without using `CLOEXEC`. This means those file descriptors remain open in a child process which was spawned using `fork()` and `execve()`.
In [lifecycle](https://github.com/eclipse-score/lifecycle), we want to spawn new processes and have them connect back to a service which the parent process is providing.
We do not want to leak the existing file descriptors from the parent into the child, as this presumably would be insecure.
### How
Set `CLOEXEC` on all file descriptors when they are opened.
Alternatively, provide a guaranteed [async signal safe](https://www.man7.org/linux/man-pages/man7/signal-safety.7.html) method for removing a service offer, which we could call after `fork()`. (All code between `fork()` and `execve()` must be async signal safe.)
### Estimates for realization
_No response_
### Category
- [ ] Affects Detailed Design
### Requirements / Architecture
- [x] Requirements / Architecture are not affected by this change?
Contributor guide
Research direction
Start by locating where the communication library opens file descriptors for service offers, then inspect any related tests. Ensure every opened descriptor is marked CLOEXEC, and verify that a child created with fork() and execve() does not inherit the service's descriptors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- operating-systems, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100