https://bugs.llvm.org/show_bug.cgi?id=43843
Bug ID: 43843
Summary: clang BPF wrong code generation, if branch
Product: clang
Version: 9.0
Hardware: Other
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: eugene....@oracle.com
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
neeil...@live.com, richard-l...@metafoo.co.uk
Created attachment 22746
--> https://bugs.llvm.org/attachment.cgi?id=22746&action=edit
sample C code + script to see assembly + script to try with BPF verifier
A sample C code seems to lead to incorrect code generation. The code is
basically
int foo() {
unsigned long long ptr1, ptr2, in[2];
char out[256];
ptr1 = ((unsigned long long) out) + 16;
if (ptr1)
bpf_probe_read((void *) ptr1, 16, (const void *) in);
ptr2 = ((unsigned long long) out) + 32;
if (ptr2)
bpf_probe_read((void *) ptr2, 16, (const void *) in);
return 0;
}
The "if (ptr)" branches should always be taken. These code paths seem to be
generated correctly.
If either "ptr*" is 0, however, the generated code is bad. That shouldn't
matter, but for BPF the BPF verifier analyzes those paths and ends up rejecting
legitimate code.
I'm attaching an example.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs