-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
bpf: always inline .bss in absence of a .data section #25837
Conversation
Due to an early vars == nil check in inlineGlobalData, ELFs without a .data section would not get their .bss references rewritten. This would cause verifier errors on pre-5.x kernels like 'unrecognized bpf_ld_imm64 insn', since those don't support pseudo-register load insns yet. Delay the check and add a regression test. Signed-off-by: Timo Beckers <timo@isovalent.com> Reported-by: Quentin Monnet <quentin@isovalent.com>
/test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
} | ||
|
||
if want, got := asm.R8, insns[0].Dst; want != got { | ||
t.Errorf("unexpected Instruction OpCode: want: %s, got: %s", want, got) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpCode -> Dst
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change breaks some of the unit tests, it introduces patterns such as:
150: (18) r2 = 0x0
152: (69) r2 = *(u16 *)(r2 +0)
R2 invalid mem access 'inv'
Observable here for this test PR. Unit tests were skipped on your PR because it doesn't touch bpf/
files.
It looks like this change breaks global data which we use in the tests. For example in I guess the tests always worked because we were hitting the edge case this PR is removing of not having any global data in I don't really know how to fix this one since we use global data for mocking and to confirm that mocked functions were invoked. Ideally we would mark our oddball Cilium variables in such a way that we can selectively inline them and not dynamic global variables. |
This is a bad approach. We should instead try to avoid anything ending up in .bss by annotating all static variable declarations with We can then reject references to any other sections on pseudo-load instructions because variables likely ended up there by mistake. This would include rejecting references to .bss, which is a lot clearer than the verifier returning |
Due to an early vars == nil check in inlineGlobalData, ELFs without a .data section would not get their .bss references rewritten. This would cause verifier errors on pre-5.x kernels like 'unrecognized bpf_ld_imm64 insn', since those don't support pseudo-register load insns yet.
Delay the check and add a regression test.