Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1526119pxb; Fri, 21 Jan 2022 22:15:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJyIPXmSPimL8kfDq/tgbyFXFrlexA1Qa5HIr/USxbIqht1X9V2N8QtGAcSFOR7SPbV7NMHw X-Received: by 2002:a63:b145:: with SMTP id g5mr5207629pgp.113.1642832124108; Fri, 21 Jan 2022 22:15:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642832124; cv=none; d=google.com; s=arc-20160816; b=03OLxC0hPBrR5a9f94b+Sakbd+sO1lX1VghWVsA8SJmqRU5fIZ1CVXyDWk7uikjL3+ ouKVLx5p5Xw8UVLUytOZZ7olNshJs3xcxYd1o6Lg6+5EyKWu3r0Uno1RVXiZ9Ev3z1Bs P4Uz28suzMYUZc1X2f3MUQXsFlsmCTNl2hR+q3UhH+jedm1cpTCbiVIrZESvaKVDtiNB TheuA/6ik/21dnZ2U6wM3mTtqhqh47gm+ORvoDB6EuhoESip2hz3IsSSOVCD1FyseKzd MaMwlGXM373ihS45sXAPTgI3z/qydrUnp0HcA/2v4STDK1U29hq/R1Hpf2y+1zhUlRX8 WPiQ== 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:dkim-signature; bh=v17B0m7fHOIotmv/LTKNCwd41vpAjAXyBx71rmGIq4I=; b=WyiIvCQSTeTkbgTrNrpYpOhF8onG8MLeoXwYndd+MgHxEsqKo/cSpd1Q3RCh6bluKX a42/scb2CcE0t2+sxpMWmF8D7OJL5nTbV6UYLeaB3OGTK06Za7cF5DJM+TSErRxJ7DQp 6PUBxwSGKU8DtDHolMyxVImKv+UlUePTtVZyNp8NhJqR0MXEn6rMv1nHwLMtSDVrl4xD dhD2ZAUkXxjCmIvxLPltITYi+piNck/2bNEneO4p0yEm2g299WpfwXOFKe53yBEP6dD5 YIQqn6u8RTCvsWHPi1yD1TXMs+e3BHcF3ftMdsF+o/N50Sdh8OycaceC3xhqFR3Am55M 5CHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c+qr8tGU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i5si5793424pjx.145.2022.01.21.22.14.55; Fri, 21 Jan 2022 22:15:24 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c+qr8tGU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230061AbiAUTvW (ORCPT + 99 others); Fri, 21 Jan 2022 14:51:22 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:57690 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229697AbiAUTvV (ORCPT ); Fri, 21 Jan 2022 14:51:21 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A4167614D6 for ; Fri, 21 Jan 2022 19:51:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEB56C340E1; Fri, 21 Jan 2022 19:51:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642794680; bh=8BmhUZ0IpHZYhILT7YzhRJy+4bo2IwVID8v7pOcNti4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=c+qr8tGUIyA6rTB+LSYTav7qcMnTeRS83rqVVbJsWKlgMmyrB+z+7r6ZICFVQSJIY uXtrz1jT+29Accnc8R0twQHmrCrNzHIHHfWsVkhq1QCiM10cYeNGnUOp8VaVyUZfU7 TK8Tza7VaLnayAV6va6z/UtxBoL9U2LqHFiecQ5LoNIR0BrE+SJNoKLfLKyLSV6cLs NbYKXm4lQsg+z6K92hgMlFXDQobrYx683tRaPN1/1OisX11PgGccnXVuoIoxA5LAQg MYAePXEPxUXnwar+qAC1LKmIqgN487yeaFI4Igt1wLxaHxQ8rYzdz9CwMewFl+bJNe CJzMBJ38morGw== Date: Fri, 21 Jan 2022 11:51:18 -0800 From: Eric Biggers To: Ard Biesheuvel Cc: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au, 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(-) > Reviewed-by: Eric Biggers - Eric