Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935232AbcKNRsI (ORCPT ); Mon, 14 Nov 2016 12:48:08 -0500 Received: from mail-pf0-f181.google.com ([209.85.192.181]:34991 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935053AbcKNRsD (ORCPT ); Mon, 14 Nov 2016 12:48:03 -0500 Subject: Re: [PATCH v3] ip6_output: ensure flow saddr actually belongs to device To: Hannes Frederic Sowa , "Jason A. Donenfeld" , Netdev , WireGuard mailing list , LKML , YOSHIFUJI Hideaki References: <27cccef1-06d9-74b3-5b8a-912850119a76@cumulusnetworks.com> <20161113232813.28926-1-Jason@zx2c4.com> <1479141867.3723362.787321689.4A3DCFD6@webmail.messagingengine.com> <7d8c0210-9132-c755-9053-6ec19409e343@stressinduktion.org> <7779da88-08dc-0adb-42dd-8e00502693df@stressinduktion.org> From: David Ahern Message-ID: <0214eaf8-70c6-5a37-cddd-faa1c4268871@cumulusnetworks.com> Date: Mon, 14 Nov 2016 10:48:01 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <7779da88-08dc-0adb-42dd-8e00502693df@stressinduktion.org> 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 Content-Length: 1231 Lines: 26 On 11/14/16 10:33 AM, Hannes Frederic Sowa wrote: >>>>> I just also quickly read up on the history (sorry was travelling last >>>>> week) and wonder if you ever saw a user space facing bug or if this is >>>>> basically some difference you saw while writing out of tree code? >>>> >>>> I checked the userspace API this morning. bind and cmsg for example check that the address is valid with calls to ipv6_chk_addr. >>> >>> Hmm, so it fixes no real bug. >>> >>> Because of translations of flowi6_oif we actually can't do a correct >>> check of source address for cases like the one I outlined above? Hmm, >>> maybe we should simply depend on user space checks. >> >> I believe Jason's case is forwarding path and the ipv6_stub->ipv6_dst_lookup API. > > It is not a kernel API, because we don't support something like that for > external kernel modules. We basically exported ipv6_dst_lookup to allow > some IPv4 code to do ipv6 stunts when the IPv6 module is loaded. ;) ??? ipv6_stub is exported for modules (EXPORT_SYMBOL_GPL(ipv6_stub)). ipv6_stub->ipv6_dst_lookup is used by several modules -- geneve, tipc, vxlan, mpls -- for IPv6 lookups, not IPv4 code do IPv6 stunts. So how do you say that is not an exported kernel API?