[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87blqui1zu.fsf@toke.dk>
Date: Thu, 23 Jan 2020 17:14:29 +0100
From: Toke Høiland-Jørgensen <toke@...hat.com>
To: Daniel Borkmann <daniel@...earbox.net>,
Luigi Rizzo <lrizzo@...gle.com>, netdev@...r.kernel.org
Cc: Jesper Dangaard Brouer <hawk@...nel.org>,
"David S. Miller" <davem@...emloft.net>, sameehj@...zon.com
Subject: Re: [PATCH] net-xdp: netdev attribute to control xdpgeneric skb linearization
Daniel Borkmann <daniel@...earbox.net> writes:
> On 1/23/20 10:53 AM, Toke Høiland-Jørgensen wrote:
>> Luigi Rizzo <lrizzo@...gle.com> writes:
>>
>>> Add a netdevice flag to control skb linearization in generic xdp mode.
>>> Among the various mechanism to control the flag, the sysfs
>>> interface seems sufficiently simple and self-contained.
>>> The attribute can be modified through
>>> /sys/class/net/<DEVICE>/xdp_linearize
>>> The default is 1 (on)
>
> Needs documentation in Documentation/ABI/testing/sysfs-class-net.
>
>> Erm, won't turning off linearization break the XDP program's ability to
>> do direct packet access?
>
> Yes, in the worst case you only have eth header pulled into linear
> section. :/
In which case an eBPF program could read/write out of bounds since the
verifier only verifies checks against xdp->data_end. Right?
> In tc/BPF for direct packet access we have bpf_skb_pull_data() helper
> which can pull in up to X bytes into linear section on demand. I guess
> something like this could be done for XDP context as well, e.g.
> generic XDP would pull when non-linear and native XDP would have
> nothing todo (though in this case you end up writing the prog
> specifically for generic XDP with slowdown when you'd load it on
> native XDP where it's linear anyway, but that could/should be
> documented if so).
Yeah, I really don't think this is a good idea; there are enough gotchas
with the difference between generic and native XDP as it is... :/
-Toke
Powered by blists - more mailing lists