Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 561558 - >=sys-kernel/gentoo-sources-4.0.0 can lead to data corruption with dm-crypt on certain ssds
Summary: >=sys-kernel/gentoo-sources-4.0.0 can lead to data corruption with dm-crypt o...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal critical (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL: https://bugzilla.kernel.org/show_bug....
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-26 12:53 UTC by kipplasterjoe
Modified: 2015-10-01 23:03 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
dm crypt: constrain crypt device's max_segment_size to PAGE_SIZE (file_561558.txt,1.64 KB, patch)
2015-09-26 12:55 UTC, kipplasterjoe
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description kipplasterjoe 2015-09-26 12:53:30 UTC
Kernel 4.0 removed an artificial IO limit, this caused a regression when using dm-crypt containers on some SSDs with NCQ (Samsung SSD 850 for example).

DM crypt's new IO exceeds some SSD's max_segments limits. When this happens, the fs will be put in read only mode by the kernel and dmesg will be spammed over with ata errors. Data corruption is possible, I lost some data due to that problem.

Upstream provided a patch which can be applied against all kernels starting with 4.0. The patch fixes the issue and is already in kernel 4.3-rc3. See upstream bug for the patch: https://bugzilla.kernel.org/show_bug.cgi?id=104421

I claim to add that patch to the gentoo patchset for kernel series 4.0, 4.1 and 4.2. This is a serious issue as data corruption will be likely if affected.

I have been testing it on sys-kernel/vanilla-sources-4.1.* since 2015-09-11, I didn't encounter problems.

Reproducible: Always

Steps to Reproduce:
1.Use NCQ
2.Encrypt a Samsung SSD with dm crypt and create a filesystem in the container
3.mount the container and its filesystem
4.copy a big file to that filesystem and watch dmesg
5.after 20 to 30 seconds you will see write errors
Actual Results:  
IO errors force the target fs in ro mode, fs becomes corrupted, data loss possible

Expected Results:  
No IO errors should occure
Comment 1 kipplasterjoe 2015-09-26 12:55:13 UTC
Created attachment 412972 [details, diff]
dm crypt: constrain crypt device's max_segment_size to PAGE_SIZE
Comment 2 Mike Pagano gentoo-dev 2015-09-28 23:02:51 UTC
Thanks for reporting. I'll start adding this one into those kernel versions.
Comment 4 Mike Pagano gentoo-dev 2015-09-29 00:09:51 UTC
All queued up for next releases
Comment 5 Mike Pagano gentoo-dev 2015-10-01 23:03:00 UTC
In 4.1.9 and 4.2.2.  4.0.X is EOL