HomePhabricator

bpf: fix bug on silently truncating 64-bit immediate
AuditedrL315889

Description

bpf: fix bug on silently truncating 64-bit immediate

We came across an llvm bug when compiling some testcases that 64-bit
immediates are silently truncated into 32-bit and then packed into
BPF_JMP | BPF_K encoding. This caused comparison with wrong value.

This bug looks to be introduced by r308080. The Select_Ri pattern is
supposed to be lowered into J*_Ri while the latter only support 32-bit
immediate encoding, therefore Select_Ri should have similar immediate
predicate check as what J*_Ri are doing.

Reported-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>

Details

Auditors
ast
Committed
yhsOct 15 2017, 9:14 PM
Parents
rL315888: [PowerPC] Eliminate sign- and zero-extensions if already sign- or zero-extended
Branches
Unknown
Tags
Unknown

Event Timeline

ast accepted this commit.Dec 5 2017, 8:39 AM
All concerns with this commit have now been addressed.Dec 5 2017, 8:39 AM