Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932167AbcLKOuk (ORCPT ); Sun, 11 Dec 2016 09:50:40 -0500 Received: from frisell.zx2c4.com ([192.95.5.64]:44527 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753232AbcLKOui (ORCPT ); Sun, 11 Dec 2016 09:50:38 -0500 MIME-Version: 1.0 In-Reply-To: <20161211071501.GA32621@kroah.com> References: <095cac5b-b757-6f4a-e699-8eedf9ed7221@stressinduktion.org> <87vauvhwdu.fsf@alice.fifthhorseman.net> <20161211071501.GA32621@kroah.com> From: "Jason A. Donenfeld" Date: Sun, 11 Dec 2016 15:50:31 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Misalignment, MIPS, and ip_hdr(skb)->version To: linux-mips@linux-mips.org, Netdev , LKML Cc: =?UTF-8?Q?Dan_L=C3=BCdtke?= , Willy Tarreau , =?UTF-8?B?TcOlbnMgUnVsbGfDpXJk?= , Hannes Frederic Sowa , WireGuard mailing list , Greg KH , Felix Fietkau , Jiri Benc , David Miller Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1376 Lines: 33 Hey guys, Thanks for the extremely detailed answers. The main take-away from this is that passing unaligned packets to the networking stack kills kittens. So now it's a question of mitigation. I have three options: 1. Copy the plaintext to three bytes before the start of the cipher text, overwriting parts of the header that aren't actually required. Pros: no changes required, MTU stays small. Cons: scatterwalk's fast paths aren't hit, which means two page table mappings are taken instead of one. I have no idea if this actually matters or will slow down anything relavent. 2. Add 3 bytes to the plaintext header, set to zero, marked for future use. Pros: satisfies IETF mantras and makes unaligned in-place decryption straightforward. Cons: lowers MTU, additional unauthenticated cleartext bits in the header are of limited utility in protocol. 3. Add 3 bytes of padding, set to zero, to the encrypted section just before the IP header, marked for future use. Pros: satisfies IETF mantras, can use those extra bits in the future for interesting protocol extensions for authenticated peers. Cons: lowers MTU, marginally more difficult to implement but still probably just one or two lines of code. Of these, I'm leaning toward (3). Anyway, thanks a lot for the input. "Doing nothing" is no longer under serious consideration, thanks to your messages. Thanks, Jason