status of 0.9.29

Atsushi Nemoto anemo at mba.ocn.ne.jp
Wed Oct 18 04:57:45 UTC 2006


On Wed, 11 Oct 2006 21:52:40 +0200, Bernhard Fischer <rep.nop at aon.at> wrote:
> Just as a sidenote.. the ip command (also the busybox applet)
> doesn't work with a uClibc-trunk built for x86_64; `ip addr´ yields
> # strace -o BLAH -s 1024 ip addr
> ptrace: umoven: Input/output error
> OVERRUN: Bad address

I tried with little endian mips64 (n64) and got:

$ ip addr
ip: !!!Remnant of size 504

It looks due to mismatch of struct msghdr.

kernel's include/linux/socket.h:

struct msghdr {
	void	*	msg_name;	/* Socket name			*/
	int		msg_namelen;	/* Length of name		*/
	struct iovec *	msg_iov;	/* Data blocks			*/
	__kernel_size_t	msg_iovlen;	/* Number of blocks		*/
	void 	*	msg_control;	/* Per protocol magic (eg BSD file descriptor passing) */
	__kernel_size_t	msg_controllen;	/* Length of cmsg list */
	unsigned	msg_flags;
};

glibc's sysdeps/unix/sysv/linux/bits/socket.h (and sysdeps/unix/sysv/linux/mips/bits/socket.h):

struct msghdr
  {
    void *msg_name;		/* Address to send to/receive from.  */
    socklen_t msg_namelen;	/* Length of address data.  */

    struct iovec *msg_iov;	/* Vector of data to send/receive into.  */
    size_t msg_iovlen;		/* Number of elements in the vector.  */

    void *msg_control;		/* Ancillary data (eg BSD filedesc passing). */
    size_t msg_controllen;	/* Ancillary data buffer length.  */

    int msg_flags;		/* Flags on received message.  */
  };

And uClibc's libc/sysdeps/linux/{common,mips}/bits/socket.h:

struct msghdr
  {
    void *msg_name;		/* Address to send to/receive from.  */
    socklen_t msg_namelen;	/* Length of address data.  */

    struct iovec *msg_iov;	/* Vector of data to send/receive into.  */
    int msg_iovlen;		/* Number of elements in the vector.  */

    void *msg_control;		/* Ancillary data (eg BSD filedesc passing). */
    socklen_t msg_controllen;	/* Ancillary data buffer length.  */

    int msg_flags;		/* Flags on received message.  */
  };

On 64-bit environment, the size of msg_namelen seems 4 for all, but
the size of msg_iovlen and msg_controllen is 8 for kernel and glibc, 4
for uClibc.

If I copied struct msghdr from glibc, "ip addr" works well.

But, there is a note in libc/sysdeps/linux/common/bits/socket.h.

/* Note: do not change these members to match glibc; these match the
   SuSv3 spec already (e.g. msg_iovlen/msg_controllen).
   http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/socket.h.html */

Then ... what should we do?

---
Atsushi Nemoto



More information about the uClibc mailing list