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

program: fix LINUX_HAS_SYSCALL_WRAPPER use with bpf_tracing.h #1201

Closed
wants to merge 1 commit into from

Conversation

lmb
Copy link
Collaborator

@lmb lmb commented Nov 3, 2023

bpf_tracing.h defines LINUX_HAS_SYSCALL_WRAPPER as a boolean:

extern _Bool LINUX_HAS_SYSCALL_WRAPPER __kconfig;

Our kconfig fixup code currently expects a uint32 and therefore bails out with the following error:

resolve .kconfig: variable LINUX_HAS_SYSCALL_WRAPPER must be
a 32 bits integer, got Int:"_Bool"

Fix this by changing the code to expect a one byte integer instead. A cursory search on Sourcegraph shows no open source users of uint32. This makes sense since the variable is meant to be consumed via the macros from bpf_tracing.h.

bpf_tracing.h defines LINUX_HAS_SYSCALL_WRAPPER as a boolean:

    extern _Bool LINUX_HAS_SYSCALL_WRAPPER __kconfig;

Our kconfig fixup code currently expects a uint32 and therefore
bails out with the following error:

    resolve .kconfig: variable LINUX_HAS_SYSCALL_WRAPPER must be
    a 32 bits integer, got Int:"_Bool"

Fix this by changing the code to expect a one byte integer instead.
A cursory search on Sourcegraph shows no open source users of uint32.
This makes sense since the variable is meant to be consumed via the
macros from bpf_tracing.h.

Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
@lmb lmb requested a review from paulcacheux November 3, 2023 13:54
@lmb
Copy link
Collaborator Author

lmb commented Nov 3, 2023

Went for this simpler fix instead, since I think the likelihood of breaking anyone is low.

@paulcacheux
Copy link
Contributor

I think the fix for this should match what libbpf does which is supporting multiple int sizes. This would allow the fix to not break any code (current code using uint32 would still work, code using uint8/_Bool would work with the fix)

We also have no guarantee that sizeof(_Bool) == 1 AFAIK the standard does not guarantee it.

@lmb
Copy link
Collaborator Author

lmb commented Nov 3, 2023

Do you feel like contributing the proper fix? Otherwise I'll go with this, on the basis that right now HAS_SYSCALL_WRAPPER is broken in the most common use case. I don't have time to investigate the full fix right now.

P.S. I need this to be able to fix our section name parsing.

@paulcacheux
Copy link
Contributor

Absolutely, I will push a proper fix in a few minutes

@paulcacheux
Copy link
Contributor

@lmb here you go #1202

@lmb lmb closed this Nov 7, 2023
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.

2 participants