Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754154AbcLNR4x (ORCPT ); Wed, 14 Dec 2016 12:56:53 -0500 Received: from shards.monkeyblade.net ([184.105.139.130]:54708 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753566AbcLNR4v (ORCPT ); Wed, 14 Dec 2016 12:56:51 -0500 Date: Wed, 14 Dec 2016 12:56:12 -0500 (EST) Message-Id: <20161214.125612.1361254098267633173.davem@davemloft.net> To: Jason@zx2c4.com Cc: David.Laight@aculab.com, netdev@vger.kernel.org, kernel-hardening@lists.openwall.com, ak@linux.intel.com, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Subject: Re: [PATCH v2 3/4] secure_seq: use siphash24 instead of md5_transform From: David Miller In-Reply-To: References: <20161214035927.30004-1-Jason@zx2c4.com> <20161214035927.30004-3-Jason@zx2c4.com> X-Mailer: Mew version 6.7 on Emacs 25.1 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Wed, 14 Dec 2016 08:57:31 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 748 Lines: 16 From: "Jason A. Donenfeld" Date: Wed, 14 Dec 2016 13:53:10 +0100 > In all current uses of __packed in the code, I think the impact is > precisely zero, because all structures have members in descending > order of size, with each member being a perfect multiple of the one > below it. The __packed is therefore just there for safety, in case > somebody comes in and screws everything up by sticking a u8 in > between. 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.