From: Arnd Bergmann <arnd@arndb.de>
To: y2038@lists.linaro.org, Andrew Morton <akpm@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
Deepa Dinamani <deepa.kernel@gmail.com>,
linux-fsdevel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
Daniel Thompson <daniel.thompson@linaro.org>,
Lokesh Vutla <lokeshvutla@ti.com>,
Stafford Horne <shorne@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] initramfs: use time64_t timestamps
Date: Thu, 19 Oct 2017 11:55:27 +0200 [thread overview]
Message-ID: <20171019095536.801199-1-arnd@arndb.de> (raw)
The cpio format uses a 32-bit number to encode file timestamps,
which breaks initramfs support in 2038. This reinterprets the
timestamp as unsigned, to give us another 68 years and avoids
breaking until 2106.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
init/initramfs.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/init/initramfs.c b/init/initramfs.c
index e64bf7b4c1ca..53aa2d0a53d4 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -108,7 +108,7 @@ static void __init free_hash(void)
}
}
-static long __init do_utime(char *filename, time_t mtime)
+static long __init do_utime(char *filename, time64_t mtime)
{
struct timespec64 t[2];
@@ -124,10 +124,10 @@ static __initdata LIST_HEAD(dir_list);
struct dir_entry {
struct list_head list;
char *name;
- time_t mtime;
+ time64_t mtime;
};
-static void __init dir_add(const char *name, time_t mtime)
+static void __init dir_add(const char *name, time64_t mtime)
{
struct dir_entry *de = kmalloc(sizeof(struct dir_entry), GFP_KERNEL);
if (!de)
@@ -149,7 +149,7 @@ static void __init dir_utime(void)
}
}
-static __initdata time_t mtime;
+static __initdata time64_t mtime;
/* cpio header parsing */
@@ -176,7 +176,7 @@ static void __init parse_header(char *s)
uid = parsed[2];
gid = parsed[3];
nlink = parsed[4];
- mtime = parsed[5];
+ mtime = parsed[5]; /* breaks in y2106 */
body_len = parsed[6];
major = parsed[7];
minor = parsed[8];
--
2.9.0
reply other threads:[~2017-10-19 9:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20171019095536.801199-1-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=akpm@linux-foundation.org \
--cc=daniel.thompson@linaro.org \
--cc=deepa.kernel@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lokeshvutla@ti.com \
--cc=shorne@gmail.com \
--cc=viro@zeniv.linux.org.uk \
--cc=y2038@lists.linaro.org \
/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;
as well as URLs for NNTP newsgroup(s).