[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210930075959.587f9905@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Thu, 30 Sep 2021 07:59:59 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Niklas Söderlund
<niklas.soderlund@...igine.com>
Cc: Simon Horman <simon.horman@...igine.com>,
David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
oss-drivers@...igine.com, Yu Xiao <yu.xiao@...igine.com>,
Yinjun Zhang <yinjun.zhang@...igine.com>,
Louis Peens <louis.peens@...igine.com>
Subject: Re: [PATCH net] nfp: bpf: Add an MTU check before offloading BPF
On Thu, 30 Sep 2021 16:46:34 +0200 Niklas Söderlund wrote:
> When the MTU is changed after the program is offloaded the check in
> nfp_bpf_check_mtu() is consulted and as it checks the MTU differently
> and fails the change. Maybe we should align this the other way around
> and update the check in nfp_bpf_check_mtu() to match the one in
> nfp_net_bpf_load()?
That sounds reasonable. Although I don't remember how reliable the
max_pkt_offset logic is in practice (whether it's actually capable
of finding the max offset for realistic programs or it's mostly going
to be set to MAX).
> On a side note the check in nfp_net_bpf_load() allows for BPF programs
> to be offloaded that do access data beyond the CMT size limit provided
> the MTU is set below the CMT threshold value.
Right, because of variable length offsets verifier will not be able to
estimate max_pkt_offset.
> There should be no real harm in this as the verifier forces bounds
> check so with a MTU small enough it should never happen. But maybe we
> should add a check for this too to prevent such a program to be
> loaded in the first place.
Powered by blists - more mailing lists