From patchwork Thu Nov 1 08:53:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AliOS system security X-Patchwork-Id: 10665129 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5E7FA1751 for ; Fri, 2 Nov 2018 08:14:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E82F2BD62 for ; Fri, 2 Nov 2018 08:14:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D20C2BD7C; Fri, 2 Nov 2018 08:14:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 59D9F2BD62 for ; Fri, 2 Nov 2018 08:14:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 00646307FBDF; Fri, 2 Nov 2018 08:14:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A8BAB5D9CB; Fri, 2 Nov 2018 08:14:48 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E8A1B4BB79; Fri, 2 Nov 2018 08:14:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wA18sj8f026923 for ; Thu, 1 Nov 2018 04:54:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2319D2616D; Thu, 1 Nov 2018 08:54:45 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A29DE1C95D; Thu, 1 Nov 2018 08:54:35 +0000 (UTC) Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3401758E31; Thu, 1 Nov 2018 08:54:31 +0000 (UTC) X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R351e4; CH=green; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01f04428; MF=alios_sys_security@linux.alibaba.com; NM=1; PH=DS; RN=4; SR=0; TI=SMTPD_---0TC20H3i_1541062460; Received: from localhost(mailfrom:alios_sys_security@linux.alibaba.com fp:SMTPD_---0TC20H3i_1541062460) by smtp.aliyun-inc.com(127.0.0.1); Thu, 01 Nov 2018 16:54:28 +0800 From: AliOS system security To: Alasdair Kergon , Mike Snitzer Date: Thu, 1 Nov 2018 16:53:59 +0800 Message-Id: <1541062439-55558-1-git-send-email-alios_sys_security@linux.alibaba.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 01 Nov 2018 08:54:34 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 01 Nov 2018 08:54:34 +0000 (UTC) for IP:'115.124.30.132' DOMAIN:'out30-132.freemail.mail.aliyun.com' HELO:'out30-132.freemail.mail.aliyun.com' FROM:'alios_sys_security@linux.alibaba.com' RCPT:'' X-RedHat-Spam-Score: -8.01 (ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_NONE, SPF_PASS, UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL) 115.124.30.132 out30-132.freemail.mail.aliyun.com 115.124.30.132 out30-132.freemail.mail.aliyun.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Fri, 02 Nov 2018 03:47:12 -0400 Cc: dm-devel@redhat.com, AliOS system security Subject: [dm-devel] [PATCH] dm crypt: use unsigned long long instead of sector_t to store iv_offset X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 02 Nov 2018 08:14:49 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP The iv_offset in the mapping table of crypt target is a 64bit number when iv mode is plain64 or plain64be. It will be assigned to iv_offset of struct crypt_config, cc_sector of struct convert_context and iv_sector of struct dm_crypt_request. These structures members are defined as a sector_t. But sector_t is 32bit when CONFIG_LBDAF is not set in 32bit kernel. In this situation sector_t is not big enough to store the 64bit iv_offset. Signed-off-by: AliOS system security --- drivers/md/dm-crypt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index b8eec51..49be7a6 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -49,7 +49,7 @@ struct convert_context { struct bio *bio_out; struct bvec_iter iter_in; struct bvec_iter iter_out; - sector_t cc_sector; + unsigned long long cc_sector; atomic_t cc_pending; union { struct skcipher_request *req; @@ -81,7 +81,7 @@ struct dm_crypt_request { struct convert_context *ctx; struct scatterlist sg_in[4]; struct scatterlist sg_out[4]; - sector_t iv_sector; + unsigned long long iv_sector; }; struct crypt_config; @@ -160,7 +160,7 @@ struct crypt_config { struct iv_lmk_private lmk; struct iv_tcw_private tcw; } iv_gen_private; - sector_t iv_offset; + unsigned long long iv_offset; unsigned int iv_size; unsigned short int sector_size; unsigned char sector_shift;