From patchwork Sat Nov 3 03:53:28 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: 10667673 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 822A514E2 for ; Mon, 5 Nov 2018 09:46:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CF4729461 for ; Mon, 5 Nov 2018 09:46:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60C8C294BE; Mon, 5 Nov 2018 09:46:06 +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 A7D9529461 for ; Mon, 5 Nov 2018 09:46:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 45DCF2D7F4; Mon, 5 Nov 2018 09:46:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C9E5B5C1B5; Mon, 5 Nov 2018 09:46:02 +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 1DDF3180B5B7; Mon, 5 Nov 2018 09:46:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wA33s4DH018024 for ; Fri, 2 Nov 2018 23:54:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3D2115D75D; Sat, 3 Nov 2018 03:54:04 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 35A795D6A9 for ; Sat, 3 Nov 2018 03:54:02 +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 1F814C04B2EA for ; Sat, 3 Nov 2018 03:53:59 +0000 (UTC) X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R131e4; CH=green; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01f04389; MF=alios_sys_security@linux.alibaba.com; NM=1; PH=DS; RN=3; SR=0; TI=SMTPD_---0TCB5fYU_1541217210; Received: from localhost(mailfrom:alios_sys_security@linux.alibaba.com fp:SMTPD_---0TCB5fYU_1541217210) by smtp.aliyun-inc.com(127.0.0.1); Sat, 03 Nov 2018 11:53:43 +0800 From: AliOS system security To: Milan Broz Date: Sat, 3 Nov 2018 11:53:28 +0800 Message-Id: <1541217208-60218-1-git-send-email-alios_sys_security@linux.alibaba.com> In-Reply-To: <20a82f81-071e-e742-fc18-2088853efb0f@gmail.com> References: <20a82f81-071e-e742-fc18-2088853efb0f@gmail.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.32]); Sat, 03 Nov 2018 03:54:00 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sat, 03 Nov 2018 03:54:00 +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.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Mon, 05 Nov 2018 04:40:58 -0500 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 05 Nov 2018 09:46:04 +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;