Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp501635imu; Wed, 16 Jan 2019 02:46:07 -0800 (PST) X-Google-Smtp-Source: ALg8bN6gP0LvPnjhKZy9GGIZAJcJ8Qrz9CjRd5U2EAOe/mVLAZ1ZGpBPOD1AAkKm8fSLPs2ELiCa X-Received: by 2002:a63:ca02:: with SMTP id n2mr8301924pgi.187.1547635567233; Wed, 16 Jan 2019 02:46:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547635567; cv=none; d=google.com; s=arc-20160816; b=pMDjJ35d1aJYKjlzjt+g/SKsKQIL9R8623KtiqMweP80RZYv3O93b0y5APARjSOzgI fLVLRGExWo55E9aQ9w00rgNPIHdAqzJj4Zj3Wb5eLfl8AcZJO5BsIZY3jw/6muH2l54X Lwus+BEJPdnbw5ZG/bXt9hVA8BaxWPMOcz1LD/jRHnDu83BR8eMaUoVWj7Gca5p9na6U i9/wgcJt6E82Eoj7DndlpAcT9LloashNTANy6wd2pPbuEu/XNrarahrqfx77cG0dr7vy cVYUmMFOQ3Ty5XAVxnFQVq0zq3spLdLFVUbdjFMLrsrADFh0yOUJCfL5zbSGlYgkH9wN MCAA== 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=gBfzjWRxbwpylAZ9zMugdwyGjW6+GdEdfeLi4E+9Bi4=; b=diGS8I2SYXG5kn5EDYkbyHKKkd7Z55a3BE4s+bkU31PCMte2ukleAo95CRmYv99WaK bYucMheyfXSbs/jlNKqY9x91MrsVC8ApFbxuHnQYtpxQ0J0lehiI8fARyCkDil9s9cd3 Dng+mqLHZewyo4dO4M5wwC+rAttNFVKQtcoS/7thCk/SSwFRMf0aQ+rF6KlZJ+0l1qi7 RTBB/AeoFuskR4GStV1a0wzSfooTtPTKhw7XFBOqa/rYaboSbzKD/9AHyoEe2TOnLQSd KfYKBY7OLrWYagxsTkvWZQCeut7C8I806tFKoqEXsyy95jbyFySFWE69RecwBeC8hMee Mpkg== 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 j195si4895161pfd.165.2019.01.16.02.45.48; Wed, 16 Jan 2019 02:46:07 -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 S2389257AbfAOTTh (ORCPT + 99 others); Tue, 15 Jan 2019 14:19:37 -0500 Received: from emh07.mail.saunalahti.fi ([62.142.5.117]:58236 "EHLO emh07.mail.saunalahti.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729633AbfAOTTg (ORCPT ); Tue, 15 Jan 2019 14:19:36 -0500 Received: from darkstar.musicnaut.iki.fi (85-76-102-108-nat.elisa-mobile.fi [85.76.102.108]) by emh07.mail.saunalahti.fi (Postfix) with ESMTP id BFF74B0045; Tue, 15 Jan 2019 21:19:33 +0200 (EET) Date: Tue, 15 Jan 2019 21:19:33 +0200 From: Aaro Koskinen To: Eric Biggers Cc: keyrings@vger.kernel.org, David Howells , linux-fscrypt@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KEYS: user: Align the payload buffer Message-ID: <20190115191933.GA27799@darkstar.musicnaut.iki.fi> References: <20190115033716.18380-1-ebiggers@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190115033716.18380-1-ebiggers@kernel.org> 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 Mon, Jan 14, 2019 at 07:37:16PM -0800, Eric Biggers wrote: > From: Eric Biggers > > Align the payload of "user" and "logon" keys so that users of the > keyrings service can access it as a struct that requires more than > 2-byte alignment. fscrypt currently does this which results in the read > of fscrypt_key::size being misaligned as it needs 4-byte alignment. > > Align to __alignof__(u64) rather than __alignof__(long) since in the > future it's conceivable that people would use structs beginning with > u64, which on some platforms would require more than 'long' alignment. > > Reported-by: Aaro Koskinen > Fixes: 2aa349f6e37c ("[PATCH] Keys: Export user-defined keyring operations") > Fixes: 88bd6ccdcdd6 ("ext4 crypto: add encryption key management facilities") > Cc: stable@vger.kernel.org > Signed-off-by: Eric Biggers Tested-by: Aaro Koskinen This fixes the "unaligned access" dmesg spam on SPARC when using ext4 encryption. Thanks, A. > --- > include/keys/user-type.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/keys/user-type.h b/include/keys/user-type.h > index e098cbe27db54..12babe9915944 100644 > --- a/include/keys/user-type.h > +++ b/include/keys/user-type.h > @@ -31,7 +31,7 @@ > struct user_key_payload { > struct rcu_head rcu; /* RCU destructor */ > unsigned short datalen; /* length of this data */ > - char data[0]; /* actual data */ > + char data[0] __aligned(__alignof__(u64)); /* actual data */ > }; > > extern struct key_type key_type_user; > -- > 2.20.1 >