corrupted files in dm-crypt partition

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

corrupted files in dm-crypt partition

Jump to solution
1,035 Views
greeran
Contributor III

hello

i have an encrypted partition with dm-crypt. on first boot all seems well but after i burn my applications, not always but accusingly, some of my files get corrupted. also after running for some time i also get some of my files corrupted.

before creating a dm-crypt partition, on a normal partition i never got corrupted files.

is there a reason why the encrypted partition is not stable

thanks for the help 

Tags (1)
0 Kudos
Reply
1 Solution
863 Views
greeran
Contributor III

Hi 

i was able to find the problem, i was directed to the solution by Nathan from Timesys. it seems there is a bug in the crypto dirver backlog scenario 

It looks like someone may have a relevant patch here:

thanks

View solution in original post

0 Kudos
Reply
6 Replies
1,014 Views
JosephAtNXP
NXP TechSupport
NXP TechSupport

Hi,

Thank you for your interest in NXP Semiconductor products,

Could you share how could I reproduce this issue?

Please confirm if you are following the steps from this guide, this may help out.

Also, what processor are you working with?

Regards

0 Kudos
Reply
996 Views
greeran
Contributor III

hi

i also tested the partition with the test in the manual and got errors. the first test is on a normal partition and second test is on an encrypted partition

dd if=/dev/random of=/tmp/random conv=fsync bs=1M count=32

32+0 records in

32+0 records out

33554432 bytes (34 MB, 32 MiB) copied, 0.335412 s, 100 MB/s

root@imx8mp-var-dart-aion-secure:~# echo 3 > /proc/sys/vm/drop_caches

[  853.846594] sh (582): drop_caches: 3

---- testing on a normal partition --

root@imx8mp-var-dart-aion-secure:~# time dd if=/tmp/random of=/home/root/testwrite conv=fsync

65536+0 records in

65536+0 records out

33554432 bytes (34 MB, 32 MiB) copied, 0.805649 s, 41.6 MB/s

real    0m0.818s

user    0m0.055s

sys     0m0.643s

root@imx8mp-var-dart-aion-secure:~# rm testwrite

--- testing in the encrypted partition ---

root@imx8mp-var-dart-aion-secure:~# time dd if=/tmp/random of=/data/testwrite conv=fsync

[  886.872817] caam_jr 30902000.jr: swiotlb buffer is full (sz: 512 bytes), total 32768 (slots), used 32767 (slots)

[  886.873141] caam_jr 30902000.jr: swiotlb buffer is full (sz: 512 bytes), total 32768 (slots), used 32768 (slots)

[  886.873144] sdhci-esdhc-imx 30b60000.mmc: swiotlb buffer is full (sz: 8192 bytes), total 32768 (slots), used 32766 (slots)

[  886.874542] sdhci-esdhc-imx 30b60000.mmc: swiotlb buffer is full (sz: 8192 bytes), total 32768 (slots), used 32766 (slots)

[  886.874608] ------------[ cut here ]------------

[  886.874611] WARNING: CPU: 0 PID: 210 at drivers/mmc/host/sdhci.c:1154 sdhci_send_command+0x7e8/0xe6c

[  886.874625] Modules linked in: iptable_filter ip_tables x_tables crct10dif_ce imx8_media_dev(C) imx_sdma secvio fsl_jr_uio snd_soc_wm8904 imx_rpmsg_tty galcore(O) fuse

[  886.874656] CPU: 0 PID: 210 Comm: kworker/0:1H Tainted: G        WC O      5.15.71+gd567aaeb594f #1

[  886.874662] Hardware name: DART-MX8M-PLUS Elsec Aion (DT)

[  886.874666] Workqueue: kblockd blk_mq_run_work_fn

[  886.874676] pstate: a00000c5 (NzCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)

[  886.874682] pc : sdhci_send_command+0x7e8/0xe6c

[  886.874686] lr : sdhci_send_command+0x648/0xe6c

[  886.874690] sp : ffff80000ae3b960

[  886.874692] x29: ffff80000ae3b960 x28: 0000000000000000 x27: 0000000000000002

