From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751001AbdAaGVT (ORCPT ); Tue, 31 Jan 2017 01:21:19 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33967 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750913AbdAaGUf (ORCPT ); Tue, 31 Jan 2017 01:20:35 -0500 MIME-Version: 1.0 In-Reply-To: <1485567090.6360.92.camel@edumazet-glaptop3.roam.corp.google.com> References: <1485560124.6360.74.camel@edumazet-glaptop3.roam.corp.google.com> <1485567090.6360.92.camel@edumazet-glaptop3.roam.corp.google.com> From: Cong Wang Date: Mon, 30 Jan 2017 22:19:52 -0800 Message-ID: Subject: Re: net: suspicious RCU usage in nf_hook To: Eric Dumazet Cc: Dmitry Vyukov , David Miller , Alexey Kuznetsov , Eric Dumazet , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , netdev , LKML , Pablo Neira Ayuso , netfilter-devel@vger.kernel.org, syzkaller Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 27, 2017 at 5:31 PM, Eric Dumazet wrote: > On Fri, 2017-01-27 at 17:00 -0800, Cong Wang wrote: >> On Fri, Jan 27, 2017 at 3:35 PM, Eric Dumazet wrote: >> > Oh well, I forgot to submit the official patch I think, Jan 9th. >> > >> > https://groups.google.com/forum/#!topic/syzkaller/BhyN5OFd7sQ >> > >> >> Hmm, but why only fragments need skb_orphan()? It seems like >> any kfree_skb() inside a nf hook needs to have a preceding >> skb_orphan(). > > >> >> Also, I am not convinced it is similar to commit 8282f27449bf15548 >> which is on RX path. > > Well, we clearly see IPv6 reassembly being part of the equation in both > cases. Yeah, of course. My worry is that this problem is more than just IPv6 reassembly. > > I was replying to first part of the splat [1], which was already > diagnosed and had a non official patch. > > use after free is also a bug, regardless of jump label being used or > not. > > I still do not really understand this nf_hook issue, I thought we were > disabling BH in netfilter. It is a different warning from use-after-free, this one is about sleep in atomic context, mutex lock is acquired with RCU read lock held. > > So the in_interrupt() check in net_disable_timestamp() should trigger, > this was the intent of netstamp_needed_deferred existence. > > Not sure if we can test for rcu_read_lock() as well. > The context is process context (TX path before hitting qdisc), and BH is not disabled, so in_interrupt() doesn't catch it. Hmm, this makes me thinking maybe we really need to disable BH in this case for nf_hook()? But it is called in RX path too, and BH is already disabled there.