Skip to contentSkip to conversation

xfs_metadump: obfuscate remote symlinks on CRC filesystems

PATCH In review Eric Sandeen 3 participants 3 messages Jun 19, 2015 – Jun 22, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs_metadump: obfuscate remote symlinks on CRC filesystems

On CRC filesystems, the symlink block starts with a header, which contains magic, "XLSM"

The code happens to "work" today w/o corrupting anything, because it seems "XSLM" as a string, decides it's too short to obfuscate, and leaves it alone.

But the real symlink target is untouched. Fix that by moving the pointer to the string we want to obfuscate by the size of the header, and shorten the length to obfuscate accordingly.

---

db/metadump.c +6 -2
index a599571..80a41cd 100644
@@ -1239,8 +1239,12 @@ static void
 obfuscate_symlink_block(
 	char			*block)
 {
-	/* XXX: need to handle CRC headers */
-	obfuscate_path_components(block, mp->m_sb.sb_blocksize);
+	if (xfs_sb_version_hascrc(&(mp)->m_sb))
+		block += sizeof(struct xfs_dsymlink_hdr);
+
+	obfuscate_path_components(block,
+				  XFS_SYMLINK_BUF_SPACE(mp,
+					mp->m_sb.sb_blocksize));
 }
 
 #define MAX_REMOTE_VALS		4095

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Eric Sandeen

On CRC filesystems, the symlink block starts with a header, which contains magic, "XLSM"

The code happens to "work" today w/o corrupting anything, because it seems "XSLM" as a string, decides it's too short to obfuscate, and leaves it alone.

But the real symlink target is untouched. Fix that by moving the pointer to the string we want to obfuscate by the size of the header, and shorten the length to obfuscate accordingly.

Looks good,

Any chance to get a test for this into xfstests?

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#2 lore raw
Quoted 12 lines · Christoph Hellwig
Quoted 10 lines · Eric Sandeen

On CRC filesystems, the symlink block starts with a header, which contains magic, "XLSM"

The code happens to "work" today w/o corrupting anything, because it seems "XSLM" as a string, decides it's too short to obfuscate, and leaves it alone.

But the real symlink target is untouched. Fix that by moving the pointer to the string we want to obfuscate by the size of the header, and shorten the length to obfuscate accordingly.

Quoted 5 lines

Looks good,

Any chance to get a test for this into xfstests?

I have a larger metadump testcase brewing, it'd cover this too.

Thanks,
-Eric

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs