From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/1241 Path: news.gmane.org!not-for-mail From: orc Newsgroups: gmane.linux.lib.musl.general Subject: Re: openssh and sendmsg() problem Date: Wed, 27 Jun 2012 02:16:40 +0800 Message-ID: <20120627021640.42af7e4f@sibserver.ru> References: <20120626190146.1c086ed2@sibserver.ru> <20120626120017.GZ17860@port70.net> <20120626160106.GJ544@brightrain.aerifal.cx> <20120627012441.2af9b154@sibserver.ru> <20120626173205.GK544@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1340734720 23600 80.91.229.3 (26 Jun 2012 18:18:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 26 Jun 2012 18:18:40 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-1242-gllmg-musl=m.gmane.org@lists.openwall.com Tue Jun 26 20:18:40 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1SjaLX-0000dn-NJ for gllmg-musl@plane.gmane.org; Tue, 26 Jun 2012 20:18:39 +0200 Original-Received: (qmail 32032 invoked by uid 550); 26 Jun 2012 18:18:39 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 32012 invoked from network); 26 Jun 2012 18:18:35 -0000 In-Reply-To: <20120626173205.GK544@brightrain.aerifal.cx> X-Mailer: claws-mail Xref: news.gmane.org gmane.linux.lib.musl.general:1241 Archived-At: On Tue, 26 Jun 2012 13:32:05 -0400 Rich Felker wrote: > On Wed, Jun 27, 2012 at 01:24:41AM +0800, orc wrote: > > On Tue, 26 Jun 2012 12:01:06 -0400 > > Rich Felker wrote: > > > > > On Tue, Jun 26, 2012 at 02:00:17PM +0200, Szabolcs Nagy wrote: > > > > * orc [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