未验证 提交 d35418fb 编写于 作者: O openeuler-ci-bot 提交者: Gitee

!1336 [sync] PR-1335: bpf: Fix incorrect verifier pruning due to missing register precision taints

Merge Pull Request from: @openeuler-sync-bot 
 

Origin pull request: 
https://gitee.com/openeuler/kernel/pulls/1335 
 
PR sync from: Pu Lehui <pulehui@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/U3JJGUSJTF5PH22SUDWUTPBSGUN6AUFJ/ 
 
 
Link:https://gitee.com/openeuler/kernel/pulls/1336 

Reviewed-by: Xu Kuohai <xukuohai@huawei.com> 
Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com> 
...@@ -1923,6 +1923,21 @@ static int backtrack_insn(struct bpf_verifier_env *env, int idx, ...@@ -1923,6 +1923,21 @@ static int backtrack_insn(struct bpf_verifier_env *env, int idx,
} }
} else if (opcode == BPF_EXIT) { } else if (opcode == BPF_EXIT) {
return -ENOTSUPP; return -ENOTSUPP;
} else if (BPF_SRC(insn->code) == BPF_X) {
if (!(*reg_mask & (dreg | sreg)))
return 0;
/* dreg <cond> sreg
* Both dreg and sreg need precision before
* this insn. If only sreg was marked precise
* before it would be equally necessary to
* propagate it to dreg.
*/
*reg_mask |= (sreg | dreg);
/* else dreg <cond> K
* Only dreg still needs precision before
* this insn, so for the K-based conditional
* there is nothing new to be marked.
*/
} }
} else if (class == BPF_LD) { } else if (class == BPF_LD) {
if (!(*reg_mask & dreg)) if (!(*reg_mask & dreg))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册