From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/9885 Path: news.gmane.org!not-for-mail From: Sebastian Gottschall Newsgroups: gmane.linux.lib.musl.general Subject: Re: recvmsg/sendmsg broken on mips64 Date: Mon, 11 Apr 2016 00:33:07 +0200 Message-ID: References: <91bfe81c-73c4-9b25-6d9b-a97d4ee54e89@dd-wrt.com> <20160401131712.GV9862@port70.net> <4445e7a7-19f3-aa7c-04dc-3e329ef7fdac@dd-wrt.com> <20160407094806.GE9862@port70.net> <20160407184643.GI9862@port70.net> <2656e404-f225-cd95-3989-a48df486d914@dd-wrt.com> <20160410221812.GP21636@brightrain.aerifal.cx> <20160410222947.GQ21636@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1460327592 21481 80.91.229.3 (10 Apr 2016 22:33:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 10 Apr 2016 22:33:12 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-9898-gllmg-musl=m.gmane.org@lists.openwall.com Mon Apr 11 00:33:11 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1apNup-00069I-6W for gllmg-musl@m.gmane.org; Mon, 11 Apr 2016 00:33:11 +0200 Original-Received: (qmail 28085 invoked by uid 550); 10 Apr 2016 22:33:09 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 28062 invoked from network); 10 Apr 2016 22:33:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dd-wrt.com; s=mikd; h=Subject:Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:To; bh=xuTp/kyZNI6B6nHNy2FFao0SoSAZU7cHirN55BUkHkY=; b=MAfD+Oq8EzzCDa0h2ltCAuw8C+8XcusCPsBY4+3nO0bOy8iLjTEDIkTAW2kpcaSR3/ftFTe5hFnWrHKFU2bWhX9cvnsyXm4vpwPKMdKZ+M213QYlEVYmgCHkrC6QCNX+XqB0YKAIxyrzJnA8v6YNITen4SiA/xPs4JuKIoEFW4w=; User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 In-Reply-To: <20160410222947.GQ21636@brightrain.aerifal.cx> X-SA-Exim-Connect-IP: 217.234.132.69 X-SA-Exim-Mail-From: s.gottschall@dd-wrt.com X-Spam-Checker-Version: SpamAssassin 3.1.9 (2007-02-13) on webmail.newmedia-net.de X-Spam-Level: X-Spam-Status: No, score=-2.5 required=4.0 tests=ALL_TRUSTED,BAYES_00, DNS_FROM_AHBL_RHSBL,RATWARE_GECKO_BUILD autolearn=no version=3.1.9, No X-SA-Exim-Version: 4.2.1 (built Thu, 26 May 2011 15:22:33 +0200) X-SA-Exim-Scanned: Yes (on webmail.newmedia-net.de) X-NMN-MailScanner-Information: Please contact the ISP for more information X-NMN-MailScanner-ID: 1apNuX-0004GW-2L X-NMN-MailScanner: Found to be clean X-NMN-MailScanner-From: s.gottschall@dd-wrt.com X-Received: from [217.234.132.69] (helo=[10.88.193.128]) by webmail.newmedia-net.de with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.72) (envelope-from ) id 1apNuX-0004GW-2L for musl@lists.openwall.com; Mon, 11 Apr 2016 00:32:53 +0200 Xref: news.gmane.org gmane.linux.lib.musl.general:9885 Archived-At: Am 11.04.2016 um 00:29 schrieb Rich Felker: > On Mon, Apr 11, 2016 at 12:24:49AM +0200, Sebastian Gottschall wrote: >>> I think what nsz was asking for, and what I'd like to see, is a way to >>> reproduce the bug. I'm going to try building iproute2 for mips64 and >>> running it on a prebuilt kernel from Aboriginal Linux under >>> qemu-system-mips64, but I don't know what specific commands are needed >>> to hit the affected code path. >> any command since all is netlink based >> ip add add 192.168.1.1/24 dev eth0 >> >> yo will see that nothing will happen. ip will just return a error >> message (i wrote this message already in the first entry on this >> mailinglist) >> "EOF on netlink" is the error which is shown > OK, I'll try this. > >>>> its all resulting in the same failing recvmsg / sendmsg call.. so >>>> yes libnetlink.c does not work with musl on mips64 (it does work on >>>> x64 and everything else, just not mips64) unless the hack i offered >>>> was applied which again fixed all. >>>> before you ask again for a problem description, just read again. it >>>> wont change the description if you ask again and just makes people >>>> tired on this list. >>> Both versions of the struct (musl's and your modified one that matches >>> the kernel) have the exact same layout, but due to having a member >>> with 64-bit type, yours has 8-byte alignment and musl's only has >>> 4-byte alignment. This means, at least: >>> >>> 1. When musl's sendmsg.c makes its copy to zero out the padding, the >>> copy may not be correctly aligned for 64-bit writes, and the kernel >>> faults or manually produces an error for this case, causing the >>> whole operation to fail. However, I don't see where iproute2 is >>> actually passing control messages to sendmsg, so while this is a >>> problem, I don't think it's the cause. Maybe I'm missing the >>> affected call point; this is why I'd like steps to reproduce the >>> issue so I can see it. >>> >>> 2. iproute2's libnetlink.c's rtnl_listen function does not properly >>> declare its cmsgbuf with the alignment of cmsghdr; it has type >>> char[] so the compiler is free not to align it at all. This is >>> presumably a bug in iproute2, but I can't find any good >>> documentation (in the standards or Linux-specific) for how you're >>> supposed to allocate this space, so maybe the kernel is able to >>> handle aligning the buffer itself. I don't see any way the >>> alignment of musl's cmsghdr type affects recvmsg though. >>> >>> Maybe there are other effects I'm missing? I'll follow up again once I >>> get a test build/run of iproute2 and let you know whether I can see >>> the problem. >> okay. if you need a remote access to a octeon system using musl (my >> fixed variant), just tell me. > That would be really helpful. Something's wrong with the userspace for > the Aboriginal mips64 binaries (SIGBUS in init) and debugging that > would be a big distraction. > > BTW do you have gdb and strace available? not on the system itself. i'm not sure if strace works on mips64. never tried it. but you're free to copy any binary to the /tmp dir. it has 2 gb ram. so enough space for static binaries if you want to play with. i will send you the ssh data in a private email > > Rich >