Create an eventfd object with EFD_CLOEXEC flag

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>
This commit is contained in:
Kenta Sato
2022-05-06 14:09:12 +02:00
committed by Arnaud Pouliquen
parent 2371f615bb
commit 86fd1ba48e
+1 -1
View File
@@ -219,7 +219,7 @@ int metal_linux_irq_init(void)
memset(&irqs, 0, sizeof(irqs));
irq_notify_fd = eventfd(0, 0);
irq_notify_fd = eventfd(0, EFD_CLOEXEC);
if (irq_notify_fd < 0) {
metal_log(METAL_LOG_ERROR,
"Failed to create eventfd for IRQ handling.\n");