Skip to content

Commit 09ece3d

Browse files
borkmannAlexei Starovoitov
authored andcommitted
bpf, arm64: save 4 bytes of unneeded stack space
Follow-up to 816d9ef ("bpf, arm64: remove ld_abs/ld_ind") in that the extra 4 byte JIT scratchpad is not needed anymore since it was in ld_abs/ld_ind as stack buffer for bpf_load_pointer(). Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 38ca930 commit 09ece3d

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

‎arch/arm64/net/bpf_jit_comp.c‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <linux/bpf.h>
2222
#include <linux/filter.h>
2323
#include <linux/printk.h>
24-
#include <linux/skbuff.h>
2524
#include <linux/slab.h>
2625

2726
#include <asm/byteorder.h>
@@ -188,7 +187,7 @@ static int build_prologue(struct jit_ctx *ctx)
188187
* | ... | BPF prog stack
189188
* | |
190189
* +-----+ <= (BPF_FP - prog->aux->stack_depth)
191-
* |RSVD | JIT scratchpad
190+
* |RSVD | padding
192191
* current A64_SP => +-----+ <= (BPF_FP - ctx->stack_size)
193192
* | |
194193
* | ... | Function call stack
@@ -220,9 +219,7 @@ static int build_prologue(struct jit_ctx *ctx)
220219
return -1;
221220
}
222221

223-
/* 4 byte extra for skb_copy_bits buffer */
224-
ctx->stack_size = prog->aux->stack_depth + 4;
225-
ctx->stack_size = STACK_ALIGN(ctx->stack_size);
222+
ctx->stack_size = STACK_ALIGN(prog->aux->stack_depth);
226223

227224
/* Set up function call stack */
228225
emit(A64_SUB_I(1, A64_SP, A64_SP, ctx->stack_size), ctx);

0 commit comments

Comments
 (0)