From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752638AbcGAV0X (ORCPT ); Fri, 1 Jul 2016 17:26:23 -0400 Received: from smtprelay0139.hostedemail.com ([216.40.44.139]:39757 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752450AbcGAV0R (ORCPT ); Fri, 1 Jul 2016 17:26:17 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::::,RULES_HIT:41:355:379:541:800:960:967:968:973:988:989:1260:1263:1277:1311:1313:1314:1345:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2393:2525:2561:2564:2682:2685:2693:2859:2902:2903:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3868:3870:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4321:4605:5007:6117:6119:6261:7903:7974:8599:8777:9025:9164:10004:10400:10848:10913:11026:11658:11914:12043:12050:12114:12296:12438:12517:12519:12555:12679:12783:13161:13229:13439:13868:14093:14096:14097:14181:14196:14659:14721:21063:21067:21080:21325:30012:30034:30045:30054:30060:30064:30075,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: stem91_2360f811ef029 X-Filterd-Recvd-Size: 3879 Date: Fri, 1 Jul 2016 17:24:01 -0400 From: Steven Rostedt To: LKML , "Linux NFS Mailing List" Cc: Trond Myklebust , Jeff Layton , Eric Dumazet , Schumaker Anna , "Andrew Morton" , Fields Bruce , Linus Torvalds Subject: Revert: SUNRPC: xs_sock_mark_closed() does not need to trigger socket autoclose Message-ID: <20160701172401.3ba89015@gandalf.local.home> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A while back, rkhunter reported a "hidden port" on my main server, making me nervous that I had been hacked. Doing lots of debugging, I found that it was happening from xprt code in NFS. I found a way to trigger the bug, which happened because my wife's machine was NFS mounting a directory of my main server. She does this to upload her photos quickly to gallery2. "Warning: Hidden ports found: Port number: TCP:871" A hidden port is one that has no socket connected to it. That is, it's a dead resource. Nothing can ever use that port. It's not something that is "reserved", it's just a leaked bit of info. rkhunter treats this as a possible root kit attack. I did a bisect and found the culprit and worked with the NFS folks who came up with a fix that made rkhunter happy again. Link: http://lkml.kernel.org/r/20150611234929.7b48d314@gandalf.local.home The previous fix was 4876cc779ff5 ("SUNRPC: Ensure we release the TCP socket once it has been closed") Recently, after traveling with my wife, she decided to upload pictures again and mounted the directory, and lo and behold the hidden port re-appeared. I noticed that the mounting of the NFS directory caused this to happen again. I did lots of debugging to see why and asked for help from the NFS folks again. But this time I didn't receive much help. Link: http://lkml.kernel.org/r/20160630085950.61e5c7e0@gandalf.local.home Frustrated, I spent all day bisecting this, and found that this bug was created in the next release. And I even found the commit that causes this bug: 4b0ab51db32e ("SUNRPC: xs_sock_mark_closed() does not need to trigger socket autoclose"). This commit states: "Under all conditions, it should be quite sufficient just to mark the socket as disconnected. It will then be closed by the transport shutdown or reconnect code." Well, this isn't quite correct. And doing a little git blaming, the line that it removed was added by the first commit above that previously fixed my issue. Reverting this commit makes rkhunter and myself quite happy again. I consider this userland breakage, as rkhunter is a userland tool and this commit causes it to report a problem that does not exist. Fixes: 4b0ab51db32e ("SUNRPC: xs_sock_mark_closed() does not need to trigger socket autoclose") Cc: stable@vger.kernel.org # v4.3+ Signed-off-by: Steven Rostedt --- diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 7e2b2fa189c3..5579d13e253f 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -768,6 +768,7 @@ static void xs_sock_mark_closed(struct rpc_xprt *xprt) xs_sock_reset_connection_flags(xprt); /* Mark transport as closed and wake up all pending tasks */ xprt_disconnect_done(xprt); + xprt_force_disconnect(xprt); } /**