Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp995491imj; Thu, 7 Feb 2019 15:36:56 -0800 (PST) X-Google-Smtp-Source: AHgI3IbF4viUoHtHnTLJ+a/75S5AT8/s15GXFWtCqQ06LoUfoFDCnK1ZYHrAtk56FK8eIhb9B0i7 X-Received: by 2002:a63:fa48:: with SMTP id g8mr17397811pgk.203.1549582616870; Thu, 07 Feb 2019 15:36:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549582616; cv=none; d=google.com; s=arc-20160816; b=ceNsvTb3/b4jstfonWOA1tthNroBLZxvLQhS6FokT6Nc4EMO4poAUp9Jhv0o3Ep94B N87myWSeWgD8Lzqvs6WF7Yjn2tHJB0LU2D23382g8v4Wf1Ir8sOJa9JI/l6KAtRmxqVI hDfFVnDjNo9b9QQJEONbNkbqL79Jayx8HE9hC4ip+U5AMTsAexaFuMB+CTNMNER9ke4W jg1EfOdB9lLc0Yw4PiW02+lMZFttY8MFfBNcKgLf1jWWzfl2PiMcRiiJA4VQXjtpl6R/ VTFy3jrpovD82JfuX56CInDZ+LC5pVOosvliHEygyiWnzUlDRqz68CKEKlsSfxaRhzkh G7iw== 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:dkim-signature; bh=QafFQyNtF0jRvtTmsahu6f6aM0ff221NBllSWvUEznM=; b=lK3nQ1XCTa4faTk7hwah267uKPA1gjxnl2ZX40lrO5Tfy5JvaupYKIb/b/iuK0IgZn l716HN+eyISs4oTn4sSCNpTRzIJxgFVVLPAPorCELqjpSg1u+DAMS9pZFkb6yzgUT8kN cMiNKH6etHEPm6ZMzv8V5KoH6K7klCziUWgFwFdqcqERl2NG3+PrrrScE0bcGFHmBFjb kl1rZxRI8XJWHJCL/HFCv4VvPgz1wrjT3Gkw/wSFBKwsHCVKo1alapQuBbX63YLor3eX EDgP/yeno5TWrocNULAif14VKgPvbY6GAD+hEhwCpsspvu6liJhwvR1RSB6Dx2VWoAHK 3QuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SUqCtR8V; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d3si385780pla.122.2019.02.07.15.36.40; Thu, 07 Feb 2019 15:36:56 -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; dkim=pass header.i=@kernel.org header.s=default header.b=SUqCtR8V; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726822AbfBGXfN (ORCPT + 99 others); Thu, 7 Feb 2019 18:35:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:47470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726401AbfBGXfM (ORCPT ); Thu, 7 Feb 2019 18:35:12 -0500 Received: from gmail.com (unknown [104.132.1.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BACCA21721; Thu, 7 Feb 2019 23:35:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549582511; bh=NtFKBrKQtPwpKVb3D9L66e8sAVEgKrwRriTDNcCz4os=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SUqCtR8V0YLXChF+3grUjiDboJQxLTcUMQpgyyi7pIGVE1jfZNU7fX1XagX5bMVsd Rp5ac2u7gTvHXlTrnwxb/yMK6ZV0qR3oNBgS46GbfuE3SlR3+yIgn99FWy8TkYL8iU TnOMZhdYrP/hGS1v+HGzScilfsQk9q2aLnXvPTrY= Date: Thu, 7 Feb 2019 15:35:10 -0800 From: Eric Biggers To: keyrings@vger.kernel.org, David Howells Cc: Aaro Koskinen , linux-fscrypt@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KEYS: user: Align the payload buffer Message-ID: <20190207233509.GA125156@gmail.com> 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.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 > Ping. David, are you planning to apply this? - Eric