projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4b1c5d9
)
bpf/verifier: disallow pointer subtraction
author
Alexei Starovoitov
<
[email protected]
>
Wed, 12 Sep 2018 21:06:10 +0000
(14:06 -0700)
committer
Daniel Borkmann
<
[email protected]
>
Wed, 12 Sep 2018 21:30:02 +0000
(23:30 +0200)
Subtraction of pointers was accidentally allowed for unpriv programs
by commit
82abbf8d2fc4
. Revert that part of commit.
Fixes: 82abbf8d2fc4 ("bpf: do not allow root to mangle valid pointers")
Reported-by: Jann Horn <
[email protected]
>
Acked-by: Daniel Borkmann <
[email protected]
>
Signed-off-by: Alexei Starovoitov <
[email protected]
>
Signed-off-by: Daniel Borkmann <
[email protected]
>
kernel/bpf/verifier.c
patch
|
blob
|
history
diff --git
a/kernel/bpf/verifier.c
b/kernel/bpf/verifier.c
index 92246117d2b0395e5eec8329455e7ee7c8320d58..bb07e74b34a225f1b21cc61ca0a43c848d3d532f 100644
(file)
--- a/
kernel/bpf/verifier.c
+++ b/
kernel/bpf/verifier.c
@@
-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;
}