Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reallocate packet #3344

Merged
merged 2 commits into from
Apr 4, 2024
Merged

Reallocate packet #3344

merged 2 commits into from
Apr 4, 2024

Conversation

shankarseal
Copy link
Collaborator

Description

Note this PR must be completed after #3326 is merged.

This fixes #3090. A reallocate_packet flag is added to the helper function prototype metadata, to pass onto the PREVAIL verifier, to validate programs that uses any helper function that may change the packet pointers such as xdp_adjust_head.

Testing

A new netsh tests is added that tries to load an unsafe XDP program and fails.

Documentation

Updated extension documentation.

Installation

No changes to installation.

mtfriesen
mtfriesen previously approved these changes Apr 1, 2024
gtrevi
gtrevi previously approved these changes Apr 2, 2024
include/ebpf_program_types.h Outdated Show resolved Hide resolved
libs/execution_context/ebpf_program.c Outdated Show resolved Hide resolved
libs/shared/ebpf_serialize.c Outdated Show resolved Hide resolved
libs/shared/ebpf_serialize.c Outdated Show resolved Hide resolved
libs/shared/ebpf_serialize.c Outdated Show resolved Hide resolved
Alan-Jowett
Alan-Jowett previously approved these changes Apr 3, 2024
matthewige
matthewige previously approved these changes Apr 3, 2024
dthaler
dthaler previously approved these changes Apr 3, 2024
dthaler
dthaler previously approved these changes Apr 3, 2024
@dthaler dthaler added this pull request to the merge queue Apr 4, 2024
Merged via the queue into microsoft:main with commit 73647f8 Apr 4, 2024
85 of 87 checks passed
// fixed.
if (program_info->program_type_specific_helper_prototype[index].flags.reallocate_packet != 0) {
hash_t::append_byte_range(
byte_range, program_info->program_type_specific_helper_prototype[index].flags);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to round each bit field to 8-bit boundary, and add the corresponding bytes to the hash? So for reallocate_packet, we can add 1 byte of data to the hash.

@shankarseal shankarseal deleted the reallocate_packet branch April 23, 2024 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

eBPF does not support helper functions that modify direct packet data
7 participants