Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933508AbcKHMnP (ORCPT ); Tue, 8 Nov 2016 07:43:15 -0500 Received: from mx141.netapp.com ([216.240.21.12]:34498 "EHLO mx141.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933181AbcKHMnJ (ORCPT ); Tue, 8 Nov 2016 07:43:09 -0500 X-IronPort-AV: E=Sophos;i="5.31,462,1473145200"; d="scan'208";a="160764598" Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anna.Schumaker@netapp.com; Subject: Re: net/sunrpc/clnt.c:2773 suspicious rcu_dereference_check() usage! To: Jeff Layton , Ross Zwisler , Trond Myklebust , "J. Bruce Fields" , "David S. Miller" , , , , Andy Adamson References: <20161108054202.GA12406@linux.intel.com> <1478606028.2443.2.camel@redhat.com> <1478606957.2443.8.camel@redhat.com> From: Anna Schumaker Message-ID: <60a0f29b-7a0a-c5e2-0e98-fa9a923dd339@Netapp.com> Date: Tue, 8 Nov 2016 07:42:59 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1478606957.2443.8.camel@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [99.9.112.69] X-ClientProxiedBy: BLUPR15CA0043.namprd15.prod.outlook.com (10.162.95.139) To CY1PR0601MB1643.namprd06.prod.outlook.com (10.163.232.17) X-MS-Office365-Filtering-Correlation-Id: c810e6a3-76b6-461f-11a8-08d407d4c980 X-Microsoft-Exchange-Diagnostics: 1;CY1PR0601MB1643;2:ZxvdR2zRoFMECCUysUUYl+O8fNpcmB4Buo4ljw1k2UiAk/Qx+B1cs7STOcBVgCcI/0zl71qo/gwddTqC/a5BkK78j00gUs7smAD600JiNN7O0VfGJtWNi/EuQLsmyf3Zdf0Z+ANIht7vczRAAn1B5awpwNBDqpl3apz9q8rLjSaLeUeGt+S1I5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+T1gVSJoLUyeacWC9oVyGWEuvN2H+5wdzc3NmDLSTDQPFI3x7NFFWUg48KnHuTUjLcFCdFZ4SRQCCjDPtUXUxKt3TB3mfY9ogAZkU+fmE1Z8u9mxD9R5Tf9XLYKSWPdLvVIw9ht++FO8qXXjNnD5DQJ0mIBHJW8u6IBec6U76+U0ATDtvf3lGBiHV1GcTlzwPmyJ9u0M1nmFKy+yzpCi/gYfqV7oPdSXwXJZP5zfaefPgTUbUAXcqsF+bjyE3q0NVfpYoUGGXuS0H6xZqrkUMtbpiaR/9WA5EL3mQ1/xEmKLYuT9xchsoi6FMLZJRcASR0GbwZJwvL6kuv9g16jIJCG1OkJmDTLFaj+uSNPsru+lAjwdpNOQeIrpR/677FEMjLgpon3cEwYSeo0tdJyJDR8/Xmnpg0Yf0In5VBfPEBoS3e6n1Frgi5XEHwS9QUh/QNHwV3JdCFhlBX0tRn8qIVDjw X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(17755550239193); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6043046)(6042046);SRVR:CY1PR0601MB1643;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0601MB1643; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0601MB1643;4:+4TxTxoILrkbEJJx7V7RnBk2lUqV36kzA9sg3OsYIOPsOiFirb5TmhOhP3apwdYtW6uJ6x1HOdo4gGVxkGXCqB3JstQpysHTpJbqEiCzQVAhcFsBYHPfEVHz1c/fe3iCtD1aUs2eGBdJIWkGX+HZ/0tZNN4aLXKEe3G4SeIHNJzBziSJCZTDCRho/WlsXdLsnwmdyHwfQEHh5XzvVLxFsyf1yzxoKyBSHqSF8KRBvv1EPH3kPaWtPlmXmQaCJdrHjXblQKTacf26vZUHkivHxhFR3ilTHbz0PFbBIM8yLIsGz4BgJenQ3dCxqSK1ZHHZt02rFDfHBRr0Jj8/6HJBJpCZOsT0VzDexpXVfhejoEB+quFI4c9XvIdyKmcyGyygegcMJ01e621odkCMAOQe18/YCM0geL42fhkR3622VQq/Xzn8dy7ku0jQJ5+64zKe+hhmm4H6qNp2jN9sIND/ggUojd163spP2E5MW9fho1M= X-Forefront-PRVS: 01208B1E18 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(7916002)(377424004)(377454003)(189002)(199003)(24454002)(66066001)(65806001)(106356001)(77096005)(6862003)(586003)(83506001)(105586002)(107886002)(3846002)(6116002)(47776003)(65956001)(65826007)(5660300001)(2201001)(2906002)(92566002)(33646002)(6666003)(230700001)(2950100002)(81156014)(6636002)(36756003)(81166006)(8676002)(226693001)(54356999)(64126003)(31696002)(50466002)(86362001)(575784001)(5001770100001)(97736004)(69596002)(101416001)(4001350100001)(42186005)(53416004)(68736007)(305945005)(7846002)(76176999)(189998001)(31686004)(7736002)(23676002)(50986999);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR0601MB1643;H:gouda.nowheycreamery.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTFQUjA2MDFNQjE2NDM7MjM6RFErbnllVFY1Tk80QTBTckYzN0ZoTlFk?= =?utf-8?B?TVl2QXRyZWszRHZ2SXArd1M1VGs3OVB4MEw0K1c1K3JTWkRGaFFtVndJMHhT?= =?utf-8?B?RlJEaWh0emp3OWJRakdGZ0JMQmhraFJ2T0ZYTmlxMDBGbW4wUzVqVnFRVC81?= =?utf-8?B?dEs3NlVaMU1jbWdWVDVIa3pUR2pVVTA5eWVxZjlYOS82dEFYbjgwMFZqMEJq?= =?utf-8?B?eXp2dUgyL0ZWOTNrVWxTME85WnVYTWplOFZGbHJ2eCtVL2pSbDg1V2JKYlU4?= =?utf-8?B?cExzb2s2bzJNbEpNUkY2Y3dBSURFOW1scjhxVHVFdEVlYWdaRmlPcjNuc3h2?= =?utf-8?B?WlFOZlA3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XnLpVyl33iC9O3b55ObvmfqxDS+jYJ3NWEt0q++KFmZ1JFqSfU6n3AIFvwv9rvaZPg==;5:XuFfsixNRid+P6yyHjFAYFUXFGPMV76LlN7mmYppazr8g1U+Btu4u0ZmKYfoKj98iJjqVQwwRhIbMwBAByk7lsHpLrlZ3BhNwIoFqCFlCa/znMwm5RXclzZhvGJ3Evyh0aRC8VEH/+vWKo4L6cc0gWq/mX31vTl3sFTNUfNXK5s=;24:1VYrV+97keNJb9pbBzqy9dcnxxAmigjW/UMn5U+EuOGuVAvC/83ygKbnUxyv1cjXz/MkW2kP/IROUu6kd0WasshIeMqrYAwABAOmbqvmBkU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY1PR0601MB1643;7:VegMX/wsS5tYK9/UmEQ4DCUx6Gfcuf3foKim/8J2AHagFU8Bk1l9ty5a8PgkReFXe+FB/3HzaTWjMlZi/bJqh31OmoJY10Yw9QnEj+Bk3+1Va6EpzeeB95YRYRzsYB/bnVdXjb0w6hPooymaenYOEYzUU2vC4dnWVzEqwnXAQXuxPsgJ89Z/yy/g1mTWmWxv3UmUq919JNjAaPJ4dsQxV0LKfsuVxlJfWCz42ir6HJtjs0W3HcYrjgquGmfle5EnogRxEC6hhvosXNr8XSJoVwOsCp/cGBnMGEktCHSz/UROVSK2afc9NUz0jzhZoMTknPrKf+Zrsd0t6BPNtDC3vtTKWqEo0Pzma5xaYVRTycQ= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2016 12:43:05.0148 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0601MB1643 X-OriginatorOrg: netapp.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4929 Lines: 114 On 11/08/2016 07:09 AM, Jeff Layton wrote: > On Tue, 2016-11-08 at 06:53 -0500, Jeff Layton wrote: >> On Mon, 2016-11-07 at 22:42 -0700, Ross Zwisler wrote: >>> >>> I've got a virtual machine that has some NFS mounts, and with a newly compiled >>> kernel based on v4.9-rc3 I see the following warning/info message: >>> >>> [ 42.750181] =============================== >>> [ 42.750192] [ INFO: suspicious RCU usage. ] >>> [ 42.750203] 4.9.0-rc3-00002-g7b6e7de #3 Not tainted >>> [ 42.750213] ------------------------------- >>> [ 42.750225] net/sunrpc/clnt.c:2773 suspicious rcu_dereference_check() usage! >>> [ 42.750235] >>> [ 42.750235] other info that might help us debug this: >>> [ 42.750235] >>> [ 42.750246] >>> [ 42.750246] rcu_scheduler_active = 1, debug_locks = 0 >>> [ 42.750257] 1 lock held by mount.nfs4/6440: >>> [ 42.750278] #0: >>> [ 42.750299] ( >>> [ 42.750319] &(&nn->nfs_client_lock)->rlock >>> [ 42.750340] ){+.+...} >>> [ 42.750362] , at: >>> [ 42.750372] [] nfs_get_client+0x105/0x5e0 >>> [ 42.750383] >>> [ 42.750383] stack backtrace: >>> [ 42.750394] CPU: 0 PID: 6440 Comm: mount.nfs4 Not tainted 4.9.0-rc3-00002-g7b6e7de #3 >>> [ 42.750406] Hardware name: Intel Corporation PURLEY/PURLEY, BIOS PLYDCRB1.MBH.0096.D23.1608240105 08/24/2016 >>> [ 42.750429] ffffc9000092fa68 ffffffff8150730f ffff88014ec8da40 0000000000000001 >>> [ 42.750452] ffffc9000092fa98 ffffffff810bc3f7 ffff880150b0b228 ffff88015068dbb0 >>> [ 42.750475] ffffc9000092fb38 ffff88014fc99180 ffffc9000092fac0 ffffffff81b243e5 >>> [ 42.750486] Call Trace: >>> [ 42.750498] [] dump_stack+0x67/0x98 >>> [ 42.750511] [] lockdep_rcu_suspicious+0xe7/0x120 >>> [ 42.750524] [] rpc_clnt_xprt_switch_has_addr+0x115/0x150 >>> [ 42.750536] [] nfs_get_client+0x244/0x5e0 >>> [ 42.750549] [] ? nfs_get_client+0xfc/0x5e0 >>> [ 42.750561] [] nfs4_set_client+0x98/0x130 >>> [ 42.750574] [] nfs4_create_server+0x13e/0x390 >>> [ 42.750588] [] nfs4_remote_mount+0x2e/0x60 >>> [ 42.750600] [] mount_fs+0x39/0x170 >>> [ 42.750614] [] vfs_kern_mount+0x6b/0x150 >>> [ 42.750626] [] ? nfs_do_root_mount+0x3c/0xc0 >>> [ 42.750639] [] nfs_do_root_mount+0x86/0xc0 >>> [ 42.750652] [] nfs4_try_mount+0x44/0xc0 >>> [ 42.750664] [] ? get_nfs_version+0x27/0x90 >>> [ 42.750677] [] nfs_fs_mount+0x4ac/0xd80 >>> [ 42.750689] [] ? lockdep_init_map+0x88/0x1f0 >>> [ 42.750701] [] ? nfs_clone_super+0x130/0x130 >>> [ 42.750713] [] ? param_set_portnr+0x70/0x70 >>> [ 42.750726] [] mount_fs+0x39/0x170 >>> [ 42.750740] [] vfs_kern_mount+0x6b/0x150 >>> [ 42.750752] [] do_mount+0x1f1/0xd10 >>> [ 42.750765] [] ? copy_mount_options+0xa1/0x140 >>> [ 42.750777] [] SyS_mount+0x83/0xd0 >>> [ 42.750790] [] do_syscall_64+0x5c/0x130 >>> [ 42.750802] [] entry_SYSCALL64_slow_path+0x25/0x25 >>> >>> This rcu_dereference_check() was introduced by the following commit: >>> >>> commit 39e5d2df959dd4aea81fa33d765d2a5cc67a0512 >>> Author: Andy Adamson >>> Date: Fri Sep 9 09:22:25 2016 -0400 >>> >>> SUNRPC search xprt switch for sockaddr >>> >>> Signed-off-by: Andy Adamson >>> Signed-off-by: Anna Schumaker >>> >>> Thanks, >>> - Ross >> >> Thanks Ross, Hi Ross, Can you try this patch and let me know if it helps: http://git.linux-nfs.org/?p=anna/linux-nfs.git;a=commitdiff;h=bb29dd84333a96f309c6d0f88b285b5b78927058 I'm planning on sending it to Linus soon, so it should be in rc5. Anna >> >> ----------------------8<---------------------- >> bool rpc_clnt_xprt_switch_has_addr(struct rpc_clnt *clnt, >> const struct sockaddr *sap) >> { >> struct rpc_xprt_switch *xps; >> bool ret; >> >> xps = rcu_dereference(clnt->cl_xpi.xpi_xpswitch); >> >> rcu_read_lock(); >> ret = rpc_xprt_switch_has_addr(xps, sap); >> rcu_read_unlock(); >> return ret; >> } >> ----------------------8<---------------------- >> >> Looks like the simple fix is to just move that rcu_dereference call >> inside the rcu_read_lock there. >> > > Hmm...that said though, there are some other suspicious accesses > of xpi_xpswitch. Looks like these are called without the rcu_read_lock > clearly being held: > > rpc_clnt_xprt_switch_add_xprt > rpc_clnt_xprt_switch_put > > ...though it's possible I missed something there. >