From 83586af40e70b6770782f24ae06bddf98ac9f4c5 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Mon, 24 Feb 2025 10:21:41 -0800 Subject: [PATCH] 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 --- db/metadump.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/db/metadump.c b/db/metadump.c index 4f4b4f8a3..4d090942b 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(); -- 2.39.5