mirror of
https://github.com/kdave/btrfs-progs
synced 2025-04-04 23:29:20 +00:00
Btrfs-progs: sanitize xattrs when we specify sanitization
Alexandre pointed out that his xattrs have sensitive information in them as well, so fix btrfs-image to zero out the data part of xattrs that we find. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Reviewed-by: Filipe Manana <fdmanana@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
parent
02e778b278
commit
9db49418b3
@ -162,6 +162,7 @@ static int has_name(struct btrfs_key *key)
|
|||||||
case BTRFS_DIR_INDEX_KEY:
|
case BTRFS_DIR_INDEX_KEY:
|
||||||
case BTRFS_INODE_REF_KEY:
|
case BTRFS_INODE_REF_KEY:
|
||||||
case BTRFS_INODE_EXTREF_KEY:
|
case BTRFS_INODE_EXTREF_KEY:
|
||||||
|
case BTRFS_XATTR_ITEM_KEY:
|
||||||
return 1;
|
return 1;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -446,6 +447,21 @@ static void sanitize_inode_ref(struct metadump_struct *md,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sanitize_xattr(struct metadump_struct *md,
|
||||||
|
struct extent_buffer *eb, int slot)
|
||||||
|
{
|
||||||
|
struct btrfs_dir_item *dir_item;
|
||||||
|
unsigned long data_ptr;
|
||||||
|
u32 data_len;
|
||||||
|
|
||||||
|
dir_item = btrfs_item_ptr(eb, slot, struct btrfs_dir_item);
|
||||||
|
data_len = btrfs_dir_data_len(eb, dir_item);
|
||||||
|
|
||||||
|
data_ptr = (unsigned long)((char *)(dir_item + 1) +
|
||||||
|
btrfs_dir_name_len(eb, dir_item));
|
||||||
|
memset_extent_buffer(eb, 0, data_ptr, data_len);
|
||||||
|
}
|
||||||
|
|
||||||
static void sanitize_name(struct metadump_struct *md, u8 *dst,
|
static void sanitize_name(struct metadump_struct *md, u8 *dst,
|
||||||
struct extent_buffer *src, struct btrfs_key *key,
|
struct extent_buffer *src, struct btrfs_key *key,
|
||||||
int slot)
|
int slot)
|
||||||
@ -471,6 +487,9 @@ static void sanitize_name(struct metadump_struct *md, u8 *dst,
|
|||||||
case BTRFS_INODE_EXTREF_KEY:
|
case BTRFS_INODE_EXTREF_KEY:
|
||||||
sanitize_inode_ref(md, eb, slot, 1);
|
sanitize_inode_ref(md, eb, slot, 1);
|
||||||
break;
|
break;
|
||||||
|
case BTRFS_XATTR_ITEM_KEY:
|
||||||
|
sanitize_xattr(md, eb, slot);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user