1
0
Olaf Hering 2021-11-23 15:09:48 +00:00 committed by Git OBS Bridge
parent 452078a00d
commit 2949309811

View File

@ -17,29 +17,23 @@
Err(DockerError::InspectError) Err(DockerError::InspectError)
--- a/init.c --- a/init.c
+++ b/init.c +++ b/init.c
@@ -381,11 +381,11 @@ void init_nsm_driver() { @@ -386,6 +386,9 @@ void init_nsm_driver() {
if (fd < 0 && errno == ENOENT) { die_on(rc < 0, "failed to insert nsm driver");
return;
}
- die_on(fd < 0, "failed to open nsm fd");
+ die_on(0&& fd < 0, "failed to open nsm fd");
rc = finit_module(fd, "", 0);
- die_on(rc < 0, "failed to insert nsm driver");
+ die_on(0&& rc < 0, "failed to insert nsm driver");
- die_on(close(fd), "close nsm fd"); die_on(close(fd), "close nsm fd");
+ die_on(0&& close(fd), "close nsm fd"); + rc = unlink(NSM_PATH);
+ if (rc < 0)
+ warn("Could not unlink " NSM_PATH);
} }
int main() { int main() {
@@ -399,6 +399,10 @@ int main() { @@ -418,6 +421,9 @@ int main() {
init_dev(); fclose(env_file);
init_console(); fclose(cmd_file);
+ char *pre_init[] = { "/rootfs/pre_init.sh", NULL , }; + unlink("/env");
+ pid_t pre_pid = launch(pre_init, NULL); + unlink("/cmd");
+ reap_until(pre_pid);
+ +
// Insert the Nitro Secure Module driver die_on(chdir("/rootfs") != 0, "chdir /rootfs");
init_nsm_driver(); die_on(chroot("/rootfs") != 0, "chroot /rootfs");