dcfldd icon indicating copy to clipboard operation
dcfldd copied to clipboard

Known issues

Open msuhanov opened this issue 7 years ago • 3 comments

  1. Data becomes misaligned when a faulty sector is encountered on a source drive. NIST report, upstream patch.

  2. An infinite loop when a faulty sector is encountered on a source drive (data is written to an output file until there is no space left). I observed this bug in dcfldd long ago (2014), I can't identify the buggy piece of code (it's hard to reproduce). Possibly related to the previous bug.

msuhanov avatar Oct 24 '18 21:10 msuhanov

Thank you for the feedback. I remember the old dd bug. I'll review the code and check what's diverged from the original dd code. For the DA-09 test, I need to find a disk or a way to inject faulty sector in a raw image.

adulau avatar Oct 24 '18 21:10 adulau

Here is a bash script to reproduce the first issue using device-mapper.

#!/bin/bash

src_file='src.raw'
dst_file_1='dst-dcfl.raw'
dst_file_2='dst-dd.raw'

dd if=/dev/urandom of="$src_file" bs=512 count=20480

loop1=$(losetup -f)
losetup "$loop1" "$src_file"

loop2=$(losetup -f)
losetup "$loop2" "$src_file"

table=$(echo -e "0 10232 linear $loop1 0\n10232 1 error\n10233 10240 linear $loop2 10240\n")
echo "$table" | dmsetup create dcfldd

bdev_size=$(blockdev --getsize64 /dev/mapper/dcfldd)
echo "Block device created, size:"
echo $bdev_size

dcfldd if=/dev/mapper/dcfldd of="$dst_file_1" conv=sync,noerror
dd if=/dev/mapper/dcfldd of="$dst_file_2" conv=sync,noerror

dmsetup remove dcfldd

losetup -d "$loop1"
losetup -d "$loop2"
rm -f "$src_file"

The output files are:

$ ls -l dst-d*
-rw-r--r-- 1 root root 10518528 окт 25 01:47 dst-dcfl.raw
-rw-r--r-- 1 root root 10482176 окт 25 01:47 dst-dd.raw

The misaligned data block is shown on the screenshot: Misaligned block

msuhanov avatar Oct 24 '18 22:10 msuhanov

The second issue (or something similar to the second issue) can be reproduced with this line: table=$(echo -e "0 10232 linear $loop1 0\n10232 1 error\n")

(A faulty sector is the last one.)

msuhanov avatar Oct 24 '18 23:10 msuhanov