提交 dd066823 编写于 作者: A Alexei Starovoitov 提交者: Daniel Borkmann

bpf/verifier: disallow pointer subtraction

Subtraction of pointers was accidentally allowed for unpriv programs
by commit 82abbf8d. Revert that part of commit.

Fixes: 82abbf8d ("bpf: do not allow root to mangle valid pointers")
Reported-by: NJann Horn <jannh@google.com>
Acked-by: NDaniel Borkmann <daniel@iogearbox.net>
Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
上级 4b1c5d91
......@@ -3163,7 +3163,7 @@ static int adjust_reg_min_max_vals(struct bpf_verifier_env *env,
* an arbitrary scalar. Disallow all math except
* pointer subtraction
*/
if (opcode == BPF_SUB){
if (opcode == BPF_SUB && env->allow_ptr_leaks) {
mark_reg_unknown(env, regs, insn->dst_reg);
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册