docs: record the metadump file format
PATCH 1/1 docs: record the metadump file format
Document the metadump file format.
--- design/XFS_Filesystem_Structure/docinfo.xml | 14 +++++ design/XFS_Filesystem_Structure/magic.asciidoc | 1 design/XFS_Filesystem_Structure/metadump.asciidoc | 62 ++++++++++++++++++++ .../xfs_filesystem_structure.asciidoc | 9 +++ 4 files changed, 86 insertions(+) create mode 100644 design/XFS_Filesystem_Structure/metadump.asciidoc
design/XFS_Filesystem_Structure/docinfo.xml +14 -0
@@ -155,4 +155,18 @@ </simplelist> </revdescription> </revision> + <revision> + <revnumber>3.14159</revnumber> + <date>June 2017</date> + <author> + <firstname>Darrick</firstname> + <surname>Wong</surname> + <email>[email protected]</email> + </author> + <revdescription> + <simplelist> + <member>Add the metadump file format.</member> + </simplelist> + </revdescription> + </revision> </revhistory>
design/XFS_Filesystem_Structure/magic.asciidoc +1 -0
@@ -47,6 +47,7 @@ relevant chapters. Magic numbers tend to have consistent locations: | +XFS_RMAP_CRC_MAGIC+ | 0x524d4233 | RMB3 | xref:Reverse_Mapping_Btree[Reverse Mapping B+tree], v5 only | +XFS_RTRMAP_CRC_MAGIC+ | 0x4d415052 | MAPR | xref:Real_time_Reverse_Mapping_Btree[Real-Time Reverse Mapping B+tree], v5 only | +XFS_REFC_CRC_MAGIC+ | 0x52334643 | R3FC | xref:Reference_Count_Btree[Reference Count B+tree], v5 only +| +XFS_MD_MAGIC+ | 0x5846534d | XFSM | xref:Metadata_Dumps[Metadata Dumps] |===== The magic numbers for log items are at offset zero in each log item, but items
design/XFS_Filesystem_Structure/metadump.asciidoc new file +62 -0
62 lines not on this page · raw message
design/XFS_Filesystem_Structure/xfs_filesystem_structure.asciidoc +9 -0
@@ -96,3 +96,12 @@ include::extended_attributes.asciidoc[] include::symbolic_links.asciidoc[] :leveloffset: 0 + +Auxiliary Data Structures +========================= + +:leveloffset: 1 + +include::metadump.asciidoc[] + +:leveloffset: 0
[cc xfs]
Quoted 8 lines · Luis R. Rodriguez
Quoted 1 line · Darrick J. Wong
Document the metadump file format.
Thanks for all this! I have started wondering all this and was curious if there are perhaps more docs about the format or more practical docs which can help one go read the dumps and help analyze through examples.
Quoted 15 lines
design/XFS_Filesystem_Structure/metadump.asciidoc line 58
Quoted 13 lines
design/XFS_Filesystem_Structure/metadump.asciidoc new file +11
-0+== Dump Obfuscation + +Unless explicitly disabled, the +xfs_metadump+ tool obfuscates empty block +space and naming information to avoid leaking sensitive information into +the metadump file. +xfs_metadump+ does not copy user data blocks. + +The obfuscation policy is as follows: + +* File and extended attribute names are both considered "names". +* Names longer than 8 characters are totally rewritten with a name that matches the hash of the old name. +* Names between 5 and 8 characters are partially rewritten to match the hash of the old name.Any reason for this?
/me doesn't know. Maybe it's too hard to generate a new name with the same hash?
Quoted 8 lines
Quoted 1 line
+* Names shorter than 5 characters are not obscured at all.
This does not seem like a good idea, do we have a record of why this was done historically?
Quoted 1 line
+* Names that cross a block boundary are not obscured at all.
Likewise.
iirc we basically copy things a block at a time, which makes it harder to deal with multi-fsblock dirblocks (???)
I don't really know, let's see if the list remembers. :)
--D
Quoted 2 lines
Luis
Quoted 15 lines · Darrick J. Wong
Quoted 6 lines
Quoted 6 lines
+++ b/design/XFS_Filesystem_Structure/metadump.asciidoc +== Dump Obfuscation
design/XFS_Filesystem_Structure/metadump.asciidoc new file +4
-0+ +Unless explicitly disabled, the +xfs_metadump+ tool obfuscates empty block +space and naming information to avoid leaking sensitive information into +the metadump file. +xfs_metadump+ does not copy user data blocks.Quoted 8 lines
design/XFS_Filesystem_Structure/metadump.asciidoc line 58
Quoted 6 lines
design/XFS_Filesystem_Structure/metadump.asciidoc new file +6
-0+ +The obfuscation policy is as follows: + +* File and extended attribute names are both considered "names". +* Names longer than 8 characters are totally rewritten with a name that matches the hash of the old name. +* Names between 5 and 8 characters are partially rewritten to match the hash of the old name.Any reason for this?
Quoted 2 lines
/me doesn't know. Maybe it's too hard to generate a new name with the same hash?
I just thought of a good reason: shorter names means less information to be able to create a unique hash and avoid clashes.
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
+* Names shorter than 5 characters are not obscured at all.
This does not seem like a good idea, do we have a record of why this was done historically?
And likewise for smaller number of characters there could be clashes. In fact the latest md5 clash was for 64 bytes.
But since we *really* don't want to create a reverse map at all why not just use random characters? Sure we'd eat up entropy fast on a system but it would seem to be a fair requirement to ask for good entropy for this.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
+* Names that cross a block boundary are not obscured at all.
Likewise.
iirc we basically copy things a block at a time, which makes it harder to deal with multi-fsblock dirblocks (???)
I don't really know, let's see if the list remembers. :)
Luis
Quoted 27 lines · Darrick J. Wong
[cc xfs]
Quoted 8 lines · Luis R. Rodriguez
Quoted 1 line · Darrick J. Wong
Document the metadump file format.
Thanks for all this! I have started wondering all this and was curious if there are perhaps more docs about the format or more practical docs which can help one go read the dumps and help analyze through examples.
Quoted 15 lines
design/XFS_Filesystem_Structure/metadump.asciidoc line 58
Quoted 13 lines
design/XFS_Filesystem_Structure/metadump.asciidoc new file +11
-0+== Dump Obfuscation + +Unless explicitly disabled, the +xfs_metadump+ tool obfuscates empty block +space and naming information to avoid leaking sensitive information into +the metadump file. +xfs_metadump+ does not copy user data blocks. + +The obfuscation policy is as follows: + +* File and extended attribute names are both considered "names". +* Names longer than 8 characters are totally rewritten with a name that matches the hash of the old name. +* Names between 5 and 8 characters are partially rewritten to match the hash of the old name.Any reason for this?
Quoted 7 lines
/me doesn't know. Maybe it's too hard to generate a new name with the same hash?
Quoted 4 lines
Quoted 1 line
+* Names shorter than 5 characters are not obscured at all.
This does not seem like a good idea, do we have a record of why this was done historically?
It was done because of mathematics. This is all "IIRC" off the top of my head....
The hash we calculate is 4 bytes long, so we can't calculate a hash collision from less than 5 bytes of input. i.e. 4 bytes + 1 byte to cause collision is the shortest we can obfuscate, but one byte of "name overwrite" isn't enough to find collisions if all 4 of the first 4 bytes are randomly chosen.
Hence for names 5-8 bytes in length we are limited to 1 byte of correction for each of the first 4 bytes that is randomised. Hence it's not until filenames are longer than 8 bytes that we can generate a truly random filename that causes a hash collision.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
+* Names that cross a block boundary are not obscured at all.
Likewise.
iirc we basically copy things a block at a time, which makes it harder to deal with multi-fsblock dirblocks (???)
Discontiguous multi-block directories should be handled transparently for xfs_db via libxfs buffers now. Maybe metadump doesn't use these for dumping directory blocks? Also, We shouldn't be splitting names and values across da block boundaries - we leave free space in the block and allocate a new one if it doesn't fit....
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]