Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp337204ybi; Wed, 29 May 2019 22:35:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4nlCu5M6kORjb8IC7QGZXJbmNC98zAyZqt8Tow10QH2HruH8guPAEBDHfnQsK15p7tYxt X-Received: by 2002:aa7:989b:: with SMTP id r27mr1935398pfl.108.1559194502212; Wed, 29 May 2019 22:35:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559194502; cv=none; d=google.com; s=arc-20160816; b=BYgJPyQj6y9ieOd1TSw56wK847xF76DEHwquII/s2UxnXkw683znsTMHZ/Mi5NmJAy 4h1c+WrhMPU98R6p6daUcPZ3p/y2yroO7Xacb/hryKc9hJf702mY8I2qIlL1qomtRo+H h4yjfPgTCk8wYgj0zGuOF9MderAqcBoa2HNhh+xBArLCNYf6MIElw91j5kx6qwaFaKUS lOVEi5w35VnaSVeUE/6HElSNXMcA/SBIIkup4GnxI1C/aG87sqCFQcVmItdqwLxrRd/C ZoKJAt6Crc07QJm4Z2c4wmbBoOsSTSa35hWqFl/t7Aq39JzJtNQSevaBLIyFwxLHUwFy Z/fA== 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; bh=rkLJ3TdLTudVGbGc131IslqEihlNn26W8aLZ2+nX0zg=; b=IDIY92G1z+IA62J8BtgN7xDes47qX4E4rDmk2G/0y+yLhGNztdSLcoOq4xQKGT64Td SRAXsCo2obB8wUyAlMUQzvrPO1F3LpDLj5dqnsPiiTsIBPO5530DHbyU2Gv6t/28KlzC 88PJKuZekOL1YGUHEHiBpuqkYP/KBH8Bj38HXBfyu1AXyp3f5BrrtgjTOpisvwB3IbuB rwnuXKqKafHQSzUD6fJrFQslAcfQmw3Bl8AxNLvyAqsQ1GtWZUbqeCrVbQJQ1zurPpUY +oAcIJ9GHgAdhORjQnCoskX3y1mpujf++I/xgGyf8it7kGGFk3uXOomX+vo1BW2ERe2A 7UHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 c2si2242303pgd.415.2019.05.29.22.34.35; Wed, 29 May 2019 22:35:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726548AbfE3Fec (ORCPT + 99 others); Thu, 30 May 2019 01:34:32 -0400 Received: from helcar.hmeau.com ([216.24.177.18]:60942 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725961AbfE3Fec (ORCPT ); Thu, 30 May 2019 01:34:32 -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 1hWDhr-0002Go-07; Thu, 30 May 2019 13:34:27 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1hWDhl-0005JK-D2; Thu, 30 May 2019 13:34:21 +0800 Date: Thu, 30 May 2019 13:34:21 +0800 From: Herbert Xu To: Eric Biggers Cc: Iuliana Prodan , "David S. Miller" , Ard Biesheuvel , Horia Geanta , Sascha Hauer , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx Subject: Re: [PATCH] crypto: gcm - fix cacheline sharing Message-ID: <20190530053421.keesqb54yu5w7hgk@gondor.apana.org.au> References: <1559149856-7938-1-git-send-email-iuliana.prodan@nxp.com> <20190529202728.GA35103@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190529202728.GA35103@gmail.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, May 29, 2019 at 01:27:28PM -0700, Eric Biggers wrote: > > So what about the other places that also pass an IV located next to the data, > like crypto/ccm.c and crypto/adiantum.c? If we're actually going to make this a > new API requirement, then we need to add a debugging option that makes the API > detect this violation so that the other places can be fixed too. > > Also, doing a kmalloc() per requset is inefficient and very error-prone. In > fact there are at least 3 bugs here: (1) not checking the return value, (2) > incorrectly using GFP_KERNEL when it may be atomic context, and (3) not always > freeing the memory. Why not use cacheline-aligned memory within the request > context, so that a separate kmalloc() isn't needed? > > Also, did you consider whether there's any way to make the crypto API handle > this automatically, so that all the individual users don't have to? You're absolutely right Eric. What I suggested in the old thread is non-sense. While you can force GCM to provide the right pointers you cannot force all the other crypto API users to do this. It would appear that Ard's latest suggestion should fix the problem and is the correct approach. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt