mailing list of musl libc
 help / color / mirror / code / Atom feed
From: orc <orc@sibserver.ru>
To: musl@lists.openwall.com
Subject: Re: openssh and sendmsg() problem
Date: Wed, 27 Jun 2012 02:16:40 +0800	[thread overview]
Message-ID: <20120627021640.42af7e4f@sibserver.ru> (raw)
In-Reply-To: <20120626173205.GK544@brightrain.aerifal.cx>

On Tue, 26 Jun 2012 13:32:05 -0400
Rich Felker <dalias@aerifal.cx> wrote:

> On Wed, Jun 27, 2012 at 01:24:41AM +0800, orc wrote:
> > On Tue, 26 Jun 2012 12:01:06 -0400
> > Rich Felker <dalias@aerifal.cx> wrote:
> > 
> > > On Tue, Jun 26, 2012 at 02:00:17PM +0200, Szabolcs Nagy wrote:
> > > > * orc <orc@sibserver.ru> [2012-06-26 19:01:46 +0800]:
> > > > > strace shows that sendmsg system call returns EINVAL:
> > > > > 
> > > > > sendmsg(5, {msg_name(0)=NULL, msg_iov(1)=[{"\0", 1}],
> > > > > msg_controllen=24, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_
> > > > > type=SCM_RIGHTS, {4, 385875968}}, msg_flags=0}, 0) = -1 EINVAL
> > > > > (Invalid argument)
> > > > > 
> > > > 
> > > > src/network/sendmsg.c has an ifdef for long>int case
> > > > 
> > > > i don't know what it's supposed to do
> > > 
> > > It's there because the kernel expects certain fields to be long
> > > but POSIX requires them to be int. Thus the syscall wrapper has
> > > to copy the userspace struct (with int and padding) to a
> > > kernel-format struct (with the padding filled with 0's so it's a
> > > valid long).
> > 
> > And how to deal with this? Should it be openssh workaround or fix in
> > musl itself?
> 
> There's nothing to be dealt with here; musl already works around the
> kernel bug. Something is wrong, possibly in this code or elsewhere,
> but I don't know what and I don't see anything obviously wrong with
> the syscall. Can you compare the strace to what happens on glibc?
> 
> Rich

strace from glibc system on this syscall:

sendmsg(5, {msg_name(0)=NULL, msg_iov(1)=[{"\0", 1}], msg_controllen=24, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, {4}}, msg_flags=0}, 0) = 1
sendmsg(5, {msg_name(0)=NULL, msg_iov(1)=[{"\0", 1}], msg_controllen=24, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, {6}}, msg_flags=0}, 0) = 1


  reply	other threads:[~2012-06-26 18:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-26 11:01 orc
2012-06-26 12:00 ` Szabolcs Nagy
2012-06-26 16:01   ` Rich Felker
2012-06-26 17:24     ` orc
2012-06-26 17:32       ` Rich Felker
2012-06-26 18:16         ` orc [this message]
2012-06-26 19:08           ` Rich Felker
2012-06-26 19:39             ` orc
2012-06-26 20:40               ` Szabolcs Nagy
2012-06-26 21:13                 ` Rich Felker
2012-07-01 10:23                   ` orc
2012-06-26 18:32       ` John Spencer
2012-06-26 18:34         ` orc

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=20120627021640.42af7e4f@sibserver.ru \
    --to=orc@sibserver.ru \
    --cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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).