Page MenuHomePhabricator

[BPF] fix a bug in BPFMISimplifyPatchable pass with -O0

Authored by yonghong-song on Jan 29 2020, 11:20 PM.



The recommended optimization level for BPF programs
is O2 since (1). BPF is running inside the kernel and
linux kernel won't work at -O0 level, and (2). Verifier
is not able to handle O0 code properly, e.g., potential
large stack size and a lot of spills.

But we should keep -O0 at least compiling.
This patch fixed a bug in BPFMISimplifyPatchable phase
where with -O0, a segmentation fault will happen for a
simple program like:

int test(int a, int b) { return a + b; }

A test case is added to capture such a case.

Diff Detail

Event Timeline

yonghong-song created this revision.Jan 29 2020, 11:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 29 2020, 11:20 PM
ast accepted this revision.Jan 30 2020, 7:54 AM
This revision is now accepted and ready to land.Jan 30 2020, 7:54 AM
This revision was automatically updated to reflect the committed changes.