From a38de31c8b0dc5a5b1b534e766cb12988a2db5d9 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 9 Aug 2023 02:02:23 +0900 Subject: [PATCH] remount-fs: refuse to remount based on fstab when fstab=no kernel command line option specified Otherwise, if for some reasons remount-fs is invoked even when fstab=no is specified, mounts may get unexpected options from fstab. For safety, let's parse the kernel command line option. --- src/remount-fs/remount-fs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/remount-fs/remount-fs.c b/src/remount-fs/remount-fs.c index 25e661105b0..2874a0390de 100644 --- a/src/remount-fs/remount-fs.c +++ b/src/remount-fs/remount-fs.c @@ -78,6 +78,9 @@ static int remount_by_fstab(Hashmap **ret_pids) { assert(ret_pids); + if (!fstab_enabled()) + return 0; + f = setmntent(fstab_path(), "re"); if (!f) { if (errno != ENOENT) -- 2.47.3