netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: xiaosuo@gmail.com
Cc: neilb@suse.de, shemminger@vyatta.com, netdev@vger.kernel.org
Subject: Re: Undefined behaviour of connect(fd, NULL, 0);
Date: Thu, 01 Apr 2010 00:23:19 -0700 (PDT)	[thread overview]
Message-ID: <20100401.002319.236233308.davem@davemloft.net> (raw)
In-Reply-To: <x2j412e6f7f1003312116rd3b3ba96t31267545efe7660f@mail.gmail.com>

From: Changli Gao <xiaosuo@gmail.com>
Date: Thu, 1 Apr 2010 12:16:43 +0800

> Someone may use connect() to check if the connection is established
> or not. But there is no spec about the addr and addr_len value when
> connect(2) is used this way. Since there is no limit of addr and
> addr_len, and we supports addr is NULL to check the status of socket
> (Although it is buggy). I think we should treat it like a feature,
> and the problem Neil reported is a bug.

This seems logical, but I believe it is wrong.

We already know for a fact that it is guarenteed to not work
reliably for every single kernel in existence in the world
right now.

Every system.  Ones that have been deployed for 10 years as
well as those built from GIT 10 seconds ago.

So you tell me, if you put this into an application that you
wish to deploy anywhere, are you not being completely stupid?

Therefore, if it's illogical to use this in an application, what value
is there in starting to support it now in the kernel?

I'll tell you, the value is absolutely zero.

Yes we need to add the length check, but the behavior we give to this
case as a result, is completely arbitrary.  And I would in fact argue
for a hard error in these cases.

Simply mark it as invalid to call connect() this way.

  parent reply	other threads:[~2010-04-01  7:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-31 11:36 Undefined behaviour of connect(fd, NULL, 0); Neil Brown
2010-03-31 18:49 ` Stephen Hemminger
2010-03-31 20:24   ` Neil Brown
2010-03-31 21:14     ` Stephen Hemminger
2010-03-31 21:17     ` David Miller
2010-03-31 22:07       ` Neil Brown
2010-04-01  3:00         ` Changli Gao
2010-04-01  3:38           ` Neil Brown
2010-04-01  4:16             ` Changli Gao
2010-04-01  5:50               ` Changli Gao
2010-04-01  7:23               ` David Miller [this message]
2010-04-05  9:23                 ` Changli Gao
2010-04-05 15:56                   ` Eric Dumazet
2010-04-05 16:25                     ` Andreas Schwab
2010-04-05 19:25                   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100401.002319.236233308.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=neilb@suse.de \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    --cc=xiaosuo@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).