Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp581333imp; Wed, 20 Feb 2019 05:33:15 -0800 (PST) X-Google-Smtp-Source: AHgI3Iba8H6Gj/d2C4m3azZDD4IbN3E6eiWfEfFm7ORFLCOKYB8dnWaPDzBcmfWJc7VTFs/kYmmA X-Received: by 2002:a17:902:b58c:: with SMTP id a12mr19630565pls.102.1550669595097; Wed, 20 Feb 2019 05:33:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550669595; cv=none; d=google.com; s=arc-20160816; b=R/dLa6UY3hWBix6zj+pDrvSEtchZ6g8RKbQj4NuCWpxuIdp9mmcZiXyXUXS234hcHC gKB44EIFQCewlG7jOdM+N4USNpHRNY/8vhQh4J2u6+tcNmdJLi5LfdIGdR3Q8Qma+6Ox RKQq+rbdD63cPWaw5ePSppPEd32SJ5waXWnak09k0Q0crnN7FJ6P3K/TXBdYTmwPbOo9 uU/8uIZ6EMwBJWo1Hvlqf5J1CaBvGap4RwgB7ssXpBRNR1aeg7BxXBOjpAjKW0sbeNEr tMKOhkURqgB6lHOi3tHL/emTOCN54T3P8aC0WVJRnrByDI/AH04Ta4ZEx6LOGn3whlWE VWfw== 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:message-id:date:cc:to:from:subject:organization; bh=UDrRor/J4LmKU+17nd+v/ATmM2zEFGuYfzU+0r0hZ2A=; b=qRM+jyRdrSowIiAO8DkT1TOmoJqS6Wt3gPIm6/QGL25C50GK1dICPaBnwdFcNsj+i3 eo2x52TypJq7CdR8uRQZAehkiZhDJWZ8+hgQbnucrmG30/qSSX/efiCvpZe9Xwr6shBU 7RLSDyCHW16TYZF+Dc9eKJaGqL7+6vzt2B8oze8hDgl38weQqBX7AvNnzplGpQ9WSLeY rmzV28PXy2/uTxjmGzqkdePhRYb3WQ5GDVYSdKCpzVsAqe66ZfM4VCqTCzklHSvgA+1i z3eog1lkxa6uI5o3HoDB0nf95lSBANki7G3h3h+0wzjiWjb/pfDWxY+p6iLEJRf2Mf1m fMxw== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t23si2869520pgv.63.2019.02.20.05.32.59; Wed, 20 Feb 2019 05:33:15 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727484AbfBTNcP (ORCPT + 99 others); Wed, 20 Feb 2019 08:32:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33668 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726213AbfBTNcP (ORCPT ); Wed, 20 Feb 2019 08:32:15 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5BF7C2DA996; Wed, 20 Feb 2019 13:32:14 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-121-129.rdu2.redhat.com [10.10.121.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id C62BC2707A; Wed, 20 Feb 2019 13:32:12 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH] KEYS: user: Align the payload buffer From: David Howells To: jmorris@namei.org Cc: Aaro Koskinen , stable@vger.kernel.org, Eric Biggers , Aaro Koskinen , keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 20 Feb 2019 13:32:11 +0000 Message-ID: <155066953188.21038.12015964986007814182.stgit@warthog.procyon.org.uk> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 20 Feb 2019 13:32:14 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: David Howells --- 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 e098cbe27db5..12babe991594 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;