]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_db: obfuscate rt superblock label when metadumping
authorDarrick J. Wong <djwong@kernel.org>
Mon, 24 Feb 2025 18:21:41 +0000 (10:21 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 25 Feb 2025 17:15:56 +0000 (09:15 -0800)
Metadump can obfuscate the filesystem label on all the superblocks on
the data device, so it must perform the same transformation on the
realtime device superblock to avoid leaking information and so that the
mdrestored filesystem is consistent.

Found by running xfs/503 with realtime turned on and a patch to set
labels on common/populated filesystem images.

Cc: <linux-xfs@vger.kernel.org> # v6.13.0
Fixes: 6bc20c5edbab51 ("xfs_db: metadump realtime devices")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
db/metadump.c

index 4f4b4f8a39a551a914d39fae2c6623f5e3d6b431..4d090942bf29cd06eccfdddeb57de08cba67a942 100644 (file)
@@ -3073,6 +3073,17 @@ copy_rtsb(void)
                print_warning("cannot read realtime superblock");
                return !metadump.stop_on_read_error;
        }
+
+       /* Replace any filesystem label with "L's" */
+       if (metadump.obfuscate) {
+               struct xfs_rtsb *rtsb = iocur_top->data;
+
+               memset(rtsb->rsb_fname, 'L',
+                      min(strlen((char *)rtsb->rsb_fname),
+                               sizeof(rtsb->rsb_fname)));
+               iocur_top->need_crc = 1;
+       }
+
        error = write_buf(iocur_top);
        pop_cur();