DPDK patches and discussions
 help / color / mirror / Atom feed
From: Frederico Cadete <Frederico.Cadete-ext@oneaccess-net.com>
To: "yuanhan.liu@linux.intel.com" <yuanhan.liu@linux.intel.com>,
	"maxime.coquelin@redhat.com" <maxime.coquelin@redhat.com>
Cc: John Sucaet <John.Sucaet@oneaccess-net.com>,
	"jianfeng.tan@intel.com" <jianfeng.tan@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: [dpdk-dev] bug: virtio PMD sends malformed packets for 32-bit processes on 64-bit kernel
Date: Thu, 22 Jun 2017 14:58:20 +0000	[thread overview]
Message-ID: <1498143499.8893.38.camel@oneaccess-net.com> (raw)

Hello,

I believe commit 260aae9a [1] has introduced a regression for the case
of 32-bit process running on a 64-bit kernel.

The commit is effectively casting mbuf->buf_physaddr to uintptr_t
before dereferencing it. It truncates the physical address to the width
of the process's uint, and in the the aforementioned combination this
loses important bits.

I can confirm this under GDB. When virtqueue_enqueue_xmit is filling in
start_dp, I get this result:

(gdb) p /x cookie->buf_physaddr
$5 = 0x12f94a000
(gdb) p /x start_dp[idx].addr
$6 = 0x2f94a080

On my system, I capture the packet that goes out to the host and I see
it has the correct size but the content is all-zeroes.

I would like to propose a patch that would work for all supported
combinations of user/kernel bitwidth  *and* virtio-pci/virtio-user. But
I don't really see how that could work, given virtio-user tries to
store a physical address in rte_mbuf's "void *buf_addr", and this is
not always big enough for a physical address.
Any suggestions on if and how this could be fixed?

Meanwhile, the bug affects dpdk 17.05, 17.02.1 and master. Users not
requiring virtio-user support can avoid it by setting
CONFIG_VIRTIO_USER=n during compilation.

Best regards,
Frederico Cadete

             reply	other threads:[~2017-06-22 14:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-22 14:58 Frederico Cadete [this message]
2017-06-23 15:36 ` Tan, Jianfeng
2017-06-26  8:14   ` Frederico Cadete
2017-06-26 10:15     ` Tan, Jianfeng
2017-06-27 13:32       ` Frederico Cadete
2017-06-28  2:55         ` Tan, Jianfeng

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=1498143499.8893.38.camel@oneaccess-net.com \
    --to=frederico.cadete-ext@oneaccess-net.com \
    --cc=John.Sucaet@oneaccess-net.com \
    --cc=dev@dpdk.org \
    --cc=jianfeng.tan@intel.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=yuanhan.liu@linux.intel.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.
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).