All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Cowgill <jcowgill@debian.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [Bug 1643619] [NEW] netlink broken on big-endian mips
Date: Mon, 21 Nov 2016 16:40:13 -0000	[thread overview]
Message-ID: <20161121164013.8062.14361.malonedeb@soybean.canonical.com> (raw)

Public bug reported:

Debian QEMU version 2.7.0, but the bug also appears in current git
master (commit c36ed06e9159)

As the summary says, netlink is completely broken on big-endian mips
running qemu-user.

Running 'ip route' from within a Debian chroot with QEMU simply hangs.
Running amd64 strace on qemu-mips-static shows that it's waiting for a
netlink response from the kernel which never comes.

[...]
[pid 11249] socket(AF_NETLINK, SOCK_RAW|SOCK_CLOEXEC, NETLINK_ROUTE) = 3
[pid 11249] setsockopt(3, SOL_SOCKET, SO_SNDBUF, [32768], 4) = 0
[pid 11249] setsockopt(3, SOL_SOCKET, SO_RCVBUF, [1048576], 4) = 0
[pid 11249] bind(3, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 0
[pid 11249] getsockname(3, {sa_family=AF_NETLINK, nl_pid=11249, nl_groups=00000000}, [12]) = 0
[pid 11249] time([1479745823])          = 1479745823
[pid 11249] sendto(3, {{len=671088640, type=0x1a00 /* NLMSG_??? */, flags=NLM_F_REQUEST|NLM_F_MULTI|0x100, seq=539046744, pid=0}, "\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\10\0\35\0\0\0\1"}, 40, 0, NULL, 0) = 40
[pid 11249] recvmsg(3,

Notice the len in the buffer passed to the kernel is 0x28000000 which
looks byteswapped.

Removing the call to fd_trans_unregister in the NR_socket syscall in
do_syscall fixes this for me, but I don't understand why the fd
translation was immediately unregistered after being registered just
before in do_socket - presumably it was added for a reason.

--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -9331,7 +9331,6 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
 #ifdef TARGET_NR_socket
     case TARGET_NR_socket:
         ret = do_socket(arg1, arg2, arg3);
-        fd_trans_unregister(ret);
         break;
 #endif
 #ifdef TARGET_NR_socketpair

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1643619

Title:
  netlink broken on big-endian mips

Status in QEMU:
  New

Bug description:
  Debian QEMU version 2.7.0, but the bug also appears in current git
  master (commit c36ed06e9159)

  As the summary says, netlink is completely broken on big-endian mips
  running qemu-user.

  Running 'ip route' from within a Debian chroot with QEMU simply hangs.
  Running amd64 strace on qemu-mips-static shows that it's waiting for a
  netlink response from the kernel which never comes.

  [...]
  [pid 11249] socket(AF_NETLINK, SOCK_RAW|SOCK_CLOEXEC, NETLINK_ROUTE) = 3
  [pid 11249] setsockopt(3, SOL_SOCKET, SO_SNDBUF, [32768], 4) = 0
  [pid 11249] setsockopt(3, SOL_SOCKET, SO_RCVBUF, [1048576], 4) = 0
  [pid 11249] bind(3, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 0
  [pid 11249] getsockname(3, {sa_family=AF_NETLINK, nl_pid=11249, nl_groups=00000000}, [12]) = 0
  [pid 11249] time([1479745823])          = 1479745823
  [pid 11249] sendto(3, {{len=671088640, type=0x1a00 /* NLMSG_??? */, flags=NLM_F_REQUEST|NLM_F_MULTI|0x100, seq=539046744, pid=0}, "\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\10\0\35\0\0\0\1"}, 40, 0, NULL, 0) = 40
  [pid 11249] recvmsg(3,

  Notice the len in the buffer passed to the kernel is 0x28000000 which
  looks byteswapped.

  Removing the call to fd_trans_unregister in the NR_socket syscall in
  do_syscall fixes this for me, but I don't understand why the fd
  translation was immediately unregistered after being registered just
  before in do_socket - presumably it was added for a reason.

  --- a/linux-user/syscall.c
  +++ b/linux-user/syscall.c
  @@ -9331,7 +9331,6 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
   #ifdef TARGET_NR_socket
       case TARGET_NR_socket:
           ret = do_socket(arg1, arg2, arg3);
  -        fd_trans_unregister(ret);
           break;
   #endif
   #ifdef TARGET_NR_socketpair

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1643619/+subscriptions

             reply	other threads:[~2016-11-21 16:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-21 16:40 James Cowgill [this message]
2016-11-21 17:43 ` [Qemu-devel] [Bug 1643619] Re: netlink broken on big-endian mips James Cowgill
2016-11-27  9:27 ` Johan van Zoomeren
2016-11-27  9:29 ` Johan van Zoomeren
2016-11-27  9:40 ` Johan van Zoomeren
2017-03-19 23:41 ` James Clarke
2017-07-21 14:15 ` Thomas Huth

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=20161121164013.8062.14361.malonedeb@soybean.canonical.com \
    --to=jcowgill@debian.org \
    --cc=1643619@bugs.launchpad.net \
    --cc=qemu-devel@nongnu.org \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.