mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 06:31:49 +00:00
bpf/verifier: disallow pointer subtraction
Subtraction of pointers was accidentally allowed for unpriv programs by commit82abbf8d2f
. Revert that part of commit. Fixes:82abbf8d2f
("bpf: do not allow root to mangle valid pointers") Reported-by: Jann Horn <jannh@google.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
parent
4b1c5d917d
commit
dd066823db
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user