Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2547imu; Thu, 10 Jan 2019 16:36:10 -0800 (PST) X-Google-Smtp-Source: ALg8bN7x8TsiFnVqbiz4h7rjM6w5hA4BGiap+0wzVlraMjlpzl6NzaXKqmMg1pDRLHsWV/NKKMbi X-Received: by 2002:a63:4a0a:: with SMTP id x10mr11383833pga.237.1547166970169; Thu, 10 Jan 2019 16:36:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547166970; cv=none; d=google.com; s=arc-20160816; b=GU9w4Z8kQSNcS9Xfbblsnt+nnyelDPYZSyCXYK4Mzf0Tej3CgXSO5Bch+J3fk9LwIP Br+1/UG5sQ5vBsOrXIboUxh5v0ouDuo/Rg7NriI0qaXHLlXeBnTdSdcP5xaEbSymSrZV RMxBz8/GdPr223ROXnab9VA1ijCalW476Ang0+t1lp3mZ318jdUrRciieWEjluIqPwLa KCR86dJLsmwBvTPxgj7/WZdaHxiJmQRuAAEsQ1y2neUkKFQeVsh144jO/KqCbPfRhsEI +IdrJi4OA4rHVQXWJT8GGm1xd+5w/MXGffajBEHrFBXKcEdZRje6/2q+HITZQq+zncnD S7hQ== 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=/IsKq0qX38eQuad8NzKRh5vIrU/OU66/UX+WIe8pN5Y=; b=bs+CdYgO4zMomK7aYXnEbrLLDaGiOfngZr9JLHhI0YAGH4gmWqiSshLWm7b0hw/roo bEsCNOCHQqCWdX5yGwDOj/KrGl1RBBHqtk1WHoLHYwZC1zh3uz3cID2eSJDfj8NULhzw BweU2VTA4imLo13ZakKtcO+p+aouuL4fHUg50so0jMYhF4GxYODc/MN1ghx3H+8+QZ/s zXR3lg7f42tS3kBztv0YlVjqHXq/MFYvt7DD594rAJG37MsM8pxIPEw/3ot/eT5HT8ze /ygmAnwCo51mg9aZu2LZHg7SyJXrT1WH7v4s22BeA+OjD4HCBotmUVjyZr3n7XeZ2QNq AA8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=iki.fi Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j20si23869477pgb.520.2019.01.10.16.35.53; Thu, 10 Jan 2019 16:36:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=iki.fi Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730264AbfAJXfR (ORCPT + 99 others); Thu, 10 Jan 2019 18:35:17 -0500 Received: from emh01.mail.saunalahti.fi ([62.142.5.107]:36684 "EHLO emh01.mail.saunalahti.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727846AbfAJXfR (ORCPT ); Thu, 10 Jan 2019 18:35:17 -0500 Received: from darkstar.musicnaut.iki.fi (85-76-101-80-nat.elisa-mobile.fi [85.76.101.80]) by emh01.mail.saunalahti.fi (Postfix) with ESMTP id 33076200C7; Fri, 11 Jan 2019 01:35:14 +0200 (EET) Date: Fri, 11 Jan 2019 01:35:14 +0200 From: Aaro Koskinen To: Eric Biggers Cc: David Howells , "Theodore Y. Ts'o" , Jaegeuk Kim , linux-fscrypt@vger.kernel.org, linux-kernel@vger.kernel.org, keyrings@vger.kernel.org Subject: Re: Bug report: unaligned access with ext4 encryption Message-ID: <20190110233513.GC22416@darkstar.musicnaut.iki.fi> References: <20190103171659.GA208343@gmail.com> <20181230162906.GI27785@darkstar.musicnaut.iki.fi> <17391.1546622882@warthog.procyon.org.uk> <20190110222928.GB22416@darkstar.musicnaut.iki.fi> <20190110230114.GF149637@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190110230114.GF149637@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Thu, Jan 10, 2019 at 03:01:14PM -0800, Eric Biggers wrote: > On Fri, Jan 11, 2019 at 12:29:28AM +0200, Aaro Koskinen wrote: > > Hi, > > > > On Fri, Jan 04, 2019 at 05:28:02PM +0000, David Howells wrote: > > > Eric Biggers wrote: > > > > Hi Aaro, thanks for the bug report! I think you're on the right track; it makes > > > > much more sense to have the keyrings subsystem store the payload with better > > > > alignment, than to work around the 2-byte alignment in fscrypt. > > > > > > > > But how about '__aligned(__alignof__(u64))' instead? 4 bytes may not be enough. > > > > > > > > David, what do you think? > > > > > > Does that even work? > > > > That should work. > > > > > Might be better to just insert 6 bytes of padding with a comment, but yes I > > > agree that it's probably better to align it to at least machine word size. > > > > Padding is fragile, e.g. if struct rcu_head changes. Using __aligned should > > make it always right automatically. > > > > A. > > I agree that __aligned is better. It should work; see 'struct crypto_tfm' in > include/linux/crypto.h for another example of a struct that uses __aligned on a > flexible array at the end. > > Aaro, can you send a formal patch? If you don't I'll do so, but I figure I'll > ask first. Please go ahead; I'd prefer if you send the patch, I will then test it on SPARC and reply with Tested-by (if it works :). A.