Skip to content

Commit b75d7e4

Browse files
authored
Merge pull request #1951 from karuboniru/main
Move notify handler before mounts to primary uid namespace
2 parents 53e9094 + f311dc0 commit b75d7e4

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/libcrun/container.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ enum handler_configure_phase
2929
HANDLER_CONFIGURE_BEFORE_MOUNTS = 1,
3030
HANDLER_CONFIGURE_AFTER_MOUNTS,
3131
HANDLER_CONFIGURE_MOUNTS,
32+
HANDLER_CONFIGURE_BEFORE_USERNS
3233
};
3334

3435
struct custom_handler_manager_s;

src/libcrun/handlers/krun.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ libkrun_configure_container (void *cookie, enum handler_configure_phase phase,
467467
return crun_make_error (err, errno, "open `%s`", rootfs);
468468
}
469469

470-
if (phase == HANDLER_CONFIGURE_BEFORE_MOUNTS)
470+
if (phase == HANDLER_CONFIGURE_BEFORE_USERNS)
471471
{
472472
cleanup_free char *origin_config_path = NULL;
473473
cleanup_free char *state_dir = NULL;

src/libcrun/linux.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5033,6 +5033,11 @@ libcrun_run_linux_container (libcrun_container_t *container, container_entrypoin
50335033
if (UNLIKELY (ret < 0))
50345034
return ret;
50355035

5036+
ret = libcrun_container_notify_handler (args, HANDLER_CONFIGURE_BEFORE_USERNS, container,
5037+
container->container_def->root ? container->container_def->root->path : NULL, err);
5038+
if (UNLIKELY (ret < 0))
5039+
return ret;
5040+
50365041
/* If a new user namespace must be created, but there are other namespaces to join, then delay
50375042
the userns creation after the namespaces are joined. */
50385043
init_status.delayed_userns_create

0 commit comments

Comments
 (0)