[  886.874700] x26: 0000000000000000 x25: 0000000000000000 x24: ffff0000c0f38810

[  886.874708] x23: 000000000000000b x22: ffff0000c53db348 x21: ffff0000c53db3b8

[  886.874716] x20: ffff0000c53db348 x19: ffff0000c0f38580 x18: ffffffffffffffff

[  886.874724] x17: 0000000000000000 x16: 00000000302abb46 x15: ffff800009f61fc0

[  886.874731] x14: ffffffffffffffff x13: ffff800009f61fb1 x12: 7566207369207265

[  886.874739] x11: ffff800009dd2100 x10: 0000000000000020 x9 : 0000000000007ffe

[  886.874747] x8 : 0000000000000020 x7 : 000000000000003a x6 : 0000000000007940

[  886.874754] x5 : ffff0000fb1a5d88 x4 : 0000000000000000 x3 : 0000000000000000

[  886.874761] x2 : fffffffffffdfbfe x1 : fffffffffffffffe x0 : 00000000ffffffe4

[  886.874770] Call trace:

[  886.874772]  sdhci_send_command+0x7e8/0xe6c

[  886.874777]  sdhci_send_command_retry+0x40/0x130

[  886.874782]  sdhci_request+0x70/0xc4

[  886.874786]  __mmc_start_request+0x68/0x13c

[  886.874793]  mmc_start_request+0x84/0xb0

[  886.874799]  mmc_blk_mq_issue_rq+0x310/0xa70

[  886.874805]  mmc_mq_queue_rq+0x11c/0x2bc

[  886.874811]  blk_mq_dispatch_rq_list+0x124/0x83c

[  886.874817]  blk_mq_do_dispatch_sched+0x2a4/0x320

[  886.874822]  __blk_mq_sched_dispatch_requests+0x10c/0x15c

[  886.874827]  blk_mq_sched_dispatch_requests+0x38/0x74

[  886.874832]  __blk_mq_run_hw_queue+0x54/0x90

[  886.874837]  blk_mq_run_work_fn+0x20/0x30

[  886.874843]  process_one_work+0x1d0/0x354

[  886.874848]  worker_thread+0x13c/0x470

[  886.874852]  kthread+0x150/0x160

[  886.874857]  ret_from_fork+0x10/0x20

[  886.874864] ---[ end trace e71339d44b27c803 ]---

[  886.883023] caam_jr 30902000.jr: unable to map destination

[  886.891124] caam_jr 30902000.jr: swiotlb buffer is full (sz: 512 bytes), total 32768 (slots), used 32768 (slots)

[  886.891974] caam_jr 30902000.jr: swiotlb buffer is full (sz: 512 bytes), total 32768 (slots), used 32768 (slots)

[  886.891982] caam_jr 30902000.jr: unable to map source

[  886.892000] caam_jr 30902000.jr: swiotlb buffer is full (sz: 512 bytes), total 32768 (slots), used 32768 (slots)

[  886.892006] caam_jr 30902000.jr: unable to map source

[  886.892135] caam_jr 30902000.jr: swiotlb buffer is full (sz: 512 bytes), total 32768 (slots), used 32768 (slots)

[  886.892140] caam_jr 30902000.jr: unable to map source

[  886.892192] EXT4-fs warning (device dm-1): ext4_end_bio:344: I/O error 10 writing to inode 14 starting block 763715)

[  886.892325] caam_jr 30902000.jr: swiotlb buffer is full (sz: 512 bytes), total 32768 (slots), used 32768 (slots)

[  886.892331] caam_jr 30902000.jr: unable to map source

[  886.892513] caam_jr 30902000.jr: swiotlb buffer is full (sz: 512 bytes), total 32768 (slots), used 32768 (slots)

[  886.892518] caam_jr 30902000.jr: unable to map source

[  886.892701] caam_jr 30902000.jr: unable to map source

[  886.892828] caam_jr 30902000.jr: unable to map source

[  886.892864] EXT4-fs warning (device dm-1): ext4_end_bio:344: I/O error 10 writing to inode 14 starting block 764672)

