Re: [Ext4 Secure Delete 5/7v4] ext4: Secure Delete: Secure delete directory entry

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 07, 2011 at 12:11:03AM -0700, Allison Henderson wrote:
> This patch zeros or randomizes a files directory entry when a file
<snip>
> @@ -1669,7 +1672,38 @@ static int ext4_delete_entry(handle_t *handle,
>  				de->inode = 0;
>  			dir->i_version++;
>  			BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
> -			err = ext4_handle_dirty_metadata(handle, dir, bh);
> +
> +			/*
> +			 * If the secure remove flag is on, zero
> +			 * or randomize the entry and write it out
> +			 * to the disk
> +			 */
> +			if (flags & EXT4_DEL_ENTRY_ZERO) {
> +				memset(de->name, 0x00, de->name_len);
> +				de->file_type = 0;
> +			} else if (flags & EXT4_DEL_ENTRY_RAND) {
> +				get_random_bytes(de->name, de->name_len);
> +				get_random_bytes(&(de->file_type),
> +					sizeof(de->file_type));

Seeing as name_len and file_type precede name, you could probably reduce this
to one call that zaps all three.  Same for the zero-out case.

Also you might want to make both of these name-erasing calls zap the space
between the end of the name and the end of the record, just in case there's old
filename component still lurking in that space.  (Yes, paranoia...)

> +			}
> +
> +			if (flags & EXT4_DEL_ENTRY_ZERO ||
> +				flags & EXT4_DEL_ENTRY_RAND) {
> +
> +				set_buffer_dirty(bh);
> +				sync_dirty_buffer(bh);
> +				if (buffer_req(bh) && !buffer_uptodate(bh)) {
> +					es->s_last_error_block =
> +						cpu_to_le64(bh->b_blocknr);
> +					ext4_error_inode(dir, __func__,
> +					   __LINE__, bh->b_blocknr,
> +					   "IO error syncing itable block");

itable?

--D
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux