Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261861AbUKRRw7 (ORCPT ); Thu, 18 Nov 2004 12:52:59 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262824AbUKRRut (ORCPT ); Thu, 18 Nov 2004 12:50:49 -0500 Received: from clock-tower.bc.nu ([81.2.110.250]:24297 "EHLO localhost.localdomain") by vger.kernel.org with ESMTP id S262804AbUKRRs7 (ORCPT ); Thu, 18 Nov 2004 12:48:59 -0500 Subject: Re: [PATCH] linux 2.9.10-rc1: Fix oops in unix_dgram_sendmsg when using SELinux and SOCK_SEQPACKET From: Alan Cox To: James Morris Cc: Ross Kendall Axe , netdev@oss.sgi.com, Stephen Smalley , lkml , Chris Wright , "David S. Miller" In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1100796294.6019.8.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Thu, 18 Nov 2004 16:45:14 +0000 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1520 Lines: 33 On Iau, 2004-11-18 at 03:42, James Morris wrote: > > Well, my reading of socket(2) suggests that it's _not_ supposed to work. > > sendto() on a non connected socket should fail with ENOTCONN. Not entirely true at all. A network protocol can implement lazy binding and do implicit binding on the sendto. Other protocols might not actually have a receiving component so have no bind() functionality at all. > According to the send(2) man page, we may return EISCONN if the address > and addr length are not NULL and zero. I think that the man page is > incorrect. Posix says that EISCONN means "A destination address was > specified and the socket is already connected", not "A destination address > was specified and the socket is connected mode". i.e. we should only > return EISCONN if the socket is in a connected state. POSIX 1003.1g draft 6.4 permits a user to pass a "null" address for various things. Indeed some systems implement send() as sendto() with a NULL, 0 address component and some user space does likewise. It also has a lot to say on the other cases although I don't think it ever fully got past draft state. You also want to look at TCP/IP illustrated to see some of the assumptions handed down from on high by BSD and which should not be broken. - 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/