Is it possible to read from a dynamic offset in a packet?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi XDPeople!

I've been having great success with reading data from fixed offsets in
a packet/ethernet frame. But every time I try to read from a dynamic
offset (e.g. read the last byte in the packet by using the packet
length in the IP/UDP headers). It looks like once I add a register to
a packet pointer, the range is reset to 0, and no amount of
comparisons will restore a range.

Looking through the verifier code, I believe I found where the range
is getting set to 0
(https://elixir.bootlin.com/linux/latest/source/kernel/bpf/verifier.c#L2695),
and it looks like the risk of overflow
(https://elixir.bootlin.com/linux/latest/source/kernel/bpf/verifier.c#L3267)
is why the range doesn't get updated by later comparisons.

Is there a way to do a read from a packet at a dynamic offset? If not,
is that something that could potentially be added to the verifier? It
feels like `if (packet_start <= packet_start + offset && packet_end >
packet_start + offset)` is something that should be verifiable as
safe, even with potential overflow in `packet_start + offset`?

Thank you!
--Zvi



[Index of Archives]     [Linux Networking Development]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite Campsites]

  Powered by Linux