netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: romieu@fr.zoreil.com
Cc: eric.dumazet@gmail.com, nhorman@tuxdriver.com, netdev@vger.kernel.org
Subject: Re: [PATCH RFC] r8169: straighten out overlength frame detection (v3)
Date: Wed, 06 Jan 2010 17:15:14 -0800 (PST)	[thread overview]
Message-ID: <20100106.171514.104051841.davem@davemloft.net> (raw)
In-Reply-To: <20100107010122.GA5872@electric-eye.fr.zoreil.com>

From: Francois Romieu <romieu@fr.zoreil.com>
Date: Thu, 7 Jan 2010 02:01:22 +0100

> entry 024 opts1 0x20803ff0 opts2 0x00000000 size 1536 <- problem starts here.
> entry 025 opts1 0x00803ff0 opts2 0x00000000 size 1536    The lines below are
> entry 026 opts1 0x00803ff0 opts2 0x00000000 size 1536    not meaningful.
> entry 027 opts1 0x00803ff0 opts2 0x00000000 size 1536
> 
> The driver will mess things up because it needs the desc->opts1.RxRes bit
> to be set before it claims that the packet is broken. Since this condition
> is not fulfilled when opts1 = 0x20803ff0, the problem goes unnoticed and
> it can be further exploited.
> 
> AFAIUI, if the driver does not lose sync (to use the paper's words), i.e.
> if it notices the condition above and stops / resets the chipset, there
> is not much to exploit.

Thanks for doing this test.

Also note the FirstFrag and LastFrag bits.  Here we see FirstFrag set,
and this indicates a fragmented frame.

The fix seems to be to simply check the error bits unconditionally, or
alternatively validate the FirstFrag and LastFrag bits
unconditionally.

I don't even think we need to reset the chip, just do what the code
does now and recycle the buffer back to the chip as we currently do
when RxRes is set.  We can keep a state bit around, showing that we
saw the beginning of a fragmented frame, and we recycle buffers back
to the chip when in state state until we see LastFrag.

That should work, right?

In your trace, we're merely seeing the >1536 frame being chopped
into a fragmented frame by the device.  The first one has FirstFrag
set and the remaining (that you've shown) have neither bit set.

Did you eventually get a descriptor with LastFrag (bit 28) set?

  reply	other threads:[~2010-01-07  1:15 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-28 19:48 [PATCH RFC] r8169: straighten out overlength frame detection Neil Horman
2009-12-28 19:50 ` Neil Horman
2009-12-28 21:31   ` François romieu
2009-12-28 23:49     ` Neil Horman
2009-12-29  0:24     ` David Dillow
2009-12-29  1:20       ` Neil Horman
2009-12-29  0:51     ` Ben Hutchings
2009-12-29  1:16       ` Neil Horman
2009-12-29  1:29         ` Ben Hutchings
2009-12-29 15:35     ` Neil Horman
2010-01-05 13:57 ` [PATCH RFC] r8169: straighten out overlength frame detection (v3) Neil Horman
2010-01-05 15:15   ` Eric Dumazet
2010-01-05 20:40     ` David Miller
2010-01-05 21:38       ` Neil Horman
2010-01-05 21:45         ` David Miller
2010-01-05 22:04           ` Neil Horman
2010-01-07  1:01       ` Francois Romieu
2010-01-07  1:15         ` David Miller [this message]
2010-01-08 23:48           ` Francois Romieu
2010-01-09  0:02             ` David Miller
2010-01-10  1:57               ` Ben Hutchings
2010-01-10 23:50                 ` Francois Romieu
2010-01-11  6:45                   ` David Miller
2010-01-12  0:16                     ` Francois Romieu
2010-01-12  6:24                       ` David Miller
2010-01-26 22:07                         ` Brandon Philips
2010-01-30 21:50                       ` Neil Horman
2010-02-18 19:37                         ` Brandon Philips

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=20100106.171514.104051841.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=romieu@fr.zoreil.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).