Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create an eventfd object with EFD_CLOEXEC flag, to avoid leaking file descriptor to child processes #204

Merged
merged 1 commit into from
May 6, 2022

Conversation

Tosainu
Copy link
Contributor

@Tosainu Tosainu commented Apr 13, 2022

The file descriptor irq_notify_fd does not have the close-on-exec (FD_CLOEXEC) flag so it possibly leaks to child processes.

This pull request adds an EFD_CLOEXEC flag to the second argument of the exentfd(2) call, which tells it to set an FD_CLOEXEC flag on the new file descriptor.

@arnopo
Copy link
Contributor

arnopo commented Apr 19, 2022

Hello @Tosainu
Could please fix the failed check? you don' follow the requested commit message format, by clicking "details" it you will have details on the issues.

@arnopo arnopo requested review from arnopo and edmooring April 19, 2022 15:50
The file descriptor `irq_notify_fd` does not have the close-on-exec
(`FD_CLOEXEC`) flag so it possibly leaks to child processes.
This adds an `EFD_CLOEXEC` flag to the second argument of the `exentfd(2)` call,
which tells it to set an `FD_CLOEXEC` flag on the new file descriptor.

Signed-off-by: Kenta Sato <tosainu.maple@gmail.com>
@Tosainu
Copy link
Contributor Author

Tosainu commented Apr 20, 2022

Hello. Thanks for your comments. I fixed failed compliance checks.

Copy link
Contributor

@edmooring edmooring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks good to me. Since the usage of this fd is largely internal to libmetal, leaving it open on exec() will leak a file descriptor.

@arnopo arnopo merged commit 86fd1ba into OpenAMP:main May 6, 2022
@arnopo arnopo added this to the Release V2022.10 milestone May 6, 2022
@Tosainu Tosainu deleted the eventfd-cloexec branch May 6, 2022 13:51
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.

3 participants