Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
turn off x86 jump table optimization during jit compilation
jump table optimization tries to optimize switch statements into an array access. But such optimization will place certain information, acted as the array, in the read-only section. Currently, bcc does not support read-only section, so jump table optimized code will fail during kernel verification. This is what happened to biolatpcts.py in my environment with latest llvm. -bash-4.4$ sudo ./biolatpcts.py console bpf: Failed to load program: Invalid argument unknown opcode 60 processed 0 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0 HINT: The 'unknown opcode' can happen if you reference a global or static variable, or data in read-only section. For example, 'char *p = "hello"' will result in p referencing a read-only section, and 'char p[] = "hello"' will have "hello" stored on the stack. This patch disabled jump table optimization on x64. The jump table optimization is guarded for llvm version 4 and above. We can disable jump table on other architectures if needed. A test case, developed based biolatpcts.py tool, is added to ensure it pass the verifier. Signed-off-by: Yonghong Song <yhs@fb.com>
- Loading branch information