Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp29998imu; Thu, 10 Jan 2019 16:23:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN6ISXmKEqOwWBdOGRe4stVMwuz7lSpWhdyAW34QYwnsPhrP/DaOJwDz9qhRNapXvzxQe1gX X-Received: by 2002:a63:e711:: with SMTP id b17mr1225468pgi.363.1547166219554; Thu, 10 Jan 2019 16:23:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547166219; cv=none; d=google.com; s=arc-20160816; b=Bs2NhKIsCbVJsEcD2o5jP24uZfk3FdRk0UxdPJ/1nlZpTt0Xpo+CZiCJ8nDJeJ9Cb9 JDNTatMPwmmXTIvcRVnSZDoySB00oiTqZp9K94+TWwYrnx/756ITUngtcJnOarmQLU8O JajwPDKTZJEheMk3gpbnHLKbvMc8EoPRu3tCHdG5P5awnhPBkOzYA0OhTcNssjXMR6RC QAUok2W7vxJUNrqavrNTqQ4IEKOGOVLhWbRnGfJsI8w5o9NlOk44dJ16NJjZEci1uUgj Qn43MZ/G1ixTh74qJn2lYtnJTYP0IVWDutQiq9R57RX7Zq4tIYKFWgWUngutLgtAA6aG XIyA== 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=YX2q23dFKTsJOwe89LBxYEEhUluKQHF4XamMSOmstNw=; b=rKC2aRcRQOU3dM2rKNEyixrposYVLH9WxfCtXoAJpg2trbdkSA3QXRxnW0LdRkwWQY wcQm2CVwY47TZLr1wV1DK28pqd1FPbJXvbZcPE1cQdcqZ9/t90PRwneBcgpcE1jurJg+ BUnBm5RUdH9n/XQwqPDunmzC6lPaEVf0XBfQKlAY6OyWutbXBoX8T14URr3BXXKnkbme 5SSTQKt7ZuNQzHSo8bdVcPrXhs9nCmvs+y5DLt2y0cFhkWjpYWKUcCBaTNLMinPU36Bj 3fOqztBWdT46h6qxiOkSqYPDQyW8PZM0BRwInCFkUJHa3cnOU1vzzkVO4qUxI4L7tIHW BrAA== 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 bi6si70278583plb.279.2019.01.10.16.23.24; Thu, 10 Jan 2019 16:23:39 -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 S1729528AbfAJW3c (ORCPT + 99 others); Thu, 10 Jan 2019 17:29:32 -0500 Received: from emh06.mail.saunalahti.fi ([62.142.5.116]:47152 "EHLO emh06.mail.saunalahti.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728042AbfAJW3b (ORCPT ); Thu, 10 Jan 2019 17:29:31 -0500 Received: from darkstar.musicnaut.iki.fi (85-76-101-80-nat.elisa-mobile.fi [85.76.101.80]) by emh06.mail.saunalahti.fi (Postfix) with ESMTP id BEE9130141; Fri, 11 Jan 2019 00:29:28 +0200 (EET) Date: Fri, 11 Jan 2019 00:29:28 +0200 From: Aaro Koskinen To: David Howells Cc: Eric Biggers , "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: <20190110222928.GB22416@darkstar.musicnaut.iki.fi> References: <20190103171659.GA208343@gmail.com> <20181230162906.GI27785@darkstar.musicnaut.iki.fi> <17391.1546622882@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17391.1546622882@warthog.procyon.org.uk> 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 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.