Skip to content

eBPF-based security platform

image: check the device of the config directory where it is opened

Daniel Borkmannc720c8565fa5
diff --git a/util/image_runtime.c b/util/image_runtime.c
index 03fea00d..432bfb24 100644
--- a/util/image_runtime.c
+++ b/util/image_runtime.c
@@ -904,7 +904,12 @@ static int config_mount_check(const struct config_update_record *record)
ret = -errno;
goto out;
}
- ret = mount_flags(fd, false);
+ if (fstat(fd, &st))
+ ret = -errno;
+ else if (st.st_dev != device.device)
+ ret = -EUCLEAN;
+ else
+ ret = mount_flags(fd, false);
if (!ret)
ret = image_config_set(&image.bootstrap_config, fd);
close(fd);