From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756433AbcLNTWL (ORCPT ); Wed, 14 Dec 2016 14:22:11 -0500 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:36391 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753523AbcLNTWJ (ORCPT ); Wed, 14 Dec 2016 14:22:09 -0500 X-ME-Sender: X-Sasl-enc: KzzmCxXYDIHZgRdoXIKjQH5LeT3hwfuW2YygfhZ41wK5 1481743327 Subject: Re: [PATCH v2 3/4] secure_seq: use siphash24 instead of md5_transform To: "Jason A. Donenfeld" , David Miller References: <20161214035927.30004-1-Jason@zx2c4.com> <20161214035927.30004-3-Jason@zx2c4.com> <20161214.125612.1361254098267633173.davem@davemloft.net> Cc: David Laight , Netdev , kernel-hardening@lists.openwall.com, Andi Kleen , LKML , Linux Crypto Mailing List From: Hannes Frederic Sowa Message-ID: <0e708ba2-6a4e-013e-597a-62ab32cc240b@stressinduktion.org> Date: Wed, 14 Dec 2016 20:22:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14.12.2016 19:06, Jason A. Donenfeld wrote: > Hi David, > > On Wed, Dec 14, 2016 at 6:56 PM, David Miller wrote: >> Just marking the structure __packed, whether necessary or not, makes >> the compiler assume that the members are not aligned and causes >> byte-by-byte accesses to be performed for words. >> Never, _ever_, use __packed unless absolutely necessary, it pessimizes >> the code on cpus that require proper alignment of types. > > Oh, jimminy cricket, I did not realize that it made assignments > byte-by-byte *always*. So what options am I left with? What > immediately comes to mind are: > > 1) > > struct { > u64 a; > u32 b; > u32 c; > u16 d; > u8 end[]; I don't think this helps. Did you test it? I don't see reason why padding could be left out between `d' and `end' because of the flexible array member? Bye, Hannes