public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] metadump: 2 more patches
@ 2015-07-06 18:15 Eric Sandeen
  2015-07-06 18:16 ` [PATCH 1/2] metadump: Fill attribute values with 'v' rather than NUL Eric Sandeen
  2015-07-06 18:17 ` [PATCH 2/2] metadump: handle multi-block directories Eric Sandeen
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Sandeen @ 2015-07-06 18:15 UTC (permalink / raw)
  To: xfs-oss

metadump: Fill attribute values with 'v' rather than NUL
metadump: handle multi-block directories

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

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

* [PATCH 1/2] metadump: Fill attribute values with 'v' rather than NUL
  2015-07-06 18:15 [PATCH 0/2] metadump: 2 more patches Eric Sandeen
@ 2015-07-06 18:16 ` Eric Sandeen
  2015-07-26 16:16   ` Christoph Hellwig
  2015-07-06 18:17 ` [PATCH 2/2] metadump: handle multi-block directories Eric Sandeen
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Sandeen @ 2015-07-06 18:16 UTC (permalink / raw)
  To: xfs-oss

Rather than memset attribute values to '\0', use the character 'v' -
otherwise in some cases we get attributes with a non-zero value
length which start with a NUL, and that makes some userspace tools
unhappy, yielding results like this:

security.oO^Lio.=0sAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=

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

diff --git a/db/metadump.c b/db/metadump.c
index 2286b71..a30f90e 100644
--- a/db/metadump.c
+++ b/db/metadump.c
@@ -1083,8 +1083,8 @@ obfuscate_sf_attr(
 	xfs_dinode_t		*dip)
 {
 	/*
-	 * with extended attributes, obfuscate the names and zero the actual
-	 * values.
+	 * with extended attributes, obfuscate the names and fill the actual
+	 * values with 'v' (to see a valid string length, as opposed to NULLs)
 	 */
 
 	xfs_attr_shortform_t	*asfp;
@@ -1124,7 +1124,7 @@ obfuscate_sf_attr(
 		}
 
 		generate_obfuscated_name(0, asfep->namelen, &asfep->nameval[0]);
-		memset(&asfep->nameval[asfep->namelen], 0, asfep->valuelen);
+		memset(&asfep->nameval[asfep->namelen], 'v', asfep->valuelen);
 
 		asfep = (xfs_attr_sf_entry_t *)((char *)asfep +
 				XFS_ATTR_SF_ENTSIZE(asfep));
@@ -1302,7 +1302,7 @@ obfuscate_attr_block(
 				/* magic to handle attr and attr3 */
 				memset(block +
 					(bs - XFS_ATTR3_RMT_BUF_SPACE(mp, bs)),
-				      0, XFS_ATTR3_RMT_BUF_SPACE(mp, bs));
+				      'v', XFS_ATTR3_RMT_BUF_SPACE(mp, bs));
 		}
 		return;
 	}
@@ -1339,7 +1339,7 @@ obfuscate_attr_block(
 			}
 			generate_obfuscated_name(0, local->namelen,
 				&local->nameval[0]);
-			memset(&local->nameval[local->namelen], 0,
+			memset(&local->nameval[local->namelen], 'v',
 				be16_to_cpu(local->valuelen));
 		} else {
 			remote = xfs_attr3_leaf_name_remote(leaf, i);


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

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

* [PATCH 2/2] metadump: handle multi-block directories
  2015-07-06 18:15 [PATCH 0/2] metadump: 2 more patches Eric Sandeen
  2015-07-06 18:16 ` [PATCH 1/2] metadump: Fill attribute values with 'v' rather than NUL Eric Sandeen
@ 2015-07-06 18:17 ` Eric Sandeen
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Sandeen @ 2015-07-06 18:17 UTC (permalink / raw)
  To: xfs-oss

commit 6e79202b metadump: fully support discontiguous directory blocks

assembled a buffer from multiple dir blocks, and we can use that in
obfuscate_dir_data_block() to continue past the first filesystem block
and continue obfuscating the entire thing.

Without this, anything after the first block was skipped, and
remained as cleartext.

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

diff --git a/db/metadump.c b/db/metadump.c
index 5baec6c..33f3ec9 100644
--- a/db/metadump.c
+++ b/db/metadump.c
@@ -1152,9 +1152,6 @@ obfuscate_dir_data_block(
 
 	datahdr = (struct xfs_dir2_data_hdr *)block;
 
-	if (offset % mp->m_dir_geo->fsbcount != 0)
-		return;	/* corrupted, leave it alone */
-
 	if (is_block_format) {
 		xfs_dir2_leaf_entry_t	*blp;
 		xfs_dir2_block_tail_t	*btp;
@@ -1187,7 +1184,7 @@ obfuscate_dir_data_block(
 
 	dir_offset = M_DIROPS(mp)->data_entry_offset;
 	ptr = block + dir_offset;
-	endptr = block + mp->m_sb.sb_blocksize;
+	endptr = block + mp->m_dir_geo->blksize;
 
 	while (ptr < endptr && dir_offset < end_of_data) {
 		xfs_dir2_data_entry_t	*dep;

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

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

* Re: [PATCH 1/2] metadump: Fill attribute values with 'v' rather than NUL
  2015-07-06 18:16 ` [PATCH 1/2] metadump: Fill attribute values with 'v' rather than NUL Eric Sandeen
@ 2015-07-26 16:16   ` Christoph Hellwig
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2015-07-26 16:16 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss

Looks good,

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

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

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

end of thread, other threads:[~2015-07-26 16:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-06 18:15 [PATCH 0/2] metadump: 2 more patches Eric Sandeen
2015-07-06 18:16 ` [PATCH 1/2] metadump: Fill attribute values with 'v' rather than NUL Eric Sandeen
2015-07-26 16:16   ` Christoph Hellwig
2015-07-06 18:17 ` [PATCH 2/2] metadump: handle multi-block directories Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox