Received: by 2002:a19:f614:0:0:0:0:0 with SMTP id x20csp32740lfe; Fri, 15 Apr 2022 18:04:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxm+OIFAbTbsF7A5Sx6ZkE8fOvCj3msLpmAKjTXDqywAZuzoHykCSaX7kluKnnYEtOGnIbG X-Received: by 2002:a17:902:8f94:b0:154:839b:809f with SMTP id z20-20020a1709028f9400b00154839b809fmr1573660plo.150.1650071080491; Fri, 15 Apr 2022 18:04:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650071080; cv=none; d=google.com; s=arc-20160816; b=OjhggDYPOjjgf20go23BGqREbXzNEju4Xx2bKvQYpvXNRPQDbkrhWbOAYJrPZL4egv +CcEuMNGVOl74gi6uLY0AVlmyl4UFW4c7MKD7MfvhlJ0PkHRpinUcLzQ8OaqzwPuoMZ3 WKh9uhXm4YjQAA/MDLWN576Wpdfo/ZFQO99KCspfxLjC75WNdTWsCP7+EBdTR3qAgY36 vB9dEpxkvVVRjKVxNOR1pB1EAhzjgYARadO9StZR2RY7CQwirWr7uZyv19vdvVsMGi3T Km0PFsK2k5UFxTQ956CstpeBPmrKM7daQyIpo7I+r8w06tsl0v9DqEHmDfMhPJzYx9ey ohiQ== 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:dkim-signature; bh=p1exq1VTm03P9EUk6bqHc6lo2s8LsObibOH/5X+VnGA=; b=f4X0UGHgcoFw/A/qp6sNEfyUImqtnkLxqpYXBe4dcoyu58hn4ATeqT8whI64NJmpJd CEbnAb7MEq18DE6XV4A/RQTbSEoauTkTdGJGcxUgIuCmSe6YvW/UGtnoO3KVVuP1jgk/ ZqxBKpBF7BWjM4R0+//M3AJJU0DzVmzBqmthNuyFTozXx+/SceIgHK5WnKHBw+ZkLQ6+ lJZKVBBBoYwTh74ovR5Q2GmlgNuzPF6Ag36uQ5WCu6V4kBLTHT/udQ529oCW2f7gmUr5 rLHTgbFt/CVajgUZ19pG0+5JT8vD6gvhEDsHAh8BfkQSG0X2c+5zQoiuiCK8zJ+VUWpL U9xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tXi9Jj5f; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id c4-20020a056a000ac400b00505d99afd25si3019999pfl.29.2022.04.15.18.04.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 18:04:40 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tXi9Jj5f; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 65234F4628; Fri, 15 Apr 2022 17:45:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351298AbiDOIIC (ORCPT + 99 others); Fri, 15 Apr 2022 04:08:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235858AbiDOIIB (ORCPT ); Fri, 15 Apr 2022 04:08:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D57A6A2046 for ; Fri, 15 Apr 2022 01:05:33 -0700 (PDT) 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 68FCA61F95 for ; Fri, 15 Apr 2022 08:05:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1757C385AD for ; Fri, 15 Apr 2022 08:05:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650009932; bh=riuuKXnoQlBRBV7zO25zHcF/JWwq7zfPNr5mu3m9+jI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=tXi9Jj5fnDgYEJrim5xfcMUIa9y+5BF6p9ZqnM7Q/aJgxGpwJRTGeSeibe2Y5Ezn1 teTDfS5nnAyKMU/ta+74JyWSeLIP6b0vZEqt5zWkyIVFKM3+0swjJv18a2cSQWQWqq IymLFV+D2iufYzMlVa94ag1HVsBOPhqflDvp4s7q4EBATTYae/zHKm9I0qr5DQXhq+ O3gLobRWXRaenBCExS0LOcP8DoW7qndV8GXQIUI6o8VBWak5jLP/LfgiimF9nZx3dj ieTcO471WheCh1GtnDnM5PCMP6nnZ1RBHzqfHMvWEGdMx24LHCdlY8kPryIqMxlDej +TVsRzXWf2zbQ== Received: by mail-oa1-f54.google.com with SMTP id 586e51a60fabf-e2442907a1so7524265fac.8 for ; Fri, 15 Apr 2022 01:05:32 -0700 (PDT) X-Gm-Message-State: AOAM531C1pblVILATDEk+G1sy99aYEELZCX7N6XZ7gOco/tTypkCSZYQ lQv1ZgG7MKr9YcTAtlf8k2eLHZOl6beqm4S6+Ok= X-Received: by 2002:a05:6870:eaa5:b0:da:b3f:2b45 with SMTP id s37-20020a056870eaa500b000da0b3f2b45mr1000528oap.228.1650009931924; Fri, 15 Apr 2022 01:05:31 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ard Biesheuvel Date: Fri, 15 Apr 2022 10:05:21 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 07/10] crypto: Use ARCH_DMA_MINALIGN instead of ARCH_KMALLOC_MINALIGN To: Herbert Xu Cc: Catalin Marinas , Will Deacon , Marc Zyngier , Arnd Bergmann , Greg Kroah-Hartman , Andrew Morton , Linus Torvalds , Linux Memory Management List , Linux ARM , Linux Kernel Mailing List , "David S. Miller" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 15 Apr 2022 at 09:52, Herbert Xu wrote: > > On Fri, Apr 15, 2022 at 09:49:12AM +0200, Ard Biesheuvel wrote: > > > > I'm not sure I understand what would go wrong if that assumption no > > longer holds. > > It's very simple, we don't do anything to the pointer returned > by kmalloc before returning it as a tfm or other object with > an alignment of CRYPTO_MINALIGN. IOW if kmalloc starts returning > pointers that are not aligned to CRYPTO_MINALIGN then we'd be > lying to the compiler. > I guess that should be fixable. GIven that this is about padding rather than alignment, we could do something like struct crypto_request { union { struct { ... fields ... }; u8 __padding[ARCH_DMA_MINALIGN]; }; void __ctx[] __align(CRYPTO_MINALIGN); }; And then hopefully, we can get rid of the padding once we fix drivers doing non-cache coherent inbound DMA into those structures.