Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Known issues #1

Open
msuhanov opened this issue Oct 24, 2018 · 3 comments
Open

Known issues #1

msuhanov opened this issue Oct 24, 2018 · 3 comments

Comments

@msuhanov
Copy link

msuhanov commented Oct 24, 2018

  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.

@adulau
Copy link
Owner

adulau commented Oct 24, 2018

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.

@msuhanov
Copy link
Author

msuhanov commented Oct 24, 2018

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
Copy link
Author

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants