From patchwork Tue Aug 30 16:11:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 112362 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 E996FB6F6F for ; Wed, 31 Aug 2011 02:11:53 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755526Ab1H3QLs (ORCPT ); Tue, 30 Aug 2011 12:11:48 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:43960 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755493Ab1H3QLs (ORCPT ); Tue, 30 Aug 2011 12:11:48 -0400 Received: by wyg24 with SMTP id 24so5043434wyg.19 for ; Tue, 30 Aug 2011 09:11:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding; bh=QL+1zoBrybgWCtAVKZCt6BAwLgVTAqfPorFr/5VMno8=; b=NRCzbXMsrNV/Dsr+yX6WUVWRyVNU3N3MdEtw5tAXQ/8wxxbqDAcSBNbsb+9nF9m+mo e6jZSPvyGGb4rf+LFAJcpweL0CK2lWU4axzIBRK/aWdInkx7The58xfUA1dSeAzRoH0p PVmMszzZWfbBL8wjFEXTqmz2dolgvk3MzXk2I= Received: by 10.227.200.84 with SMTP id ev20mr5172509wbb.76.1314720706646; Tue, 30 Aug 2011 09:11:46 -0700 (PDT) Received: from [10.150.51.218] (gw0.net.jmsp.net [212.23.165.14]) by mx.google.com with ESMTPS id ez4sm4750130wbb.12.2011.08.30.09.11.44 (version=SSLv3 cipher=OTHER); Tue, 30 Aug 2011 09:11:45 -0700 (PDT) Subject: Re: Fw: [Bug 42012] New: regression on 2.6.39.3 with socket/bind; still there in 3.0.4 From: Eric Dumazet To: Stephen Hemminger Cc: netdev@vger.kernel.org In-Reply-To: <20110830084742.26c72c20@nehalam.ftrdhcpuser.net> References: <20110830084742.26c72c20@nehalam.ftrdhcpuser.net> Date: Tue, 30 Aug 2011 18:11:48 +0200 Message-ID: <1314720708.2935.29.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Le mardi 30 août 2011 à 08:47 -0700, Stephen Hemminger a écrit : > Interesting? Does the kernel ABI include supporting buggy old proprietary > programs? > > Begin forwarded message: > > Date: Tue, 30 Aug 2011 02:59:32 GMT > From: bugzilla-daemon@bugzilla.kernel.org > To: shemminger@linux-foundation.org > Subject: [Bug 42012] New: regression on 2.6.39.3 with socket/bind; still there in 3.0.4 > > > https://bugzilla.kernel.org/show_bug.cgi?id=42012 > > Summary: regression on 2.6.39.3 with socket/bind; still there > in 3.0.4 > Product: Networking > Version: 2.5 > Kernel Version: 2.6.39.3 - 3.0.4 > Platform: All > OS/Version: Linux > Tree: Mainline > Status: NEW > Severity: normal > Priority: P1 > Component: IPV4 > AssignedTo: shemminger@linux-foundation.org > ReportedBy: r_meier@freenet.de > Regression: Yes > > > Hi, > > the regression has been introduced in 2.6.39.3 with commit > d0733d2e29b652b2e7b1438ececa732e4eed98eb. I experience this with a proprietary > binary program. So I cant give you the source code which fails. This program > used to work before but fails after applying this patch. As far as I understand > the programm is using this code for ipc communication. I have recorded the > strace output of the relevant part of the program. > strace without d0733d2e29b652b2e7b1438ececa732e4eed98eb on kernel 2.6.39.2 > --------------- > 2056 socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4 > 2056 bind(4, {sa_family=AF_UNSPEC, sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, > 16) = 0 > 2056 getsockname(4, {sa_family=AF_INET, sin_port=htons(33537), > sin_addr=inet_addr("0.0.0.0")}, [16]) = 0 > 2056 listen(4, 5) = 0 > 2056 setsockopt(4, SOL_TCP, TCP_NODELAY, [1], 4) = 0 > --------------- > > strace with d0733d2e29b652b2e7b1438ececa732e4eed98eb on kernel 2.6.39.2 > --------------- > 6190 socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4 > 6190 bind(4, {sa_family=AF_UNSPEC, sa_data="\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}, > 16) = -1 EINVAL (Invalid argument) > 6190 dup(2) = 11 > 6190 fcntl64(11, F_GETFL) = 0x8002 (flags O_RDWR|O_LARGEFILE) > 6190 fstat64(11, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 3), ...}) = 0 > 6190 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) > = 0x576ac000 > 6190 _llseek(11, 0, 0xffa03de4, SEEK_CUR) = -1 ESPIPE (Illegal seek) > 6190 write(11, "ERROR: Failed to bind to interne"..., 66) = 66 > 6190 close(11) = 0 > --------------- > > Btw, i have not enough knowledge on this topic to decide whether its the > programs fault or the kernels fault. The binary program is sybyl8.1 from > tripos. > > Best regards, Rene > Yep, we should relax the check and accept AF_UNSPEC. --- 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/af_inet.c b/net/ipv4/af_inet.c index 1b745d4..60fd64e 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -465,7 +465,7 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) if (addr_len < sizeof(struct sockaddr_in)) goto out; - if (addr->sin_family != AF_INET) { + if (addr->sin_family != AF_INET && addr->sin_family != AF_UNSPEC) { err = -EAFNOSUPPORT; goto out; }