diff options
author | Josh Poimboeuf <jpoimboe@redhat.com> | 2016-01-21 17:49:27 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-02-24 02:35:44 -0500 |
commit | d21001cc15ba9f63b0334d60942278587471a451 (patch) | |
tree | b8e85cfba113529d716e9a5f850b1b5d3e5a2c85 /arch/x86/net | |
parent | 2d8fe90a1b96d52c2a3f719c385b846b02f0bcd8 (diff) |
x86/asm/bpf: Create stack frames in bpf_jit.S
bpf_jit.S has several callable non-leaf functions which don't honor
CONFIG_FRAME_POINTER, which can result in bad stack traces.
Create a stack frame before the call instructions when
CONFIG_FRAME_POINTER is enabled.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Chris J Arges <chris.j.arges@canonical.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Pedro Alves <palves@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: live-patching@vger.kernel.org
Cc: netdev@vger.kernel.org
Link: http://lkml.kernel.org/r/fa4c41976b438b51954cb8021f06bceb1d1d66cc.1453405861.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/net')
-rw-r--r-- | arch/x86/net/bpf_jit.S | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/x86/net/bpf_jit.S b/arch/x86/net/bpf_jit.S index eb4a3bd293eb..f2a7faf4706e 100644 --- a/arch/x86/net/bpf_jit.S +++ b/arch/x86/net/bpf_jit.S | |||
@@ -8,6 +8,7 @@ | |||
8 | * of the License. | 8 | * of the License. |
9 | */ | 9 | */ |
10 | #include <linux/linkage.h> | 10 | #include <linux/linkage.h> |
11 | #include <asm/frame.h> | ||
11 | 12 | ||
12 | /* | 13 | /* |
13 | * Calling convention : | 14 | * Calling convention : |
@@ -65,16 +66,18 @@ FUNC(sk_load_byte_positive_offset) | |||
65 | 66 | ||
66 | /* rsi contains offset and can be scratched */ | 67 | /* rsi contains offset and can be scratched */ |
67 | #define bpf_slow_path_common(LEN) \ | 68 | #define bpf_slow_path_common(LEN) \ |
69 | lea -MAX_BPF_STACK + 32(%rbp), %rdx;\ | ||
70 | FRAME_BEGIN; \ | ||
68 | mov %rbx, %rdi; /* arg1 == skb */ \ | 71 | mov %rbx, %rdi; /* arg1 == skb */ \ |
69 | push %r9; \ | 72 | push %r9; \ |
70 | push SKBDATA; \ | 73 | push SKBDATA; \ |
71 | /* rsi already has offset */ \ | 74 | /* rsi already has offset */ \ |
72 | mov $LEN,%ecx; /* len */ \ | 75 | mov $LEN,%ecx; /* len */ \ |
73 | lea - MAX_BPF_STACK + 32(%rbp),%rdx; \ | ||
74 | call skb_copy_bits; \ | 76 | call skb_copy_bits; \ |
75 | test %eax,%eax; \ | 77 | test %eax,%eax; \ |
76 | pop SKBDATA; \ | 78 | pop SKBDATA; \ |
77 | pop %r9; | 79 | pop %r9; \ |
80 | FRAME_END | ||
78 | 81 | ||
79 | 82 | ||
80 | bpf_slow_path_word: | 83 | bpf_slow_path_word: |
@@ -99,6 +102,7 @@ bpf_slow_path_byte: | |||
99 | ret | 102 | ret |
100 | 103 | ||
101 | #define sk_negative_common(SIZE) \ | 104 | #define sk_negative_common(SIZE) \ |
105 | FRAME_BEGIN; \ | ||
102 | mov %rbx, %rdi; /* arg1 == skb */ \ | 106 | mov %rbx, %rdi; /* arg1 == skb */ \ |
103 | push %r9; \ | 107 | push %r9; \ |
104 | push SKBDATA; \ | 108 | push SKBDATA; \ |
@@ -108,6 +112,7 @@ bpf_slow_path_byte: | |||
108 | test %rax,%rax; \ | 112 | test %rax,%rax; \ |
109 | pop SKBDATA; \ | 113 | pop SKBDATA; \ |
110 | pop %r9; \ | 114 | pop %r9; \ |
115 | FRAME_END; \ | ||
111 | jz bpf_error | 116 | jz bpf_error |
112 | 117 | ||
113 | bpf_slow_path_word_neg: | 118 | bpf_slow_path_word_neg: |