Re: [PATCH bpf] xsk: Fix unaligned descriptor validation

From: Martin KaFai Lau
Date: Wed Apr 05 2023 - 15:40:37 EST


On 4/3/23 11:25 PM, Magnus Karlsson wrote:
On Mon, 3 Apr 2023 at 16:38, Kal Conley <kal.conley@xxxxxxxxxxx> wrote:

Make sure unaligned descriptors that straddle the end of the UMEM are
considered invalid. Currently, descriptor validation is broken for
zero-copy mode which only checks descriptors at page granularity.
Descriptors that cross the end of the UMEM but not a page boundary may
be therefore incorrectly considered valid. The check needs to happen
before the page boundary and contiguity checks in
xp_desc_crosses_non_contig_pg. Do this check in
xp_unaligned_validate_desc instead like xp_check_unaligned already does.

Thanks for catching this Kal.

Acked-by: Magnus Karlsson <magnus.karlsson@xxxxxxxxx>

Is this case covered by an existing test?