From patchwork Wed Jun 20 19:04:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10478519 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.web.codeaurora.org (Postfix) with ESMTP id 9D1A4601D7 for ; Wed, 20 Jun 2018 19:05:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E78F28DDE for ; Wed, 20 Jun 2018 19:05:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8211B28DE2; Wed, 20 Jun 2018 19:05:00 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 330FF28DDE for ; Wed, 20 Jun 2018 19:05:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C90A680F8E; Wed, 20 Jun 2018 19:04:58 +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 9B5F02007822; Wed, 20 Jun 2018 19:04:58 +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 F15494A46D; Wed, 20 Jun 2018 19:04:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5KJ4PQk023508 for ; Wed, 20 Jun 2018 15:04:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id D5C4B308BDAE; Wed, 20 Jun 2018 19:04:25 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CD3A6308BDB3 for ; Wed, 20 Jun 2018 19:04:24 +0000 (UTC) Received: from mail-pg0-f68.google.com (mail-pg0-f68.google.com [74.125.83.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0D4AB3084040 for ; Wed, 20 Jun 2018 19:04:24 +0000 (UTC) Received: by mail-pg0-f68.google.com with SMTP id w8-v6so237335pgp.7 for ; Wed, 20 Jun 2018 12:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9cjOrduzYxUf4NLglgPfdcTigzsYw7XM56GeSsakqpI=; b=dHhIYglvKKsYFDu03No+W7WBXzfXC/d4YLnSx88OsYc77A8/jtYxGvoGbAXZL6O2Qp /A1LIROvQg192VUtjmKn686ai41BEm8ApXgwjaUm8W5o3yUkdlnO0jshtOWQ650rkGYC V1P8SgaLUqy8mW/9E80nw3QKjE9tOcoEqfCsw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9cjOrduzYxUf4NLglgPfdcTigzsYw7XM56GeSsakqpI=; b=fBJwdmgfHN8vAYFIYOYahhdX1JiKJVAHsmwyWK/OolGbfofa9B8HpQvyBhoeHrFGh0 iVmsTfmqCGZA3jkFuyxAM15UvJ/gLYya7c2gPHcuDZaipIowPhNej2G5/KzTDyPXQJm/ o72CsXcbie6ZKDZClP0aqMxMS4QE8EF8J2ZEi6jfvFL8h5sVMI8ut0J257aoJh843gYF sfFxLRDAlMPcKgHrUDMJ8KyLh+eLlelw6VmU2GmisyW3S25Ovg7v+Y1sL3djuAgk0Z5C P+5K2Abpu1vvOIsBFJDJh46BjQClvt8pyu+fGeeBFklJufCXSJWpbar7B8ytr2hOALXg zgHA== X-Gm-Message-State: APt69E1PVwPTC8WfE+Q5IOqhaEoGKeg2MurZTdqeOHVIuSVu6ksCaUVl 8WUMgHjHUf9yg5mdGvOWxko7uQ== X-Google-Smtp-Source: ADUXVKKRuQ5oXcU+DaxxLqOpP93LMjXAVNdajI//y/wZExzXVYSRB34VQKyAfqACG8ufd1cEnMGziQ== X-Received: by 2002:a63:27c6:: with SMTP id n189-v6mr20013798pgn.164.1529521463574; Wed, 20 Jun 2018 12:04:23 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id s75-v6sm6123983pfj.125.2018.06.20.12.04.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Jun 2018 12:04:21 -0700 (PDT) From: Kees Cook To: Herbert Xu Date: Wed, 20 Jun 2018 12:04:03 -0700 Message-Id: <20180620190408.45104-7-keescook@chromium.org> In-Reply-To: <20180620190408.45104-1-keescook@chromium.org> References: <20180620190408.45104-1-keescook@chromium.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 20 Jun 2018 19:04:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 20 Jun 2018 19:04:24 +0000 (UTC) for IP:'74.125.83.68' DOMAIN:'mail-pg0-f68.google.com' HELO:'mail-pg0-f68.google.com' FROM:'keescook@chromium.org' RCPT:'' X-RedHat-Spam-Score: -0.131 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 74.125.83.68 mail-pg0-f68.google.com 74.125.83.68 mail-pg0-f68.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.40 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: dm-devel@redhat.com Cc: Giovanni Cabiddu , Kees Cook , Arnd Bergmann , Eric Biggers , Mike Snitzer , "Gustavo A. R. Silva" , qat-linux@intel.com, linux-kernel@vger.kernel.org, dm-devel@redhat.com, linux-crypto@vger.kernel.org, Lars Persson , Tim Chen , "David S. Miller" , Alasdair Kergon , Rabin Vincent Subject: [dm-devel] [PATCH 06/11] crypto: cbc: Remove VLA usage 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.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 20 Jun 2018 19:04:59 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP In the quest to remove all stack VLA usage from the kernel[1], this uses the upper bounds on blocksize. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@mail.gmail.com Signed-off-by: Kees Cook --- include/crypto/cbc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/crypto/cbc.h b/include/crypto/cbc.h index f5b8bfc22e6d..260096bcf99b 100644 --- a/include/crypto/cbc.h +++ b/include/crypto/cbc.h @@ -113,7 +113,7 @@ static inline int crypto_cbc_decrypt_inplace( unsigned int bsize = crypto_skcipher_blocksize(tfm); unsigned int nbytes = walk->nbytes; u8 *src = walk->src.virt.addr; - u8 last_iv[bsize]; + u8 last_iv[CRYPTO_ALG_MAX_BLOCKSIZE]; /* Start of the last block. */ src += nbytes - (nbytes & (bsize - 1)) - bsize;