From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756324AbcBPW5m (ORCPT ); Tue, 16 Feb 2016 17:57:42 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:58938 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756166AbcBPW5l (ORCPT ); Tue, 16 Feb 2016 17:57:41 -0500 Date: Tue, 16 Feb 2016 22:57:38 +0000 From: Al Viro To: Rasmus Villemoes Cc: Jeff Layton , "J. Bruce Fields" , Linus Torvalds , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] vfs: make sure struct filename->iname is word-aligned Message-ID: <20160216225738.GD17997@ZenIV.linux.org.uk> References: <1455662966-7977-1-git-send-email-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1455662966-7977-1-git-send-email-linux@rasmusvillemoes.dk> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 16, 2016 at 11:49:24PM +0100, Rasmus Villemoes wrote: > I noticed that offsetof(struct filename, iname) is actually 28 on 64 > bit platforms, so we always pass an unaligned pointer to > strncpy_from_user. This is mostly a problem for those 64 bit platforms > without HAVE_EFFICIENT_UNALIGNED_ACCESS, but even on x86_64, unaligned > accesses carry a penalty, especially when done in a loop. > > Let's try to ensure we always pass an aligned destination pointer to > strncpy_from_user. I considered making refcnt a long instead of doing > the union thing, and mostly ended up tossing a coin. Why not swap it with the previous field, then?