From patchwork Tue Aug 28 22:33:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 180580 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B13912C00CB for ; Wed, 29 Aug 2012 08:33:45 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753479Ab2H1WdK (ORCPT ); Tue, 28 Aug 2012 18:33:10 -0400 Received: from mail-pz0-f46.google.com ([209.85.210.46]:33885 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750988Ab2H1WdI (ORCPT ); Tue, 28 Aug 2012 18:33:08 -0400 Received: by dady13 with SMTP id y13so3615174dad.19 for ; Tue, 28 Aug 2012 15:33:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding; bh=T4RnK36tP2hTTH/fO6zHm20HWHbxFoKIohARZ8tGDSE=; b=rhHwHK/La1n0TQ4t+/ggZgVJJpkVHObG6I0S+6pssniuWCUOyakDS79XelgFmJyLKH Was7K3STf9z+Exmmdzewd/qqhKefJI3X2Bd4BLPVnmgc18aHQ9xOvdsm8JZk7tzRfkG8 d/vg8MnmfCH+vWwrJAQITUXcZzQUCLSjlTkRH18icEWkh3NNkSqWiWNgjY5RT/9jJK1K yOP7/VwBfJvSjKV+eipXTFV1IqcGWa3VlSDrGebc9BrD59b9Mci10l+RU9JfBvh67Vg6 EYCcA/Vuwvoxpm4FCSc/fK6oLT32A4BvniD58FEOPUu6MrFnUQ7c7IcAioSzSkzzys1+ sv5Q== Received: by 10.68.222.170 with SMTP id qn10mr45662155pbc.114.1346193188052; Tue, 28 Aug 2012 15:33:08 -0700 (PDT) Received: from [10.11.14.5] ([38.96.16.75]) by mx.google.com with ESMTPS id pf10sm17863395pbc.56.2012.08.28.15.33.06 (version=SSLv3 cipher=OTHER); Tue, 28 Aug 2012 15:33:06 -0700 (PDT) Subject: Re: route.c:645 suspicious rcu_dereference_check() From: Eric Dumazet To: Pavel Roskin Cc: netdev@vger.kernel.org In-Reply-To: <20120828175734.41b17a6c@mj> References: <20120828175734.41b17a6c@mj> Date: Tue, 28 Aug 2012 15:33:07 -0700 Message-ID: <1346193187.3571.21.camel@edumazet-glaptop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eric Dumazet On Tue, 2012-08-28 at 17:57 -0400, Pavel Roskin wrote: > Hello! > > I've got a warning in the kernel log starting with > > [ 1570.586223] =============================== > [ 1570.586225] [ INFO: suspicious RCU usage. ] > [ 1570.586228] 3.6.0-rc3-wl-main #98 Not tainted > [ 1570.586229] ------------------------------- > [ 1570.586231] /home/proski/src/linux/net/ipv4/route.c:645 suspicious > rcu_dereference_check() usage! [ 1570.586233] > [ 1570.586233] other info that might help us debug this: > [ 1570.586233] > [ 1570.586236] > [ 1570.586236] rcu_scheduler_active = 1, debug_locks = 0 > [ 1570.586238] 2 locks held by Chrome_IOThread/4467: > [ 1570.586240] #0: (slock-AF_INET){+.-...}, at: [] > release_sock+0x2c/0xa0 [ 1570.586253] #1: (fnhe_lock){+.-...}, at: > [] update_or_create_fnhe+0x2c/0x270 [ 1570.586260] > [ 1570.586260] stack backtrace: > [ 1570.586263] Pid: 4467, comm: Chrome_IOThread Not tainted > 3.6.0-rc3-wl-main #98 [ 1570.586265] Call Trace: > [ 1570.586271] [] lockdep_rcu_suspicious+0xfd/0x130 > [ 1570.586275] [] update_or_create_fnhe+0x15c/0x270 > > The dmesg output and the .config file are attached. > Thanks this seems a real bug [PATCH] ipv4: must use rcu protection while calling fib_lookup Following lockdep splat was reported by Pavel Roskin : [ 1570.586223] =============================== [ 1570.586225] [ INFO: suspicious RCU usage. ] [ 1570.586228] 3.6.0-rc3-wl-main #98 Not tainted [ 1570.586229] ------------------------------- [ 1570.586231] /home/proski/src/linux/net/ipv4/route.c:645 suspicious rcu_dereference_check() usage! [ 1570.586233] [ 1570.586233] other info that might help us debug this: [ 1570.586233] [ 1570.586236] [ 1570.586236] rcu_scheduler_active = 1, debug_locks = 0 [ 1570.586238] 2 locks held by Chrome_IOThread/4467: [ 1570.586240] #0: (slock-AF_INET){+.-...}, at: [] release_sock+0x2c/0xa0 [ 1570.586253] #1: (fnhe_lock){+.-...}, at: [] update_or_create_fnhe+0x2c/0x270 [ 1570.586260] [ 1570.586260] stack backtrace: [ 1570.586263] Pid: 4467, comm: Chrome_IOThread Not tainted 3.6.0-rc3-wl-main #98 [ 1570.586265] Call Trace: [ 1570.586271] [] lockdep_rcu_suspicious+0xfd/0x130 [ 1570.586275] [] update_or_create_fnhe+0x15c/0x270 [ 1570.586278] [] __ip_rt_update_pmtu+0x73/0xb0 [ 1570.586282] [] ip_rt_update_pmtu+0x29/0x90 [ 1570.586285] [] inet_csk_update_pmtu+0x2c/0x80 [ 1570.586290] [] tcp_v4_mtu_reduced+0x2e/0xc0 [ 1570.586293] [] tcp_release_cb+0xa4/0xb0 [ 1570.586296] [] release_sock+0x55/0xa0 [ 1570.586300] [] tcp_sendmsg+0x4af/0xf50 [ 1570.586305] [] inet_sendmsg+0x120/0x230 [ 1570.586308] [] ? inet_sk_rebuild_header+0x40/0x40 [ 1570.586312] [] ? sock_update_classid+0xbd/0x3b0 [ 1570.586315] [] ? sock_update_classid+0x130/0x3b0 [ 1570.586320] [] do_sock_write+0xc5/0xe0 [ 1570.586323] [] sock_aio_write+0x53/0x80 [ 1570.586328] [] do_sync_write+0xa3/0xe0 [ 1570.586332] [] vfs_write+0x165/0x180 [ 1570.586335] [] sys_write+0x45/0x90 [ 1570.586340] [] system_call_fastpath+0x16/0x1b Signed-off-by: Eric Dumazet Reported-by: Pavel Roskin --- net/ipv4/route.c | 2 ++ 1 file changed, 2 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 24fd4c5..82cf2a7 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -934,12 +934,14 @@ static u32 __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu) if (mtu < ip_rt_min_pmtu) mtu = ip_rt_min_pmtu; + rcu_read_lock(); if (fib_lookup(dev_net(rt->dst.dev), fl4, &res) == 0) { struct fib_nh *nh = &FIB_RES_NH(res); update_or_create_fnhe(nh, fl4->daddr, 0, mtu, jiffies + ip_rt_mtu_expires); } + rcu_read_unlock(); return mtu; }