elf_reader: Add support for XDP frags #1037
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
implements #1036
Since v5.18 of the Linux kernel, it is possible for an XDP program to process packets larger than the physical page of the system. This feature is called XDP frags.
In order for an XDP program to signal that it can process packets with large MTUs, it needs to have the "xdp.frags" annotation instead of "xdp". This new annotation causes the BPF_F_XDP_HAS_FRAGS to be added to the annotated program section of the ELF. This flag in turn causes the verifier to apply extra checks to the code. The commit along with some documentation about the feature can be seen here:
torvalds/linux@c2f2cdb
This commit allows the code to parse the "xdp.frags" annotation and adds the appropriate flag to the program section, along with unit tests for this behaviour. It replicated the functionality of this code: https://elixir.bootlin.com/linux/v6.0/source/tools/lib/bpf/libbpf.c#L6626