Skip to content

Commit 7a3d9a1

Browse files
liu-song-6Alexei Starovoitov
authored andcommitted
bpf: Adjust argument names of arch_prepare_bpf_trampoline()
We are using "im" for "struct bpf_tramp_image" and "tr" for "struct bpf_trampoline" in most of the code base. The only exception is the prototype and fallback version of arch_prepare_bpf_trampoline(). Update them to match the rest of the code base. We mix "orig_call" and "func_addr" for the argument in different versions of arch_prepare_bpf_trampoline(). s/orig_call/func_addr/g so they match. Signed-off-by: Song Liu <[email protected]> Acked-by: Ilya Leoshkevich <[email protected]> Tested-by: Ilya Leoshkevich <[email protected]> # on s390x Acked-by: Jiri Olsa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent f08a1c6 commit 7a3d9a1

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

arch/arm64/net/bpf_jit_comp.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,7 +1828,7 @@ static void restore_args(struct jit_ctx *ctx, int args_off, int nregs)
18281828
*
18291829
*/
18301830
static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im,
1831-
struct bpf_tramp_links *tlinks, void *orig_call,
1831+
struct bpf_tramp_links *tlinks, void *func_addr,
18321832
int nregs, u32 flags)
18331833
{
18341834
int i;
@@ -1926,7 +1926,7 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im,
19261926

19271927
if (flags & BPF_TRAMP_F_IP_ARG) {
19281928
/* save ip address of the traced function */
1929-
emit_addr_mov_i64(A64_R(10), (const u64)orig_call, ctx);
1929+
emit_addr_mov_i64(A64_R(10), (const u64)func_addr, ctx);
19301930
emit(A64_STR64I(A64_R(10), A64_SP, ip_off), ctx);
19311931
}
19321932

@@ -2029,7 +2029,7 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im,
20292029
int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image,
20302030
void *image_end, const struct btf_func_model *m,
20312031
u32 flags, struct bpf_tramp_links *tlinks,
2032-
void *orig_call)
2032+
void *func_addr)
20332033
{
20342034
int i, ret;
20352035
int nregs = m->nr_args;
@@ -2050,7 +2050,7 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image,
20502050
if (nregs > 8)
20512051
return -ENOTSUPP;
20522052

2053-
ret = prepare_trampoline(&ctx, im, tlinks, orig_call, nregs, flags);
2053+
ret = prepare_trampoline(&ctx, im, tlinks, func_addr, nregs, flags);
20542054
if (ret < 0)
20552055
return ret;
20562056

@@ -2061,7 +2061,7 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image,
20612061
ctx.idx = 0;
20622062

20632063
jit_fill_hole(image, (unsigned int)(image_end - image));
2064-
ret = prepare_trampoline(&ctx, im, tlinks, orig_call, nregs, flags);
2064+
ret = prepare_trampoline(&ctx, im, tlinks, func_addr, nregs, flags);
20652065

20662066
if (ret > 0 && validate_code(&ctx) < 0)
20672067
ret = -EINVAL;

include/linux/bpf.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,10 +1098,10 @@ struct bpf_tramp_run_ctx;
10981098
* fexit = a set of program to run after original function
10991099
*/
11001100
struct bpf_tramp_image;
1101-
int arch_prepare_bpf_trampoline(struct bpf_tramp_image *tr, void *image, void *image_end,
1101+
int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *image_end,
11021102
const struct btf_func_model *m, u32 flags,
11031103
struct bpf_tramp_links *tlinks,
1104-
void *orig_call);
1104+
void *func_addr);
11051105
u64 notrace __bpf_prog_enter_sleepable_recur(struct bpf_prog *prog,
11061106
struct bpf_tramp_run_ctx *run_ctx);
11071107
void notrace __bpf_prog_exit_sleepable_recur(struct bpf_prog *prog, u64 start,

kernel/bpf/trampoline.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,10 +1032,10 @@ bpf_trampoline_exit_t bpf_trampoline_exit(const struct bpf_prog *prog)
10321032
}
10331033

10341034
int __weak
1035-
arch_prepare_bpf_trampoline(struct bpf_tramp_image *tr, void *image, void *image_end,
1035+
arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *image_end,
10361036
const struct btf_func_model *m, u32 flags,
10371037
struct bpf_tramp_links *tlinks,
1038-
void *orig_call)
1038+
void *func_addr)
10391039
{
10401040
return -ENOTSUPP;
10411041
}

0 commit comments

Comments
 (0)