remarkable-linux/drivers/md
Mikulas Patocka b1bf2de072 dm verity: fix inability to use a few specific devices sizes
Fix a boundary condition that caused failure for certain device sizes.

The problem is reported at
  http://code.google.com/p/cryptsetup/issues/detail?id=160

For certain device sizes the number of hashes at a specific level was
calculated incorrectly.

It happens for example for a device with data and metadata block size 4096
that has 16385 blocks and algorithm sha256.

The user can test if he is affected by this bug by running the
"veritysetup verify" command and also by activating the dm-verity kernel
driver and reading the whole block device. If it passes without an error,
then the user is not affected.

The condition for the bug is:

Split the total number of data blocks (data_block_bits) into bit strings,
each string has hash_per_block_bits bits. hash_per_block_bits is
rounddown(log2(metadata_block_size/hash_digest_size)). Equivalently, you
can say that you convert data_blocks_bits to 2^hash_per_block_bits base.

If there some zero bit string below the most significant bit string and at
least one bit below this zero bit string is set, then the bug happens.

The same bug exists in the userspace veritysetup tool, so you must use
fixed veritysetup too if you want to use devices that are affected by
this boundary condition.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org # 3.4+
Cc: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
2013-07-10 23:41:16 +01:00
..
bcache bcache: Fix error handling in init code 2013-05-15 00:48:14 -07:00
persistent-data dm persistent metadata: add space map threshold callback 2013-05-10 14:37:20 +01:00
bitmap.c md: use set_bit_le and clear_bit_le 2013-04-24 11:42:41 +10:00
bitmap.h
dm-bio-prison.c dm: add cache target 2013-03-01 22:45:51 +00:00
dm-bio-prison.h dm: add cache target 2013-03-01 22:45:51 +00:00
dm-bio-record.h
dm-bufio.c dm bufio: avoid a possible __vmalloc deadlock 2013-05-10 14:37:15 +01:00
dm-bufio.h
dm-cache-block-types.h dm: add cache target 2013-03-01 22:45:51 +00:00
dm-cache-metadata.c dm cache: replace memcpy with struct assignment 2013-05-10 14:37:18 +01:00
dm-cache-metadata.h dm cache: policy ignore hints if generated by different version 2013-03-20 17:21:28 +00:00
dm-cache-policy-cleaner.c dm cache: policy change version from string to integer set 2013-03-20 17:21:27 +00:00
dm-cache-policy-internal.h dm cache: policy change version from string to integer set 2013-03-20 17:21:27 +00:00
dm-cache-policy-mq.c dm cache: policy change version from string to integer set 2013-03-20 17:21:27 +00:00
dm-cache-policy.c dm cache: policy change version from string to integer set 2013-03-20 17:21:27 +00:00
dm-cache-policy.h dm cache policy: fix description of lookup fn 2013-05-10 14:37:17 +01:00
dm-cache-target.c dm cache: set config value 2013-05-10 14:37:21 +01:00
dm-crypt.c block: Convert some code to bio_for_each_segment_all() 2013-03-23 14:26:30 -07:00
dm-delay.c dm: rename request variables to bios 2013-03-01 22:45:47 +00:00
dm-exception-store.c
dm-exception-store.h
dm-flakey.c dm: rename request variables to bios 2013-03-01 22:45:47 +00:00
dm-io.c
dm-ioctl.c dm ioctl: set noio flag to avoid __vmalloc deadlock 2013-07-10 23:41:15 +01:00
dm-kcopyd.c dm kcopyd: introduce configurable throttling 2013-03-01 22:45:49 +00:00
dm-linear.c dm: rename request variables to bios 2013-03-01 22:45:47 +00:00
dm-log-userspace-base.c
dm-log-userspace-transfer.c
dm-log-userspace-transfer.h
dm-log.c
dm-mpath.c dm mpath: fix ioctl deadlock when no paths 2013-07-10 23:41:15 +01:00
dm-mpath.h
dm-path-selector.c
dm-path-selector.h
dm-queue-length.c
dm-raid.c DM RAID: Add message/status support for changing sync action 2013-04-24 11:42:43 +10:00
dm-raid1.c block: Use bio_sectors() more consistently 2013-03-23 14:15:30 -07:00
dm-region-hash.c
dm-round-robin.c
dm-service-time.c
dm-snap-persistent.c
dm-snap-transient.c
dm-snap.c dm snapshot: fix error return code in snapshot_ctr 2013-05-10 14:37:15 +01:00
dm-stripe.c dm stripe: fix regression in stripe_width calculation 2013-05-10 14:37:14 +01:00
dm-sysfs.c
dm-table.c dm table: fix write same support 2013-05-10 14:37:16 +01:00
dm-target.c dm: rename request variables to bios 2013-03-01 22:45:47 +00:00
dm-thin-metadata.c dm thin: generate event when metadata threshold passed 2013-05-10 14:37:21 +01:00
dm-thin-metadata.h dm thin: generate event when metadata threshold passed 2013-05-10 14:37:21 +01:00
dm-thin.c dm thin: fix metadata dev resize detection 2013-05-19 18:57:50 +01:00
dm-uevent.c
dm-uevent.h
dm-verity.c dm verity: fix inability to use a few specific devices sizes 2013-07-10 23:41:16 +01:00
dm-zero.c dm: rename request variables to bios 2013-03-01 22:45:47 +00:00
dm.c dm mpath: fix ioctl deadlock when no paths 2013-07-10 23:41:15 +01:00
dm.h
faulty.c block: Add bio_end_sector() 2013-03-23 14:15:29 -07:00
Kconfig bcache: A block layer cache 2013-03-23 16:11:31 -07:00
linear.c block: Add bio_end_sector() 2013-03-23 14:15:29 -07:00
linear.h
Makefile bcache: A block layer cache 2013-03-23 16:11:31 -07:00
md.c A few bugfixes for md 2013-06-13 10:13:29 -07:00
md.h MD: Export 'md_reap_sync_thread' function 2013-04-24 11:42:43 +10:00
multipath.c
multipath.h
raid0.c block: Change bio_split() to respect the current value of bi_idx 2013-03-23 14:15:30 -07:00
raid0.h
raid1.c A few bugfixes for md 2013-06-13 10:13:29 -07:00
raid1.h
raid5.c A few bugfixes for md 2013-06-13 10:13:29 -07:00
raid5.h md: remove CONFIG_MULTICORE_RAID456 entirely 2013-03-20 13:21:14 +11:00
raid10.c A few bugfixes for md 2013-06-13 10:13:29 -07:00
raid10.h MD RAID10: Improve redundancy for 'far' and 'offset' algorithms (part 1) 2013-02-26 11:55:30 +11:00