aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.9.21/0095-bpf-prevent-leaking-pointer-via-xadd-on-unpriviledge.patch
diff options
context:
space:
mode:
authorAwais Belal <awais_belal@mentor.com>2018-11-14 14:44:19 +0500
committerAwais Belal <awais_belal@mentor.com>2018-11-14 14:44:22 +0500
commitbc139f16bfe8bc885b1505706faa9a4564c77ff2 (patch)
tree71fc44d89877e81f7b77f13db4b08980a32df2a7 /common/recipes-kernel/linux/linux-yocto-4.9.21/0095-bpf-prevent-leaking-pointer-via-xadd-on-unpriviledge.patch
parent972275e4accf161f73fab3bbc7eb24fa95356e95 (diff)
downloadmeta-amd-bc139f16bfe8bc885b1505706faa9a4564c77ff2.tar.gz
meta-amd-bc139f16bfe8bc885b1505706faa9a4564c77ff2.tar.bz2
meta-amd-bc139f16bfe8bc885b1505706faa9a4564c77ff2.zip
common: drop all the 4.9 kernel metadata
None of the BSPs are currently based on the 4.9 kernel so drop the common metadata as well. Signed-off-by: Awais Belal <awais_belal@mentor.com>
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.9.21/0095-bpf-prevent-leaking-pointer-via-xadd-on-unpriviledge.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.9.21/0095-bpf-prevent-leaking-pointer-via-xadd-on-unpriviledge.patch83
1 files changed, 0 insertions, 83 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.9.21/0095-bpf-prevent-leaking-pointer-via-xadd-on-unpriviledge.patch b/common/recipes-kernel/linux/linux-yocto-4.9.21/0095-bpf-prevent-leaking-pointer-via-xadd-on-unpriviledge.patch
deleted file mode 100644
index fc0cb2fc..00000000
--- a/common/recipes-kernel/linux/linux-yocto-4.9.21/0095-bpf-prevent-leaking-pointer-via-xadd-on-unpriviledge.patch
+++ /dev/null
@@ -1,83 +0,0 @@
-From c7d695dd43368b0231ed509066131696d1533738 Mon Sep 17 00:00:00 2001
-From: Daniel Borkmann <daniel@iogearbox.net>
-Date: Thu, 29 Jun 2017 03:04:59 +0200
-Subject: [PATCH 095/103] bpf: prevent leaking pointer via xadd on
- unpriviledged
-
-commit 6bdf6abc56b53103324dfd270a86580306e1a232 upstream.
-
-Leaking kernel addresses on unpriviledged is generally disallowed,
-for example, verifier rejects the following:
-
- 0: (b7) r0 = 0
- 1: (18) r2 = 0xffff897e82304400
- 3: (7b) *(u64 *)(r1 +48) = r2
- R2 leaks addr into ctx
-
-Doing pointer arithmetic on them is also forbidden, so that they
-don't turn into unknown value and then get leaked out. However,
-there's xadd as a special case, where we don't check the src reg
-for being a pointer register, e.g. the following will pass:
-
- 0: (b7) r0 = 0
- 1: (7b) *(u64 *)(r1 +48) = r0
- 2: (18) r2 = 0xffff897e82304400 ; map
- 4: (db) lock *(u64 *)(r1 +48) += r2
- 5: (95) exit
-
-We could store the pointer into skb->cb, loose the type context,
-and then read it out from there again to leak it eventually out
-of a map value. Or more easily in a different variant, too:
-
- 0: (bf) r6 = r1
- 1: (7a) *(u64 *)(r10 -8) = 0
- 2: (bf) r2 = r10
- 3: (07) r2 += -8
- 4: (18) r1 = 0x0
- 6: (85) call bpf_map_lookup_elem#1
- 7: (15) if r0 == 0x0 goto pc+3
- R0=map_value(ks=8,vs=8,id=0),min_value=0,max_value=0 R6=ctx R10=fp
- 8: (b7) r3 = 0
- 9: (7b) *(u64 *)(r0 +0) = r3
- 10: (db) lock *(u64 *)(r0 +0) += r6
- 11: (b7) r0 = 0
- 12: (95) exit
-
- from 7 to 11: R0=inv,min_value=0,max_value=0 R6=ctx R10=fp
- 11: (b7) r0 = 0
- 12: (95) exit
-
-Prevent this by checking xadd src reg for pointer types. Also
-add a couple of test cases related to this.
-
-Fixes: 1be7f75d1668 ("bpf: enable non-root eBPF programs")
-Fixes: 17a5267067f3 ("bpf: verifier (add verifier core)")
-Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-Acked-by: Alexei Starovoitov <ast@kernel.org>
-Acked-by: Martin KaFai Lau <kafai@fb.com>
-Acked-by: Edward Cree <ecree@solarflare.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- kernel/bpf/verifier.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
-index bfafb53..6767670 100644
---- a/kernel/bpf/verifier.c
-+++ b/kernel/bpf/verifier.c
-@@ -880,6 +880,11 @@ static int check_xadd(struct bpf_verifier_env *env, struct bpf_insn *insn)
- if (err)
- return err;
-
-+ if (is_pointer_value(env, insn->src_reg)) {
-+ verbose("R%d leaks addr into mem\n", insn->src_reg);
-+ return -EACCES;
-+ }
-+
- /* check whether atomic_add can read the memory */
- err = check_mem_access(env, insn->dst_reg, insn->off,
- BPF_SIZE(insn->code), BPF_READ, -1);
---
-2.7.4
-