Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1160304pxb; Fri, 21 Jan 2022 11:07:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJw32e45uYc675g6R0Z9vRYImhzsUSeUpjuZumcs6cWyndemHXYnVctFjw0y/Gm8ZdzIsH4g X-Received: by 2002:a17:90a:8589:: with SMTP id m9mr2083867pjn.171.1642792074661; Fri, 21 Jan 2022 11:07:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642792074; cv=none; d=google.com; s=arc-20160816; b=fOCBgGEUTrTCKTprxDG7O8jT2A0BUSOcCtUFiAnaTLwxhi4VC4d8K+yq0fMW6MJ9cd Ib1pWWliki9A7igUAqTuUUWukQeXNJ/6zsvQ6W15Ktjzp4R2LISudR+z4F4hdyjcmKep l3Zp9K1VO5SzxdD3JKVkD5WDIdxFM7DFnM2xkZ1HcTdLQYtwsb158uprckrvt6XBNAA0 oKnyOHKb524YWw6tWiY14Hm5y5H4aLbXiabT/ObeN3kY1iR3GR6alp14KfKKLJzKokOd aVJRH3H8Ydd+wupZPio6IToWFQNJ3EBhoi3+EoXhZU/GNCaxvd1qoweoFTr3ZLw9GhRP 4teA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=LXgaelm9tWO+d/lPEw+xhGX5tc0YV6Dy5smTwKkY2So=; b=bzNNuoQs6BiogjKudiJL1/KhiT8u/Xv6So4sonYMrja1j4b+532/O1tNwNVXdAdKVL ASugecvNeVtGn2dHhGScPdUTurGuDZJlLRN3i6PjYwUuW/N8SvZ5OYGiZ29j8/in2ZzU x+dtGdVHTgX/eCATwJ+qFXRUSrpzytvOy+CmnGxyydwIGcIQM7DL835VmCTIQL8jykMU I2Fo56M8rj5B9B/t08FAXrGSi8cffQ/ipcqz0KhSgp2TuQFf6im+T1x+zhMIFTod7drE J2jTuGcl6gkLKP1k4Etiyu+vHoLAbOO9Yr6qZ5SVbjcZoufJzp+1pIDDLY1Z+2sD2rml e45w== 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 w3si6495564ply.342.2022.01.21.11.07.42; Fri, 21 Jan 2022 11:07:54 -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 S1345776AbiASKRt (ORCPT + 99 others); Wed, 19 Jan 2022 05:17:49 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:47343 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349426AbiASKRs (ORCPT ); Wed, 19 Jan 2022 05:17:48 -0500 Received: from mail-wm1-f54.google.com ([209.85.128.54]) by mrelayeu.kundenserver.de (mreue107 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MEmpp-1n762b3UK3-00GFv6 for ; Wed, 19 Jan 2022 11:17:46 +0100 Received: by mail-wm1-f54.google.com with SMTP id v123so4362876wme.2 for ; Wed, 19 Jan 2022 02:17:46 -0800 (PST) X-Gm-Message-State: AOAM533VAa5kP0kc/zqj1+CXKows5y9Cao8iaDHp2XcrcoPp71Dhe68c /pPStNco0feZ+qmWIykMytz4XhEBf7fsZB2FRSs= X-Received: by 2002:a05:600c:4e4e:: with SMTP id e14mr2752715wmq.98.1642587466476; Wed, 19 Jan 2022 02:17:46 -0800 (PST) MIME-Version: 1.0 References: <20220119093109.1567314-1-ardb@kernel.org> In-Reply-To: <20220119093109.1567314-1-ardb@kernel.org> From: Arnd Bergmann Date: Wed, 19 Jan 2022 11:17:30 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] crypto: memneq: avoid implicit unaligned accesses To: Ard Biesheuvel Cc: "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , Herbert Xu , Arnd Bergmann Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:U0DPhcBCCELwr+YvguSv6xB34JJBCkM+fL7YbbeohuYL1qMUVHA hrZBty0uWFLkTrpK9QEPI4pWEqqb6Qahgw8LCotuZsvThSwReciiOcaiAz5zdJbvj4lOQlk 1TO/rI+bhwWVGMbF34XXqzds95G+ExI6KzejPVqg9EMBElKGgIM/Oi/+Elih7Bq3UIc23za rC/27Do9/TnnG4H75XXIA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:4kk5PKYH0Q8=:bCSZIaU9BIoZ7dZBdXWnD9 18IRee2nfXbbo3VmV6ScK9yMMeshlmuKfaXyGcg8z+mHwLxEEfck8n/UqLGIrGBfUarAkehj+ c3z56HpDV9iV3whK2cZw39cp6Geijd9DjxeYBCVnVry5YHJckT1av3j/wbMFGRCWNsoh6jVry N7B+MF0Na7qb89OgFCYda0RNx+96UtWTGBk7uleJX66K86g/kqSZ8/IDka26DmiSQdiaPIxFN WvJYwr2y3MkHTmIVMLUzuDZnFC6BiAFYqB+9rXHUroDWxFusQwCwFm69ApW9+5Pf3L7Opdlqv 4zC5GGRZtGL/9G9a4lpm5E7WiHY/NQysHrP9XXLQAXPNlaBiweVD1GdSHQJmaRO3NLr6dQRSO EXYgsojQffKqzkl3HCGCELVkQbO51yj4ZiTXxl4uRwyT3TBNX8NPgaA6vM1rRsUqVzCkH6dbL EVOGgNr1oNRpo2EnEBHi+AObat7IMf0llhMCa6tEHptMQE6HydCAgZafkgnDQElStsUTD5+8k Gl+UMYlJegVACB9KMVZJgkVZqEgrlabk4YLATEcxsJ+RfqAHeWIUYetavyu1QLNnlVtZPngPf ENTO2zIjRiPspEtAteiZ4/ygLHG3AJ/FKasVnKPS0Mde5QW5Mb8a8bkI+qQUhHPCvZp4c9pJh TTZ/qWMYKOxmXVkhnDaL7c+OCdNvvjE+mDiRTj7rYAqYa0hTcOKP6K2mq8BOHA/J9ZxQ= Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, Jan 19, 2022 at 10:31 AM 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 Reviewed-by: Arnd Bergmann