All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs_metadump: obfuscate remote symlinks on CRC filesystems
@ 2015-06-19 20:30 Eric Sandeen
  2015-06-21  9:14 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Sandeen @ 2015-06-19 20:30 UTC (permalink / raw)
  To: xfs-oss

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.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/db/metadump.c b/db/metadump.c
index a599571..80a41cd 100644
--- a/db/metadump.c
+++ b/db/metadump.c
@@ -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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs_metadump: obfuscate remote symlinks on CRC filesystems
  2015-06-19 20:30 [PATCH] xfs_metadump: obfuscate remote symlinks on CRC filesystems Eric Sandeen
@ 2015-06-21  9:14 ` Christoph Hellwig
  2015-06-22  1:54   ` Eric Sandeen
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2015-06-21  9:14 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss

On Fri, Jun 19, 2015 at 03:30:32PM -0500, Eric Sandeen wrote:
> 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,

Reviewed-by: Christoph Hellwig <hch@lst.de>

Any chance to get a test for this into xfstests?

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs_metadump: obfuscate remote symlinks on CRC filesystems
  2015-06-21  9:14 ` Christoph Hellwig
@ 2015-06-22  1:54   ` Eric Sandeen
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2015-06-22  1:54 UTC (permalink / raw)
  To: Christoph Hellwig, Eric Sandeen; +Cc: xfs-oss

On 6/21/15 4:14 AM, Christoph Hellwig wrote:
> On Fri, Jun 19, 2015 at 03:30:32PM -0500, Eric Sandeen wrote:
>> 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,
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> 
> 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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-22  1:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-19 20:30 [PATCH] xfs_metadump: obfuscate remote symlinks on CRC filesystems Eric Sandeen
2015-06-21  9:14 ` Christoph Hellwig
2015-06-22  1:54   ` Eric Sandeen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.