Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp4895557imm; Tue, 26 Jun 2018 02:21:23 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIJIEPFu1qXhqA6FWkaEpqoMUR/xhUkYJGsvkzJKmO7kPhOEN7AdJTznG2Mbx+xp9q5Cxho X-Received: by 2002:a65:6290:: with SMTP id f16-v6mr649892pgv.155.1530004883577; Tue, 26 Jun 2018 02:21:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530004883; cv=none; d=google.com; s=arc-20160816; b=qjAdlfaQxzh/QmimDJUeDcvdpvHrAHH/gV24Oth4Fxw9R/gtL+w4LDpoBzXRuA4YSd dHkxPEW+XsqPKVEJZpzNwEmAKJ+3+QZv+Lioc5ai6Ogprr6in0D6Twck9ZzZVC76SSwa UXog/61wXXthuyypWamt+wtf+mgI3G2WGoH4NGCdgiH56EG/m86oh04UIDXNLNgupWGp U2jkv3sKLYEABJzxxIz+e175pxxddJqFn2NSDSAwWP2d26HouzEHic5y/swakMOGOV2O mczfkq/XhcJk08T4r1wBNNTrhyz8SZY8qZPRGkBKcbfx/y3cF83U4Sv5ByRn9Cmp3IDr 76RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=CtFCA2k8XFrN+gBYCa6MMFHvULUXjqZ70wnrczu4i5A=; b=wkdWuhQnynnVFAmG9xI7jL0yWduFaogtL/VXpighkExAwKuLhYrfJlx8jnHxDwAR5X RrpoIfjQ4ya/ziNTwdvsj4pCBa3ovvYmRLjq5gckZOF7ZalkrKj2pcM8TvVQTF9+wSPb pQaRfuAFF+avK7f830BZrfZiL4j2Qzq8Ebv9hwLWoWnpsYMrlObQojGEOk71Vz37jtvb RqZxETdRPwu3gyNR7pEY+HCUcwZPzJUvZw7JRn/9x2o37nFkJygQsBh16y7m0+8C9Vq2 l3gmiZfcuaG9/V7JCvW1IpFxhN5oj+HmarMAIiroftGV6xliM83OTxm5E38eQ364aamt nkmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m11-v6si447748pgq.601.2018.06.26.02.21.08; Tue, 26 Jun 2018 02:21:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752913AbeFZJU1 (ORCPT + 99 others); Tue, 26 Jun 2018 05:20:27 -0400 Received: from orcrist.hmeau.com ([104.223.48.154]:47630 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752606AbeFZJUZ (ORCPT ); Tue, 26 Jun 2018 05:20:25 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtps (Exim 4.89 #2 (Debian)) id 1fXk8x-0004oY-Td; Tue, 26 Jun 2018 17:20:12 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1fXk8l-00020g-0u; Tue, 26 Jun 2018 17:19:59 +0800 Date: Tue, 26 Jun 2018 17:19:59 +0800 From: Herbert Xu To: Eric Biggers Cc: Kees Cook , Giovanni Cabiddu , 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: Re: [dm-devel] [PATCH v2 10/11] crypto: ahash: Remove VLA usage for AHASH_REQUEST_ON_STACK Message-ID: <20180626091958.zy3m24sjukfbn7av@gondor.apana.org.au> References: <20180625211026.15819-1-keescook@chromium.org> <20180625211026.15819-11-keescook@chromium.org> <20180625225609.GA181665@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180625225609.GA181665@gmail.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 25, 2018 at 03:56:09PM -0700, Eric Biggers wrote: > > > diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h > > index a0b0ad9d585e..d96ae5f52125 100644 > > --- a/include/crypto/internal/hash.h > > +++ b/include/crypto/internal/hash.h > > @@ -142,6 +142,7 @@ static inline struct ahash_alg *__crypto_ahash_alg(struct crypto_alg *alg) > > static inline void crypto_ahash_set_reqsize(struct crypto_ahash *tfm, > > unsigned int reqsize) > > { > > + BUG_ON(reqsize > AHASH_MAX_REQSIZE); > > tfm->reqsize = reqsize; > > } > > This isn't accounting for the cases where a hash algorithm is "wrapped" with > another one, which increases the request size. For example, "sha512_mb" ends up > with a request size of I think this patch is on the wrong track. The stack requests are only ever meant to be used for synchronous algorithms (IOW shash algorithms) and were a quick-and-dirty fix for legacy users. So either check SHASH_MAX_REQSIZE or just convert the users to kmalloc or even better make them real async users. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt