If a mounted image is used as root, overlayfs is typically used to provide write access. In this case, it is safe to execute switch_root.
Signed-off-by: Alexey Gladkov <[email protected]> --- util-linux/switch_root.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c index 14139736e..3ffea5482 100644 --- a/util-linux/switch_root.c +++ b/util-linux/switch_root.c @@ -64,6 +64,9 @@ extern int capget(cap_user_header_t header, const cap_user_data_t data); #ifndef TMPFS_MAGIC # define TMPFS_MAGIC ((unsigned)0x01021994) #endif +#ifndef OVERLAYFS_MAGIC +#define OVERLAYFS_MAGIC ((unsigned)0x794c7630) +#endif #ifndef MS_MOVE # define MS_MOVE 8192 #endif @@ -244,8 +247,9 @@ int switch_root_main(int argc UNUSED_PARAM, char **argv) statfs("/", &stfs); // this never fails if ((unsigned)stfs.f_type != RAMFS_MAGIC && (unsigned)stfs.f_type != TMPFS_MAGIC + && (unsigned)stfs.f_type != OVERLAYFS_MAGIC ) { - bb_simple_error_msg_and_die("root filesystem is not ramfs/tmpfs"); + bb_simple_error_msg_and_die("root filesystem is not ramfs/tmpfs/overlayfs"); } if (!dry_run) { -- 2.49.0 _______________________________________________ busybox mailing list [email protected] https://lists.busybox.net/mailman/listinfo/busybox
