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

Add support for program loading flags - breaking change version #3763

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Alan-Jowett
Copy link
Member

Resolves: #3576

As requested by @shankarseal this is a breaking change (to keep the change simple) as the ebpf_extension_data_t wasn't following the correct contract for structures exposed to extensions.

Description

This pull request introduces several enhancements and new features to the eBPF program management system, primarily focusing on adding support for program flags and improving the handling of extension data. Below are the most significant changes grouped by theme:

Enhancements to Program Flags:

  • Added functions to query and set BPF program flags in libbpf.h and libbpf_program.cpp, allowing for better control over program behavior. [1] [2]
  • Updated ebpf_program_t structure to include a flags field in api_internal.h and ebpf_program.c, and added corresponding getter and setter functions. [1] [2] [3]
  • Implemented the ebpf_program_set_flags function in ebpf_api.cpp to set flags on a program during initialization. [1] [2]
  • Added new protocol operation EBPF_OPERATION_PROGRAM_SET_FLAGS to handle setting flags via IOCTL in ebpf_protocol.h and ebpf_core.c. [1] [2]

Enhancements to Extension Data:

  • Expanded the ebpf_extension_data_t struct to include data_size and prog_attach_flags fields in ebpf_extension.h and updated related documentation. [1] [2]
  • Modified ebpf_link.c to handle the new fields in ebpf_extension_data_t, ensuring proper initialization and usage during link creation and attachment. [1] [2] [3] [4] [5]
  • Updated ebpf_windows.h to define new constants for version and size of ebpf_extension_data_t.

API and Export Updates:

  • Added new exports bpf_program__flags and bpf_program__set_flags to ebpfapi/Source.def to expose the new flag functionalities. [1] [2]

Testing and Documentation:

  • Updated helpers.h in end-to-end tests to include ebpf_windows.h and added methods to access client data in the _single_instance_hook class. [1] [2] [3]

These changes collectively enhance the flexibility and control over eBPF programs by introducing a robust mechanism for handling program-specific flags and improving the management of extension data.

Testing

CI/CD

Documentation

Yes.

Installation

No.

dthaler
dthaler previously approved these changes Aug 12, 2024
Copy link
Collaborator

@dthaler dthaler left a comment

Choose a reason for hiding this comment

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

Ok but see suggestions

tests/unit/libbpf_test.cpp Outdated Show resolved Hide resolved
tests/unit/libbpf_test.cpp Show resolved Hide resolved
dthaler
dthaler previously approved these changes Aug 13, 2024
dthaler
dthaler previously approved these changes Aug 29, 2024
@Alan-Jowett Alan-Jowett force-pushed the issue3576_no_backwards_compat branch from d0a9594 to ed4c53f Compare September 4, 2024 15:21
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
@Alan-Jowett Alan-Jowett marked this pull request as draft November 21, 2024 23:54
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.

Add support for program loading flags
3 participants