Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp576553img; Fri, 22 Mar 2019 04:23:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqwebH13GSCQTIaFARqJBfzkwweP8EcymnnC6BCsv/Msr8Q6mCI2hG5JAj79ufIZHhrmivhJ X-Received: by 2002:a63:2045:: with SMTP id r5mr8254203pgm.394.1553253800886; Fri, 22 Mar 2019 04:23:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553253800; cv=none; d=google.com; s=arc-20160816; b=J3dUhZGTNCPiERLfEjQ2AwtRf/v74YzY0Z+Bsf3BXeGwPq4/dS0goGDHKRc5gP4aAF kmT6JYgudFIXQ3Eob9wF1srOteVO8AGRQ03wUEoeJp7iaOkeCxPiNtcUTnhrDkZDRdaV WUOvGDUUr+KukDBlZG0qqjWD/JSHObOHJ+TRwamgGIoLksHSkSKBrsYHIQF6U38XMUP0 5tLj0gpoAlCCxEh8o+ZMdxJrhIX+BRZTVQdsZ089VFeUyKJDsYYzcg0d03d9Q0u/c1UD aaUIV35vs9oZGQ+Ez6rJ14oEy5i7LFvdZ/eN8+6yje/yJk6jeYMPXD56G2yfzz/DTTT1 Hv5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xSdybU0YDtaU5aivjCRuRVtaqTyhoveMSDa1h2QltHE=; b=ZcSrzb8fKfv/f/LoZ7pkdR5bWSLyGdb0wq4UuWBz2FLoOPJQbK/RYhV/0boQdCZ7Vg /dUT2fFV4lF+O1q/jUxbLu6HJd4Rrl5tQ1hpIcbuXk58OzxQdWnfxnhPtUHsT4Po0LQQ zWANXWkd4/VnexhODxL9ZsE3nKKz7Bx69AIaXrT4UjYaiQNhU/QhrzUbwzuKhhYItD3T tVFdQpxPM5ceX2Mbl3W3utJV4aXk/zTAPD0WxJYMllGGie4WjSyA2FhWVaT2gVbQNurc oTNNQjvEl7OGgBeXz7ynZ4wOF1Pj/mwcXOX1NHRenrgmiZnnO6FUzufM8pJXoWr2F7HY Z0Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=T2cBol0D; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 94si7044742plc.298.2019.03.22.04.23.03; Fri, 22 Mar 2019 04:23:20 -0700 (PDT) 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=T2cBol0D; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728667AbfCVLVq (ORCPT + 99 others); Fri, 22 Mar 2019 07:21:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:48276 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728645AbfCVLVp (ORCPT ); Fri, 22 Mar 2019 07:21:45 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 3E04A218A2; Fri, 22 Mar 2019 11:21:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553253704; bh=VmYwHchFG0nS/1a791g5naJJkRJw1E/YKHhKR8MWwm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T2cBol0DMNhacbEOezXvLvgjjBJjibfZ3Z6QATXvQKcMk1nyypIdMoF0DtjwXCOFE 9hd/vjHWjamEnbkuykuC8HszGfN4JjnCPEeCtrw6EQiXliV7rKQxUkA7jEoddGpkgD npUL4F04O8VOFl6rMDvT3NmXG2veJ15C8BJJm1K8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aaro Koskinen , Eric Biggers , David Howells , James Morris Subject: [PATCH 3.18 018/134] KEYS: user: Align the payload buffer Date: Fri, 22 Mar 2019 12:13:51 +0100 Message-Id: <20190322111211.261485677@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111210.465931067@linuxfoundation.org> References: <20190322111210.465931067@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Biggers commit cc1780fc42c76c705dd07ea123f1143dc5057630 upstream. 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 Signed-off-by: David Howells Signed-off-by: James Morris Signed-off-by: Greg Kroah-Hartman --- include/keys/user-type.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/keys/user-type.h +++ b/include/keys/user-type.h @@ -29,7 +29,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;