From: Tom Herbert <tom@herbertland.com>
To: Edward Cree <ecree@solarflare.com>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>,
Alexei Starovoitov <ast@kernel.org>
Subject: Re: RFC: Checksum offload and XDP
Date: Tue, 11 Apr 2017 10:26:38 -0700 [thread overview]
Message-ID: <CALx6S34isOnmRxp9V8XZBi02h0qwEUb2g_-rYg_WMnH6hERA7g@mail.gmail.com> (raw)
In-Reply-To: <21cd2caf-56a8-a330-1260-a55ddf07d854@solarflare.com>
On Tue, Apr 11, 2017 at 10:13 AM, Edward Cree <ecree@solarflare.com> wrote:
> On 11/04/17 17:46, Tom Herbert wrote:
>> On Tue, Apr 11, 2017 at 8:55 AM, Edward Cree <ecree@solarflare.com> wrote:
>>> The counter-argument, of course, is that if the XDP program edits fields
>>> that are protected by an Internet checksum (which in practice usually
>>> means anything but the Ethernet header) and then fixes up the checksums
>>> itself, we will edit our diff value twice just to conclude that diff==0.
>>> And maybe we are willing to trust root with the ability to lie to the
>>> kernel about incoming packets' checksum_complete values.
>>>
>> Works for modifying IPv4 or when we are expressly doing a checksum
>> neutral operation, but that doesn't cover the general case. Suppose we
>> simply want to pop an IPv6 header in IPv6/IPv6 encpasulation (there is
>> some push in IETF for expanded use of IPIP tunneling with IPv6 to deal
>> with the inserting EH into a packet problem). In that case the bits
>> being chucked won't sum to zero and they're probably not also the same
>> so the trick for ILA won't work so we need something to rectify the
>> checksum if we're doing XDP_PASS for instance.
> Oh, I agree that if we don't do the rewriting we have to have some way
> for XDP to output a diff. I agree with Daniel that a helper function
> seems the obvious way to get this information out. My "counter-
> argument" was about "user does it" vs. "verifier does it".
>> As far as trust is concerned I don't think that is a major issue. The
>> XDP program can already modify the packet in arbitrary ways so if the
>> checksum is messed up this likely results in unnecessarily dropping
>> packets that actually a good checksum (as opposed to allowing packets
>> with bad checksum to pass).
> I wasn't thinking so much of trust in the security sense (I agree that's
> not much of an argument since XDP programs are privileged already), but
> rather as a reliability thing; it maybe being an easy thing for root to
> get wrong ("hey, this bit only edits Ethernet headers so I don't have
> to fix any checksums, job done. Why is my network broken?")
> So I think we'd have to assume that any program that _doesn't_ call the
> helper function has invalidated any checksum_complete value we had; if
> all the program's changes were balanced, it can call update_csum(0).
>> Note that this only applies to
>> checksum_complete, if we were to allow XDP program to return
>> checksum_unnecessary for instance then it's more a leap of faith that
>> things are always correct.
> Speaking of checksum_unnecessary, it might still be useful for the
> verifier to tell us whether the program contains any writes, since if
> so any drivers using checksum_unnecessary will have to clear it when
> calling XDP or else do conversion to checksum_complete beforehand. (We
> at sfc will probably take the latter path.) But this can be elided if
> the XDP program is known not to do writes or header adjustments,
> potentially speeding things up for the pure drop case.
> (Also we wouldn't require such a program to call update_csum for the
> checksum_complete case, of course.)
>
I don't think we need to do anything special for checksum_unnecessary
other than what we need for checksum_complete. For instance, if we do
return the checksum diff from XDP program then a non-zero value would
be sufficient to invalidate the checksum_unnecessary. Of course, it's
likely this is overkill since in many cases the changes wouldn't
affect checksum_unnecessary setting, but trying to unravel that to
preserve checksum_unnecessary would be a mess. checksum_unnecessary is
considered deprecated anyway!
Tom
> -Ed
next prev parent reply other threads:[~2017-04-11 17:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-10 18:26 RFC: Checksum offload and XDP Tom Herbert
2017-04-11 15:55 ` Edward Cree
2017-04-11 16:43 ` Daniel Borkmann
2017-04-11 18:34 ` Jakub Kicinski
2017-04-11 19:00 ` David Miller
2017-04-11 16:46 ` Tom Herbert
2017-04-11 17:13 ` Edward Cree
2017-04-11 17:26 ` Tom Herbert [this message]
2017-04-11 18:43 ` Jakub Kicinski
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=CALx6S34isOnmRxp9V8XZBi02h0qwEUb2g_-rYg_WMnH6hERA7g@mail.gmail.com \
--to=tom@herbertland.com \
--cc=ast@kernel.org \
--cc=ecree@solarflare.com \
--cc=netdev@vger.kernel.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 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).