From: Sebastian Gottschall <s.gottschall@dd-wrt.com>
To: musl@lists.openwall.com
Subject: Re: recvmsg/sendmsg broken on mips64
Date: Fri, 1 Apr 2016 12:29:35 +0200 [thread overview]
Message-ID: <02844173-9671-d0e9-a291-764b27899f44@dd-wrt.com> (raw)
In-Reply-To: <20160401094919.GT9862@port70.net>
Am 01.04.2016 um 11:49 schrieb Szabolcs Nagy:
> * Sebastian Gottschall <s.gottschall@dd-wrt.com> [2016-04-01 11:16:20 +0200]:
>> I discovered that the whole recvmsg/sendmsg code is broken in mips64
>> but i found also the solution
>> i throwed out all the _pad1, _pad2 crap in socket.h and the corrosponding
>> code in recvmsg.c etc.
>> and used size_t instead. this works at the end. i see no reason for this
>> padding, since using the correct datatype will handle it in the same way.
>> this solution may also work for other 64 bit targets. so proposal is fixing
>> the datatype instead of using int with padding in case of 64 bit
>>
> the padding is needed, i think __BIG_ENDIAN
> or __LITTLE_ENDIAN might not be defined properly.
i checked this already. it was defined properly. the only solution was
using the correct datatypes as defined in the kernel and i also checked
uclibc. it uses also just size_t and nothing else.
the padding results in the same datatype size, just clears the upper and
lower word. but this doesnt seem to be neccessary
> your fix is non-conforming and breaks both abi and api,
> the definition must match
socklen_t would result in the same 64bit datatype instead of int + pad
(which is 64 bit too). so its conforming.
i mached by header variant by reading the kernel headers which uses
size_t instead of socketlen_t
so i assume socketlen_t maches size_t
>
> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
>
>> this here is my working struct in mips64 (big endian)
>>
>> struct msghdr {
>> void *msg_name;
>> socklen_t msg_namelen;
>> struct iovec *msg_iov;
>> size_t msg_iovlen;
>> void *msg_control;
>> size_t msg_controllen;
>> int msg_flags;
>> };
>>
>> struct cmsghdr {
>> size_t cmsg_len;
>> int cmsg_level;
>> int cmsg_type;
>> };
>>
>>
>> Sebastian
next prev parent reply other threads:[~2016-04-01 10:29 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-31 18:20 size_t and int64_t on a new platform Dan Gohman
2016-03-31 19:25 ` Rich Felker
2016-03-31 20:10 ` Szabolcs Nagy
2016-03-31 20:23 ` Alexander Monakov
2016-03-31 20:30 ` Rich Felker
2016-04-01 9:16 ` recvmsg/sendmsg broken on mips64 Sebastian Gottschall
2016-04-01 9:49 ` Szabolcs Nagy
2016-04-01 10:29 ` Sebastian Gottschall [this message]
2016-04-01 11:31 ` Szabolcs Nagy
2016-04-01 11:37 ` Sebastian Gottschall
2016-04-01 12:21 ` Masanori Ogino
2016-04-01 12:42 ` Sebastian Gottschall
2016-04-01 13:17 ` Szabolcs Nagy
2016-04-02 9:52 ` Sebastian Gottschall
2016-04-07 9:48 ` Szabolcs Nagy
2016-04-07 11:42 ` Sebastian Gottschall
2016-04-07 18:46 ` Szabolcs Nagy
2016-04-07 23:33 ` Sebastian Gottschall
2016-04-10 22:18 ` Rich Felker
2016-04-10 22:24 ` Sebastian Gottschall
2016-04-10 22:29 ` Rich Felker
2016-04-10 22:33 ` Sebastian Gottschall
2016-04-11 2:35 ` Rich Felker
2016-04-11 6:35 ` Sebastian Gottschall
2016-04-11 18:32 ` Rich Felker
2016-04-11 19:01 ` Sebastian Gottschall
2016-04-14 14:10 ` Sebastian Gottschall
2016-04-15 16:19 ` Rich Felker
2016-04-21 1:37 ` Rich Felker
2016-04-21 7:22 ` Sebastian Gottschall
2016-04-21 15:36 ` Rich Felker
2016-04-21 17:16 ` Rich Felker
2016-04-21 19:30 ` Sebastian Gottschall
2016-04-21 19:29 ` Sebastian Gottschall
2016-04-01 0:35 ` size_t and int64_t on a new platform Dan Gohman
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=02844173-9671-d0e9-a291-764b27899f44@dd-wrt.com \
--to=s.gottschall@dd-wrt.com \
--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).