From: Darrick J. Wong Date: Mon, 24 Feb 2025 18:21:41 +0000 (-0800) Subject: xfs_db: obfuscate rt superblock label when metadumping X-Git-Tag: v6.14.0~162 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=83586af40e70b6770782f24ae06bddf98ac9f4c5;p=thirdparty%2Fxfsprogs-dev.git xfs_db: obfuscate rt superblock label when metadumping 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: # v6.13.0 Fixes: 6bc20c5edbab51 ("xfs_db: metadump realtime devices") Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- diff --git a/db/metadump.c b/db/metadump.c index 4f4b4f8a..4d090942 100644 --- a/db/metadump.c +++ b/db/metadump.c @@ -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();