netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* BUG in xennet_make_frags with paged skb data
@ 2014-11-06 21:49 Seth Forshee
  2014-11-07  9:25 ` [Xen-devel] " Zoltan Kiss
  2014-11-07 10:44 ` David Vrabel
  0 siblings, 2 replies; 15+ messages in thread
From: Seth Forshee @ 2014-11-06 21:49 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Konrad Rzeszutek Wilk, Boris Ostrovsky,
	David Vrabel, Stefan Bader, Jay Vosburgh, linux-kernel, xen-devel,
	seth.forshee

We've had several reports of hitting the following BUG_ON in
xennet_make_frags with 3.2 and 3.13 kernels (I'm currently awaiting
results of testing with 3.17):

        /* Grant backend access to each skb fragment page. */
        for (i = 0; i < frags; i++) {
                skb_frag_t *frag = skb_shinfo(skb)->frags + i;
                struct page *page = skb_frag_page(frag);

                len = skb_frag_size(frag);
                offset = frag->page_offset;

                /* Data must not cross a page boundary. */
                BUG_ON(len + offset > PAGE_SIZE<<compound_order(page));

When this happens the page in question is a "middle" page in a compound
page (i.e. it's a tail page but not the last tail page), and the data is
fully contained within the compound page. The data does however cross
the hardware page boundary, and since compound_order evaluates to 0 for
tail pages the check fails.

In going over this I've been unable to determine whether the BUG_ON in
xennet_make_frags is incorrect or the paged skb data is wrong. I can't
find that it's documented anywhere, and the networking code itself is a
bit ambiguous when it comes to compound pages. On the one hand
__skb_fill_page_desc specifically handles adding tail pages as paged
data, but on the other hand skb_copy_bits kmaps frag->page.p which could
fail with data that extends into another page.

Can anyone explain what the rules are here? My best guess based on
skb_copy_bits is that paged data should never cross the hardware page
boundary, but I'm not really sure how all of this works out when dealing
with compound pages.

Thanks,
Seth

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-11-10 17:20 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-06 21:49 BUG in xennet_make_frags with paged skb data Seth Forshee
2014-11-07  9:25 ` [Xen-devel] " Zoltan Kiss
2014-11-07 11:22   ` Eric Dumazet
2014-11-07 12:15     ` Stefan Bader
2014-11-07 12:21       ` Zoltan Kiss
2014-11-07 12:28         ` Stefan Bader
2014-11-07 10:44 ` David Vrabel
2014-11-07 11:08   ` Stefan Bader
2014-11-07 14:51     ` [Xen-devel] " Zoltan Kiss
2014-11-10 14:35   ` Seth Forshee
2014-11-10 14:41     ` David Vrabel
2014-11-10 16:39       ` [Xen-devel] " Zoltan Kiss
2014-11-10 16:42         ` David Vrabel
2014-11-10 17:02           ` Eric Dumazet
2014-11-10 17:20           ` Frediano Ziglio

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).