Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1690261pxb; Sat, 29 Jan 2022 14:05:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHhWk3zXf6TBXv7XOFoLMNMzGQc0nuUMDcz+A5D53UMkYicElZ61J+6/2VfZvOXuFqPBZi X-Received: by 2002:a63:f15:: with SMTP id e21mr8954784pgl.571.1643493916025; Sat, 29 Jan 2022 14:05:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643493916; cv=none; d=google.com; s=arc-20160816; b=mahOoD5kNDSqS7C2dcfHPP7nbnbcSp3ybydHNCJ9xMoHkjnQIMYB2BvjmGq9gmdgKV 1rTYSfU2bwPwjsgHfBM8cgoVkd6pL7JClPnNdtgvamNsAi0+D4W3WF4SZ9tkPudx47dF tmVGDj/viiLkECl4KF4ioE0ItghnR5xMA2qXgwH85hjGmNYT1blCPJGFIXtkX88vlk8q AsMP3deZxogdX8ftFfQkXFQz9ru50vFOK86QRbla8QUmuLSx0cJeq06TRujLvQrVRF/K Ww9gyzysXkSH4VtriXGgCgWTZOY6haReCUUFtyudHNKH1rm50iwDbLTDuZRRye32ChAW y4Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=jSl3ewhPoGbOs2JWHMoXekpGVplAkhkHwncp6w0HREE=; b=I+qyTAkkDRjhrxR+ZOg49wBTrcUv45lerQx1y5HfmQZzLqi1Lt+VYcEV62ptG9RwaI xEdXu0J4ZiHMY5j2TzYl+hURxS5zCrRIVwyP1VaDAfuTNkOohaDUknv2h+056wG8mgEL b3wysLQFTLYITQx7Y4fBjLYDmTnCpYwwPEz+sriU5oiCimdIedaBWJmQuaW5mPmhkshz bEhcsC36k0u0qXQlHCLZpOucYUJimgxMQP7jTgcNQ+zxFz9Lpx7COshF/XxLwFkw3Yfi WoKYezL1pHUlXHH2hgY9b6zAab3iliaIhtpfZcB7ehrrbEWzkCqjMQDrQsL/rV2yl7EG S+cA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u20si8810569pfi.356.2022.01.29.14.05.03; Sat, 29 Jan 2022 14:05:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346466AbiA1G1P (ORCPT + 99 others); Fri, 28 Jan 2022 01:27:15 -0500 Received: from helcar.hmeau.com ([216.24.177.18]:60618 "EHLO fornost.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346464AbiA1G1O (ORCPT ); Fri, 28 Jan 2022 01:27:14 -0500 Received: from gwarestrin.arnor.me.apana.org.au ([192.168.103.7]) by fornost.hmeau.com with smtp (Exim 4.92 #5 (Debian)) id 1nDKj1-0001Cz-L8; Fri, 28 Jan 2022 17:27:12 +1100 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Fri, 28 Jan 2022 17:27:11 +1100 Date: Fri, 28 Jan 2022 17:27:11 +1100 From: Herbert Xu To: Ard Biesheuvel Cc: linux-crypto@vger.kernel.org, arnd@arndb.de Subject: Re: [PATCH] crypto: memneq: avoid implicit unaligned accesses Message-ID: References: <20220119093109.1567314-1-ardb@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220119093109.1567314-1-ardb@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, Jan 19, 2022 at 10:31:09AM +0100, Ard Biesheuvel wrote: > The C standard does not support dereferencing pointers that are not > aligned with respect to the pointed-to type, and doing so is technically > undefined behavior, even if the underlying hardware supports it. > > This means that conditionally dereferencing such pointers based on > whether CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y is not the right thing > to do, and actually results in alignment faults on ARM, which are fixed > up on a slow path. Instead, we should use the unaligned accessors in > such cases: on architectures that don't care about alignment, they will > result in identical codegen whereas, e.g., codegen on ARM will avoid > doubleword loads and stores but use ordinary ones, which are able to > tolerate misalignment. > > Link: https://lore.kernel.org/linux-crypto/CAHk-=wiKkdYLY0bv+nXrcJz3NH9mAqPAafX7PpW5EwVtxsEu7Q@mail.gmail.com/ > Signed-off-by: Ard Biesheuvel > --- > crypto/memneq.c | 22 +++++++++++++++------- > 1 file changed, 15 insertions(+), 7 deletions(-) Patch applied. Thanks. -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt