summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--patches/cve/CVE-2017-17856-bpf-force-strict-alignment-checks-for-stack-pointers.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/patches/cve/CVE-2017-17856-bpf-force-strict-alignment-checks-for-stack-pointers.patch b/patches/cve/CVE-2017-17856-bpf-force-strict-alignment-checks-for-stack-pointers.patch
new file mode 100644
index 0000000..e440dc2
--- /dev/null
+++ b/patches/cve/CVE-2017-17856-bpf-force-strict-alignment-checks-for-stack-pointers.patch
@@ -0,0 +1,45 @@
1From c90268f7cbee0781331b96d1423d0f28a6183889 Mon Sep 17 00:00:00 2001
2From: Daniel Borkmann <daniel@iogearbox.net>
3Date: Fri, 22 Dec 2017 16:23:09 +0100
4Subject: [PATCH] bpf: force strict alignment checks for stack pointers
5
6From: Jann Horn <jannh@google.com>
7
8[ Upstream commit a5ec6ae161d72f01411169a938fa5f8baea16e8f ]
9
10Force strict alignment checks for stack pointers because the tracking of
11stack spills relies on it; unaligned stack accesses can lead to corruption
12of spilled registers, which is exploitable.
13
14CVE: CVE-2017-17856
15Upstream-Status: Backport [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.14.y&id=c90268f7cbee0781331b96d1423d0f28a6183889]
16
17Fixes: f1174f77b50c ("bpf/verifier: rework value tracking")
18Signed-off-by: Jann Horn <jannh@google.com>
19Signed-off-by: Alexei Starovoitov <ast@kernel.org>
20Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
21Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
23---
24 kernel/bpf/verifier.c | 5 +++++
25 1 file changed, 5 insertions(+)
26
27diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
28index 8aa98a0591d6..8c353554628e 100644
29--- a/kernel/bpf/verifier.c
30+++ b/kernel/bpf/verifier.c
31@@ -1061,6 +1061,11 @@ static int check_ptr_alignment(struct bpf_verifier_env *env,
32 break;
33 case PTR_TO_STACK:
34 pointer_desc = "stack ";
35+ /* The stack spill tracking logic in check_stack_write()
36+ * and check_stack_read() relies on stack accesses being
37+ * aligned.
38+ */
39+ strict = true;
40 break;
41 default:
42 break;
43--
442.20.1
45