[PATCH 2/2] xfs_db: obfuscate rt superblock label when metadumping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <djwong@xxxxxxxxxx>

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@xxxxxxxxxxxxxxx> # v6.13.0
Fixes: 6bc20c5edbab51 ("xfs_db: metadump realtime devices")
Signed-off-by: "Darrick J. Wong" <djwong@xxxxxxxxxx>
---
 db/metadump.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/db/metadump.c b/db/metadump.c
index 4f4b4f8a39a551..4d090942bf29cd 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();
 




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux