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

sys: add type safe Pointer wrapper #1670

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

lmb
Copy link
Collaborator

@lmb lmb commented Feb 6, 2025

Add TypedPointer which is a type safe wrapper around Pointer. This relieves users of the generated bindings from knowing which types are expected. This should make it less likely that we cause a hard to debug panic or crash due to the kernel overwriting runtime memory.

sys.Pointer still exists because there are some cases where we legitimately don't know what type to point at, for example the link info APIs. Map APIs are also unchanged for now because they don't benefit much from converting to TypedPointer[byte].

@github-actions github-actions bot added the breaking-change Changes exported API label Feb 6, 2025
Add TypedPointer which is a type safe wrapper around Pointer. This
relieves users of the generated bindings from knowing which types
are expected. This should make it less likely that we cause a hard
to debug panic or crash due to the kernel overwriting runtime memory.

sys.Pointer still exists because there are some cases where we
legitimately don't know what type to point at, for example the link info
APIs. Map APIs are also unchanged for now because they don't benefit
much from converting to TypedPointer[byte].

Signed-off-by: Lorenz Bauer <[email protected]>
@lmb
Copy link
Collaborator Author

lmb commented Feb 6, 2025

The breaking change is due to replacing ebpf.MapID and ProgramID with a type alias.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Changes exported API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant