From patchwork Thu Apr 21 07:14:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steffen Klassert X-Patchwork-Id: 8896761 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8B597BF29F for ; Thu, 21 Apr 2016 07:14:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A0D5420218 for ; Thu, 21 Apr 2016 07:14:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5722C201C8 for ; Thu, 21 Apr 2016 07:14:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751588AbcDUHO4 (ORCPT ); Thu, 21 Apr 2016 03:14:56 -0400 Received: from a.mx.secunet.com ([62.96.220.36]:44705 "EHLO a.mx.secunet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751010AbcDUHOz (ORCPT ); Thu, 21 Apr 2016 03:14:55 -0400 Received: from localhost (alg1 [127.0.0.1]) by a.mx.secunet.com (Postfix) with ESMTP id 708031A0744; Thu, 21 Apr 2016 09:14:53 +0200 (CEST) X-Virus-Scanned: by secunet Received: from a.mx.secunet.com ([127.0.0.1]) by localhost (a.mx.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ly-7H-rfkJ9c; Thu, 21 Apr 2016 09:14:52 +0200 (CEST) Received: from mail-essen-01.secunet.de (unknown [10.53.40.204]) by a.mx.secunet.com (Postfix) with ESMTP id 4EB621A0745; Thu, 21 Apr 2016 09:14:52 +0200 (CEST) Received: from gauss.dd.secunet.de (10.182.7.102) by mail-essen-01.secunet.de (10.53.40.204) with Microsoft SMTP Server id 14.3.279.2; Thu, 21 Apr 2016 09:14:52 +0200 Received: by gauss.dd.secunet.de (Postfix, from userid 1000) id B7F755C09B3; Thu, 21 Apr 2016 09:14:51 +0200 (CEST) Date: Thu, 21 Apr 2016 09:14:51 +0200 From: Steffen Klassert To: Herbert Xu CC: Sowmini Varadhan , Subject: [RFC PATCH] crypto: Make the page handling of hash walk compatible to networking. Message-ID: <20160421071451.GE3347@gauss.secunet.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [10.182.7.102] X-G-Data-MailSecurity-for-Exchange-SpamLevel: 0 X-G-Data-MailSecurity-for-Exchange-SpamFilter: 0; 1; str=0001.0A0C0202.57187DEC.020D,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 X-G-Data-MailSecurity-for-Exchange-State: 0 X-G-Data-MailSecurity-for-Exchange-Error: 0 X-G-Data-MailSecurity-for-Exchange-Sender: 32 X-G-Data-MailSecurity-for-Exchange-Server: d65e63f7-5c15-413f-8f63-c0d707471c93 X-EXCLAIMER-MD-CONFIG: 2c86f778-e09b-4440-8b15-867914633a10 X-G-Data-MailSecurity-for-Exchange-Guid: 854528CC-EB7E-4132-8D70-687599A0012D Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The network layer tries to allocate high order pages for skb_buff fragments, this leads to problems if we pass such a buffer to crypto because crypto assumes to have always order null pages in the scatterlists. This was not a problem so far, because the network stack linearized all buffers before passing them to crypto. If we try to avoid the linearization with skb_cow_data in IPsec esp4/esp6 this incompatibility becomes visible. Signed-off-by: Steffen Klassert --- Herbert, I could not find out why this PAGE_SIZE limit is in place. So not sure if this is the right fix. Also, would it be ok to merge this, or whatever is the right fix through the IPsec tree? We need this before we can change esp to avoid linearization. The full IPsec patchset can be found here: https://git.kernel.org/cgit/linux/kernel/git/klassert/linux-stk.git/log/?h=net-next-ipsec-offload-work crypto/ahash.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/crypto/ahash.c b/crypto/ahash.c index 5fc1f17..ca92783 100644 --- a/crypto/ahash.c +++ b/crypto/ahash.c @@ -44,8 +44,7 @@ static int hash_walk_next(struct crypto_hash_walk *walk) { unsigned int alignmask = walk->alignmask; unsigned int offset = walk->offset; - unsigned int nbytes = min(walk->entrylen, - ((unsigned int)(PAGE_SIZE)) - offset); + unsigned int nbytes = walk->entrylen; if (walk->flags & CRYPTO_ALG_ASYNC) walk->data = kmap(walk->pg); @@ -91,8 +90,6 @@ int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err) walk->offset = ALIGN(walk->offset, alignmask + 1); walk->data += walk->offset; - nbytes = min(nbytes, - ((unsigned int)(PAGE_SIZE)) - walk->offset); walk->entrylen -= nbytes; return nbytes;