From: Stephen Hemminger <shemminger@osdl.org>
To: Rick Jones <rick.jones2@hp.com>
Cc: mark1smi@us.ibm.com, "David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org
Subject: Re: send(), sendmsg(), sendto() not thread-safe
Date: Mon, 15 May 2006 16:35:45 -0700 [thread overview]
Message-ID: <20060515163545.4e3d755a@localhost.localdomain> (raw)
In-Reply-To: <44690C1C.8030101@hp.com>
On Mon, 15 May 2006 16:17:48 -0700
Rick Jones <rick.jones2@hp.com> wrote:
> David S. Miller wrote:
> > From: Mark A Smith <mark1smi@us.ibm.com>
> > Date: Mon, 15 May 2006 14:39:06 -0700
> >
> >
> >>I discovered that in some cases, send(), sendmsg(), and sendto() are not
> >>thread-safe. Although the man page for these functions does not specify
> >>whether these functions are supposed to be thread-safe, my reading of the
> >>POSIX/SUSv3 specification tells me that they should be. I traced the
> >>problem to tcp_sendmsg(). I was very curious about this issue, so I wrote
> >>up a small page to describe in more detail my findings. You can find it at:
> >>http://www.almaden.ibm.com/cs/people/marksmith/sendmsg.html .
>
>
> # ./sendmsgclient localhost
> ERROR! We should have all 0! We don't!
> buff[16384]=1
> buff[16385]=1
> buff[16386]=1
> buff[16387]=1
> buff[16388]=1
> buff[16389]=1
> buff[16390]=1
> buff[16391]=1
> buff[16392]=1
> buff[16393]=1
> That's 10/32768 bad bytes
> # uname -a
> HP-UX tarry B.11.23 U ia64 2397028692 unlimited-user license
>
> Given that the URL above asserts that HP-UX claims atomicity, either
> there is a bug in the UX stack, or perhaps the test? I took a quick
> look at the HP-UX 11iv2 (aka 11.23) manpage for sendmsg and didn't see
> anything about atomicity there - on which manpage(s) or docs was the
> assertion of HP-UX atomicity made?
>
> I presume this is only for "blocking" sockets? I cannot at least off
> the top of my head see how a stack could offer it on non-blocking sockets.
The test seems to be based on sending a big message. In this case,
on non-blocking sockets, the send call will return partial status. The
return from the system call will be less than the number of bytes requested.
>
> > And frankly, BSD defines BSD socket semantics here not some wording in
> > the POSIX standards.
>
> Have BSD socket semantics ever been updated/clarified any any
> quasi-official manner since the popular presence of threads? Or
> are/were Posix/Xopen filling a gap?
>
> rick jones
> -
> 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
next prev parent reply other threads:[~2006-05-15 23:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <OFE8460E54.0C8D85D8-ON8525716F.0074F22F-8825716F.0076D537@us.ibm.com>
2006-05-15 22:49 ` send(), sendmsg(), sendto() not thread-safe David S. Miller
2006-05-15 23:17 ` Rick Jones
2006-05-15 23:35 ` Stephen Hemminger [this message]
2006-05-16 0:02 ` Rick Jones
[not found] <OFA7F8723C.2DDF9383-ON85257170.00014BE5-88257170.00019BEA@us.ibm.com>
2006-05-16 0:43 ` Rick Jones
2006-05-16 1:50 ` Mark A Smith
2006-05-16 16:24 ` Mike Stroyan
2006-05-17 17:25 Benjamin Reed
2006-05-17 18:00 ` Christopher Friesen
2006-05-17 18:21 ` Benjamin Reed
2006-05-17 18:52 ` Rick Jones
2006-05-17 19:06 ` Benjamin Reed
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=20060515163545.4e3d755a@localhost.localdomain \
--to=shemminger@osdl.org \
--cc=davem@davemloft.net \
--cc=mark1smi@us.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=rick.jones2@hp.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).