From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756979AbcAYKRg (ORCPT ); Mon, 25 Jan 2016 05:17:36 -0500 Received: from mail.us.es ([193.147.175.20]:34524 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756096AbcAYKR2 (ORCPT ); Mon, 25 Jan 2016 05:17:28 -0500 Date: Mon, 25 Jan 2016 11:17:20 +0100 From: Pablo Neira Ayuso To: Herbert Xu Cc: Florian Westphal , Daniel Borkmann , Dmitry Vyukov , "David S. Miller" , Thomas Graf , Ken-ichirou MATSUZAWA , Eric Dumazet , David Herrmann , Nicolas Dichtel , netdev , LKML , syzkaller , Kostya Serebryany , Alexander Potapenko , Sasha Levin , netfilter-devel@vger.kernel.org Subject: Re: net: GPF in netlink_getsockbyportid Message-ID: <20160125101720.GA1360@salvia> References: <20160123192502.GB17729@breakpoint.cc> <56A3DCF7.7000404@iogearbox.net> <20160124001103.GA2748@breakpoint.cc> <20160125100341.GA6735@gondor.apana.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160125100341.GA6735@gondor.apana.org.au> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 25, 2016 at 06:03:41PM +0800, Herbert Xu wrote: > On Sun, Jan 24, 2016 at 01:11:03AM +0100, Florian Westphal wrote: > > Daniel Borkmann wrote: > > > On 01/23/2016 08:25 PM, Florian Westphal wrote: > > > >Dmitry Vyukov wrote: > > > > > > > >[ CC nf-devel, not sure if its nfnetlink fault or NETLINK_MMAP ] > > > > > > > >>The following program causes GPF in netlink_getsockbyportid: > > [..] > > > > > >CONFIG_NETLINK_MMAP and nfnetlink batching strike in unison :-/ > > > > > > > >root cause is in nfnetlink_rcv_batch(): > > > > > > > >296 replay: > > > >297 status = 0; > > > >298 > > > >299 skb = netlink_skb_clone(oskb, GFP_KERNEL); > > > > > > > >The clone op doesn't copy oskb->sk, so we oops in > > > >__netlink_alloc_skb -> netlink_getsockbyportid() when nfnetlink_rcv_batch > > > >tries to send netlink ack. > > > > > > If indeed oskb is the mmap'ed netlink skb, then it's not even allowed > > > to call into skb_clone() > > > > Right, but in this case there is no mmap'd netlink sk involved -- we > > crash when we try to look up dst netlink socket to see if there is an > > mmap'd ring attached. > > > > [ and that code isn't there with CONFIG_NETLINK_MMAP=n ]. > > Let's CC Pablo since he wrote the code in question. I have just sent this patch: http://patchwork.ozlabs.org/patch/572489/