Whamcloud - gitweb
debugfs: fix set_field's handling of timestamps
authorTheodore Ts'o <tytso@mit.edu>
Thu, 18 Apr 2024 14:04:27 +0000 (10:04 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 18 Apr 2024 14:23:56 +0000 (10:23 -0400)
commit9103e1e792170a836884db4ee9f2762bf1684f09
tree827b2fefc58b9a2a5c670d662ea77b4a8d23b36d
parent5182bd6826c6ec5aab2b3cb90816d6d480d8e574
debugfs: fix set_field's handling of timestamps

How timestamps are encoded in inodes and superblocks are different.
Unfortunately, commit ca8bc9240a00 which added post-2038 timestamps
was (a) overwriting adjacent superblock fields and/or attempting
unaligned writes to a 8-bit field from a 32-bit pointer, and (b) using
the incorrect encoding for timestamps stored in inodes.  Fix both of
these issues, which were found thanks to UBSAN.

Fixes: ca8bc9240a00 ("Add post-2038 timestamp support to e2fsprogs")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debugfs/set_fields.c