Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752391AbbFLDtf (ORCPT ); Thu, 11 Jun 2015 23:49:35 -0400 Received: from smtprelay0098.hostedemail.com ([216.40.44.98]:60045 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750891AbbFLDtc convert rfc822-to-8bit (ORCPT ); Thu, 11 Jun 2015 23:49:32 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 30,2,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::,RULES_HIT:41:152:196:355:379:541:960:966:967:973:982:988:989:1260:1263:1277:1311:1313:1314:1345:1437:1513:1515:1516:1518:1521:1534:1543:1593:1594:1622:1711:1730:1747:1777:1792:2196:2199:2393:2525:2538:2553:2565:2682:2685:2859:2892:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3355:3834:3865:3866:3867:3868:3870:3871:3872:3873:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4321:4385:4560:4605:4647:5007:6119:6120:6261:6996:6997:7875:7901:7903:8599:8985:9025:9040:9388:10007:10400:10848:11026:11232:11233:11473:11658:11852:11914:12043:12050:12296:12517:12519:12555:12660:12663:12740:13161:13180:13229:13870:14096:14097:14394:21063:21080:21088,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:1:0 X-HE-Tag: chair83_8d32e52f6ab25 X-Filterd-Recvd-Size: 3938 Date: Thu, 11 Jun 2015 23:49:29 -0400 From: Steven Rostedt To: Trond Myklebust Cc: Anna Schumaker , linux-nfs@vger.kernel.org, netdev@vger.kernel.org, LKML , Andrew Morton Subject: [REGRESSION] NFS is creating a hidden port (left over from xs_bind() ) Message-ID: <20150611234929.7b48d314@gandalf.local.home> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3190 Lines: 94 I recently upgraded my main server to 4.0.4 from 3.19.5 and rkhunter started reporting a hidden port on my box. Running unhide-tcp I see this: # unhide-tcp Unhide-tcp 20121229 Copyright © 2012 Yago Jesus & Patrick Gouin License GPLv3+ : GNU GPL version 3 or later http://www.unhide-forensics.info Used options: [*]Starting TCP checking Found Hidden port that not appears in ss: 946 [*]Starting UDP checking This scared the hell out of me as I'm thinking that I have got some kind of NSA backdoor hooked into my server and it is monitoring my plans to smuggle Kinder Überraschung into the USA from Germany. I panicked! Well, I wasted the day writing modules to first look at all the sockets opened by all processes (via their file descriptors) and posted their port numbers. http://rostedt.homelinux.com/private/tasklist.c But this port wasn't there either. Then I decided to look at the ports in tcp_hashinfo. http://rostedt.homelinux.com/private/portlist.c This found the port but no file was connected to it, and worse yet, when I first ran it without using probe_kernel_read(), it crashed my kernel, because sk->sk_socket pointed to a freed socket! Note, each boot, the hidden port is different. Finally, I decided to bring in the big guns, and inserted a trace_printk() into the bind logic, to see if I could find the culprit. After fiddling with it a few times, I found a suspect: kworker/3:1H-123 [003] ..s. 96.696213: inet_bind_hash: add 946 Bah, it's a kernel thread doing it, via a work queue. I then added a trace_dump_stack() to find what was calling this, and here it is: kworker/3:1H-123 [003] ..s. 96.696222: => inet_csk_get_port => inet_addr_type => inet_bind => xs_bind => sock_setsockopt => __sock_create => xs_create_sock.isra.18 => xs_tcp_setup_socket => process_one_work => worker_thread => worker_thread => kthread => kthread => ret_from_fork => kthread I rebooted, and examined what happens. I see the kworker binding that port, and all seems well: # netstat -tapn |grep 946 tcp 0 0 192.168.23.9:946 192.168.23.22:55201 ESTABLISHED - But waiting for a bit, the connection goes into a TIME_WAIT, and then it just disappears. But the bind to the port does not get released, and that port is from then on, taken. This never happened with my 3.19 kernels. I would bisect it but this is happening on my main server box which I usually only reboot every other month doing upgrades. It causes too much disturbance for myself (and my family) as when this box is offline, basically the rest of my machines are too. I figured this may be enough information to see if you can fix it. Otherwise I can try to do the bisect, but that's not going to happen any time soon. I may just go back to 3.19 for now, such that rkhunter stops complaining about the hidden port. If you need anymore information, let me know. -- Steve -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/