]> xenbits.xensource.com Git - xen.git/commit
libfsimage/xfs: Sanity-check the superblock during mounts
authorAlejandro Vallejo <alejandro.vallejo@cloud.com>
Thu, 14 Sep 2023 12:22:52 +0000 (13:22 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 11 Oct 2023 05:36:50 +0000 (06:36 +0100)
commit620500dd1baf33347dfde5e7fde7cf7fe347da5c
treef5e9b9f71a635bec8f5bbec1312a1a69dcf55f21
parentddc45e4eea946bb373a4b4a60c84bf9339cf413b
libfsimage/xfs: Sanity-check the superblock during mounts

Sanity-check the XFS superblock for wellformedness at the mount handler.
This forces pygrub to abort parsing a potentially malformed filesystem and
ensures the invariants assumed throughout the rest of the code hold.

Also, derive parameters from previously sanitized parameters where possible
(rather than reading them off the superblock)

The code doesn't try to avoid overflowing the end of the disk, because
that's an unlikely and benign error. Parameters used in calculations of
xfs_daddr_t (like the root inode index) aren't in critical need of being
sanitized.

The sanitization of agblklog is basically checking that no obvious
overflows happen on agblklog, and then ensuring agblocks is contained in
the range (2^(sb_agblklog-1), 2^sb_agblklog].

This is part of XSA-443 / CVE-2023-34325

Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
tools/libfsimage/xfs/fsys_xfs.c
tools/libfsimage/xfs/xfs.h