Skip to content

Commit

Permalink
Merge pull request #1368 from giuseppe/do-not-cloexec-fds-to-inherit
Browse files Browse the repository at this point in the history
criu: do not set CLOEXEC on fds to inherit
  • Loading branch information
flouthoc authored Dec 4, 2023
2 parents 056a74c + 7c5a32a commit 934d24a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libcrun/criu.c
Original file line number Diff line number Diff line change
Expand Up @@ -896,13 +896,14 @@ libcrun_container_restore_linux_criu (libcrun_container_status_t *status, libcru
* The <key> needs to be the same as during checkpointing (extRootNetNS). */
for (i = 0; i < def->linux->namespaces_len; i++)
{
const int open_flags_for_inherit = O_RDONLY; /* Cannot be O_CLOEXEC as it is passed to the child process. */
int value = libcrun_find_namespace (def->linux->namespaces[i]->type);
if (UNLIKELY (value < 0))
return crun_make_error (err, 0, "invalid namespace type: `%s`", def->linux->namespaces[i]->type);

if (value == CLONE_NEWNET && def->linux->namespaces[i]->path != NULL)
{
inherit_new_net_fd = open (def->linux->namespaces[i]->path, O_RDONLY | O_CLOEXEC);
inherit_new_net_fd = open (def->linux->namespaces[i]->path, open_flags_for_inherit);
if (UNLIKELY (inherit_new_net_fd < 0))
return crun_make_error (err, errno, "unable to open(): `%s`", def->linux->namespaces[i]->path);

Expand All @@ -911,7 +912,7 @@ libcrun_container_restore_linux_criu (libcrun_container_status_t *status, libcru

if (value == CLONE_NEWPID && def->linux->namespaces[i]->path != NULL)
{
inherit_new_pid_fd = open (def->linux->namespaces[i]->path, O_RDONLY | O_CLOEXEC);
inherit_new_pid_fd = open (def->linux->namespaces[i]->path, open_flags_for_inherit);
if (UNLIKELY (inherit_new_pid_fd < 0))
return crun_make_error (err, errno, "unable to open(): `%s`", def->linux->namespaces[i]->path);

Expand Down

1 comment on commit 934d24a

@packit-as-a-service
Copy link

Choose a reason for hiding this comment

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

podman-next COPR build failed. @containers/packit-build please check.

Please sign in to comment.