[  886.892985] caam_jr 30902000.jr: unable to map source

[  886.893167] caam_jr 30902000.jr: unable to map source

[  886.893274] caam_jr 30902000.jr: unable to map source

[  886.893350] caam_jr 30902000.jr: unable to map source

[  886.893533] caam_jr 30902000.jr: unable to map source

[  886.893623] caam_jr 30902000.jr: unable to map source

[  886.893652] EXT4-fs warning (device dm-1): ext4_end_bio:344: I/O error 10 writing to inode 14 starting block 765819)

[  886.893705] caam_jr 30902000.jr: unable to map source

[  886.893737] EXT4-fs warning (device dm-1): ext4_end_bio:344: I/O error 10 writing to inode 14 starting block 765863)

[  886.893873] caam_jr 30902000.jr: unable to map source

[  886.894001] Buffer I/O error on device dm-1, logical block 765863

[  886.894025] Buffer I/O error on device dm-1, logical block 765864

[  886.894030] Buffer I/O error on device dm-1, logical block 765865

[  886.894035] Buffer I/O error on device dm-1, logical block 765866

[  886.894039] Buffer I/O error on device dm-1, logical block 765867

[  886.894044] Buffer I/O error on device dm-1, logical block 765868

[  886.894048] Buffer I/O error on device dm-1, logical block 765869

[  886.894052] Buffer I/O error on device dm-1, logical block 765870

[  886.894057] Buffer I/O error on device dm-1, logical block 765871

[  886.894061] Buffer I/O error on device dm-1, logical block 765872

[  886.897488] caam_jr 30902000.jr: unable to map source

[  886.897683] caam_jr 30902000.jr: unable to map source

[  886.897868] caam_jr 30902000.jr: unable to map source

[  886.898052] caam_jr 30902000.jr: unable to map source

[  886.898236] caam_jr 30902000.jr: unable to map source

[  886.898335] caam_jr 30902000.jr: unable to map source

[  886.898359] EXT4-fs warning (device dm-1): ext4_end_bio:344: I/O error 10 writing to inode 14 starting block 755200)

[  886.898481] caam_jr 30902000.jr: unable to map source

[  886.898634] caam_jr 30902000.jr: unable to map source

[  886.898685] EXT4-fs warning (device dm-1): ext4_end_bio:344: I/O error 10 writing to inode 14 starting block 755523)

[  886.920412] caam_jr 30902000.jr: unable to map destination

[  887.193383] EXT4-fs warning (device dm-1): ext4_end_bio:344: I/O error 10 writing to inode 14 starting block 763181)

[  887.455933] EXT4-fs warning (device dm-1): ext4_end_bio:344: I/O error 10 writing to inode 14 starting block 763711)

dd: fsync failed for '/data/testwrite': Input/output error

65536+0 records in

65536+0 records out

33554432 bytes (34 MB, 32 MiB) copied, 1.43458 s, 23.4 MB/s

real    0m1.442s

user    0m0.060s

sys     0m0.661s

0 Kudos
Reply
864 Views
greeran
Contributor III

Hi 

i was able to find the problem, i was directed to the solution by Nathan from Timesys. it seems there is a bug in the crypto dirver backlog scenario 

It looks like someone may have a relevant patch here:

thanks
0 Kudos
Reply
956 Views
JosephAtNXP
NXP TechSupport
NXP TechSupport

Hi,

Thanks for the inputs,

There shouldn't be reason to be unstable, let me try to replicate the issue.

Regards,

Joseph

0 Kudos
Reply
868 Views
greeran
Contributor III
hi Joseph
where you able to replicate the issue
thanks
Ran
0 Kudos
Reply
1,000 Views
greeran
Contributor III

hi

thanks for the quick response. i am creating the partition and mounting it in the initramfs. the creation and mount are the same commands as the manual. The create has --verifyudev parameter. When i run the "dmsetup table --showkey" on the partitions that are encrypted i get a similar result as the manual.

is there any reason why the dm-crypt should be unstable ?

thanks

 

0 Kudos
Reply