32 lines
1.0 KiB
Diff
32 lines
1.0 KiB
Diff
From: Jann Horn <jannh@google.com>
|
|
Date: Mon, 18 Dec 2017 20:11:58 -0800
|
|
Subject: [6/9] bpf: force strict alignment checks for stack pointers
|
|
Origin: https://git.kernel.org/linus/a5ec6ae161d72f01411169a938fa5f8baea16e8f
|
|
|
|
Force strict alignment checks for stack pointers because the tracking of
|
|
stack spills relies on it; unaligned stack accesses can lead to corruption
|
|
of spilled registers, which is exploitable.
|
|
|
|
Fixes: f1174f77b50c ("bpf/verifier: rework value tracking")
|
|
Signed-off-by: Jann Horn <jannh@google.com>
|
|
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
|
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
|
|
---
|
|
kernel/bpf/verifier.c | 5 +++++
|
|
1 file changed, 5 insertions(+)
|
|
|
|
--- a/kernel/bpf/verifier.c
|
|
+++ b/kernel/bpf/verifier.c
|
|
@@ -1071,6 +1071,11 @@ static int check_ptr_alignment(struct bp
|
|
break;
|
|
case PTR_TO_STACK:
|
|
pointer_desc = "stack ";
|
|
+ /* The stack spill tracking logic in check_stack_write()
|
|
+ * and check_stack_read() relies on stack accesses being
|
|
+ * aligned.
|
|
+ */
|
|
+ strict = true;
|
|
break;
|
|
default:
|
|
break;
|