aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2018-04-02 10:10:13 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2018-04-02 10:10:13 -0400
commitbde12cb0f67e330285b47bfc289b501eea7b36d6 (patch)
tree51abdc4bced8fb1b46bbc4800c093c4ceb3af19b
parent48a772aba0e3d7d676afda8b2ddb59c6cc85d114 (diff)
parente3c2247579b1387ce62e040d215270d9c82971c8 (diff)
downloadlinux-yocto-4.8-standard/tiny/common-pc.tar.gz
linux-yocto-4.8-standard/tiny/common-pc.tar.bz2
linux-yocto-4.8-standard/tiny/common-pc.zip
Merge branch 'standard/base' into standard/tiny/common-pcstandard/tiny/common-pc
-rw-r--r--kernel/bpf/verifier.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 48fe5d4da143..d2e228eeb733 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -706,12 +706,13 @@ static int check_ctx_access(struct verifier_env *env, int off, int size,
return -EACCES;
}
-static bool is_pointer_value(struct verifier_env *env, int regno)
+static bool __is_pointer_value(bool allow_ptr_leaks,
+ const struct reg_state *reg)
{
- if (env->allow_ptr_leaks)
+ if (allow_ptr_leaks)
return false;
- switch (env->cur_state.regs[regno].type) {
+ switch (reg->type) {
case UNKNOWN_VALUE:
case CONST_IMM:
return false;
@@ -720,6 +721,12 @@ static bool is_pointer_value(struct verifier_env *env, int regno)
}
}
+static bool is_pointer_value(struct verifier_env *env, int regno)
+{
+ return __is_pointer_value(env->allow_ptr_leaks, &env->cur_state.regs[regno]);
+}
+
+
static int check_ptr_alignment(struct verifier_env *env, struct reg_state *reg,
int off, int size)
{
@@ -2147,9 +2154,9 @@ static bool states_equal(struct verifier_state *old, struct verifier_state *cur)
if (memcmp(rold, rcur, sizeof(*rold)) == 0)
continue;
-
if (rold->type == NOT_INIT ||
- (rold->type == UNKNOWN_VALUE && rcur->type != NOT_INIT))
+ (rold->type == UNKNOWN_VALUE && rcur->type != NOT_INIT &&
+ !__is_pointer_value(capable(CAP_SYS_ADMIN), rcur)))
continue;
if (rold->type == PTR_TO_PACKET && rcur->type == PTR_TO_PACKET &&