lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <54936D1E.3020700@micron.com>
Date:	Thu, 18 Dec 2014 16:11:10 -0800
From:	Sam Bradshaw <sbradshaw@...ron.com>
To:	<axboe@...nel.dk>, <linux-kernel@...r.kernel.org>
CC:	<martin.k.petersen@...cle.com>
Subject: [PATCH] block: pass correct seed to integrity metadata generation
 function

The seed value passed to the blk integrity metadata generation function 
was wrong depending on the device block size (interval) and how many 
blocks comprised the bvec.  This patch converts the seed to 'interval' 
units and increments it correctly for each iteration.  Tested against a
4k+8 (w/ type1 PI) sector size.

Signed-off-by: Sam Bradshaw <sbradshaw@...ron.com>
Signed-off-by: Selvan Mani <smani@...ron.com>
---
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 5cbd5d9..7114040 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -219,20 +219,22 @@ static int bio_integrity_process(struct bio *bio,
 	struct bvec_iter bviter;
 	struct bio_vec bv;
 	struct bio_integrity_payload *bip = bio_integrity(bio);
-	unsigned int ret = 0;
+	unsigned int len = 0, ret = 0;
 	void *prot_buf = page_address(bip->bip_vec->bv_page) +
 		bip->bip_vec->bv_offset;
+	sector_t seed, start = bio_integrity_intervals(bi, bip_get_seed(bip));
 
 	iter.disk_name = bio->bi_bdev->bd_disk->disk_name;
 	iter.interval = bi->interval;
-	iter.seed = bip_get_seed(bip);
-	iter.prot_buf = prot_buf;
+	seed = start;
 
 	bio_for_each_segment(bv, bio, bviter) {
 		void *kaddr = kmap_atomic(bv.bv_page);
 
 		iter.data_buf = kaddr + bv.bv_offset;
 		iter.data_size = bv.bv_len;
+		iter.seed = seed;
+		iter.prot_buf = prot_buf;
 
 		ret = proc_fn(&iter);
 		if (ret) {
@@ -241,6 +243,9 @@ static int bio_integrity_process(struct bio *bio,
 		}
 
 		kunmap_atomic(kaddr);
+		len += bv.bv_len;
+		seed = start + (len / bi->interval);
+		prot_buf += bi->tuple_size;
 	}
 	return ret;
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