From: "florian.bezdeka@siemens.com" <florian.bezdeka@siemens.com>
To: "isar-users@googlegroups.com" <isar-users@googlegroups.com>
Cc: "henning.schild@siemens.com" <henning.schild@siemens.com>,
"quirin.gylstorff@siemens.com" <quirin.gylstorff@siemens.com>,
"jan.kiszka@siemens.com" <jan.kiszka@siemens.com>,
"florian.bezdeka@siemens.com" <florian.bezdeka@siemens.com>
Subject: [RFC PATCH 2/2] wic: Warn if an ext filesystem affected by the Y2038 problem is used
Date: Mon, 1 Feb 2021 18:58:23 +0000 [thread overview]
Message-ID: <20210201185815.382326-3-florian.bezdeka@siemens.com> (raw)
In-Reply-To: <20210201185815.382326-1-florian.bezdeka@siemens.com>
From: Florian Bezdeka <florian.bezdeka@siemens.com>
We are getting closer and closer to the year 2038 where the 32 bit
time_t overflow will happen. While products (= embedded systems) with an
expected life time of 15 years are still save the situation may change
if your system has to survive the next 20 years.
While ext2 and ext3 file systems are always affected by the time overflow,
let's warn the user if these file systems are still being used.
If ext4 is affected depends on the inode size chosen during file system
creation. At least 256 bytes are necessary to be save. As ext4 is
used very often (and partitions may be small first and extended later)
this might be an issue for many users.
Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---
scripts/lib/wic/partition.py | 38 ++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index 85eb15c..c165457 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -270,6 +270,8 @@ class Partition():
mkfs_cmd = "fsck.%s -pvfD %s" % (self.fstype, rootfs)
exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
+ self.check_for_Y2038_problem(rootfs, native_sysroot)
+
def prepare_rootfs_btrfs(self, rootfs, oe_builddir, rootfs_dir,
native_sysroot, pseudo):
"""
@@ -356,6 +358,8 @@ class Partition():
(self.fstype, extraopts, label_str, self.fsuuid, rootfs)
exec_native_cmd(mkfs_cmd, native_sysroot)
+ self.check_for_Y2038_problem(rootfs, native_sysroot)
+
def prepare_empty_partition_btrfs(self, rootfs, oe_builddir,
native_sysroot):
"""
@@ -417,3 +421,37 @@ class Partition():
mkswap_cmd = "mkswap %s -U %s %s" % (label_str, self.fsuuid, path)
exec_native_cmd(mkswap_cmd, native_sysroot)
+
+ def check_for_Y2038_problem(self, rootfs, native_sysroot):
+ """
+ Check if the filesystem is affected by the Y2038 problem
+ (Y2038 problem = 32 bit time_t overflow in January 2038)
+ """
+ def get_err_str(part):
+ err = "The {} filesystem {} has no Y2038 support."
+ if part.mountpoint:
+ args = [part.fstype, "mounted at %s" % part.mountpoint]
+ elif part.label:
+ args = [part.fstype, "labeled %s" % part.label]
+ elif part.part_name:
+ args = [part.fstype, "in partition %s" % part.part_name]
+ else:
+ args = [part.fstype, ""]
+ return err.format(*args)
+
+ ret, out = exec_native_cmd("dumpe2fs %s" % rootfs, native_sysroot)
+
+ # ext2 and ext3 are always affected by the Y2038 problem
+ if self.fstype in ["ext2", "ext3"]:
+ logger.warn(get_err_str(self))
+ return
+
+ # if ext4 is affected by the Y2038 problem depends on the inode size
+ # Remember: inode size depends on the file system size
+ for line in out.splitlines():
+ if line.startswith("Inode size:"):
+ size = int(line.split(":")[1].strip())
+ if size < 256:
+ logger.warn("%s Inodes (of size %d) are too small." % \
+ (get_err_str(self), size))
+ break
\ No newline at end of file
--
2.29.2
next prev parent reply other threads:[~2021-02-01 18:58 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-01 18:58 [RFC PATCH 0/2] wic: warn on usage of Y2038 affected file systems florian.bezdeka
2021-02-01 18:58 ` [RFC PATCH 1/2] wic-img: Forward warnings from wic to bitbake florian.bezdeka
2021-02-01 18:58 ` florian.bezdeka [this message]
2021-02-11 8:07 ` [RFC PATCH 0/2] wic: warn on usage of Y2038 affected file systems Anton Mikanovich
2021-02-11 8:23 ` Henning Schild
2021-02-11 9:09 ` Jan Kiszka
2021-02-11 9:57 ` florian.bezdeka
2021-02-11 10:21 ` Henning Schild
2021-02-11 12:47 ` florian.bezdeka
2021-02-11 13:31 ` florian.bezdeka
2021-02-11 14:13 ` Henning Schild
2021-02-11 17:57 ` Jan Kiszka
2021-02-11 18:01 ` Henning Schild
2021-02-17 11:56 ` Baurzhan Ismagulov
2021-03-01 15:18 ` [PATCH] wic: Warn if an ext filesystem affected by the Y2038 problem is used Florian Bezdeka
2021-03-01 15:23 ` vijaikumar....@gmail.com
2021-03-01 15:38 ` florian.bezdeka
2021-03-01 15:58 ` vijaikumar....@gmail.com
2021-03-01 17:22 ` Jan Kiszka
2021-03-01 17:45 ` florian.bezdeka
2021-03-01 17:54 ` vijaikumar....@gmail.com
2021-03-02 9:20 ` Henning Schild
2021-03-02 10:12 ` Jan Kiszka
2021-03-27 7:20 ` [RFC PATCH 0/2] wic: warn on usage of Y2038 affected file systems Jan Kiszka
2021-03-27 8:54 ` Florian Bezdeka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210201185815.382326-3-florian.bezdeka@siemens.com \
--to=florian.bezdeka@siemens.com \
--cc=henning.schild@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=jan.kiszka@siemens.com \
--cc=quirin.gylstorff@siemens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox