Commit 7a3d9a15 authored by Song Liu's avatar Song Liu Committed by Alexei Starovoitov

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: default avatarSong Liu <song@kernel.org>
Acked-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
Tested-by: Ilya Leoshkevich <iii@linux.ibm.com>  # on s390x
Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20231206224054.492250-3-song@kernel.orgSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent f08a1c65
...@@ -1828,7 +1828,7 @@ static void restore_args(struct jit_ctx *ctx, int args_off, int nregs) ...@@ -1828,7 +1828,7 @@ static void restore_args(struct jit_ctx *ctx, int args_off, int nregs)
* *
*/ */
static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im, static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im,
struct bpf_tramp_links *tlinks, void *orig_call, struct bpf_tramp_links *tlinks, void *func_addr,
int nregs, u32 flags) int nregs, u32 flags)
{ {
int i; int i;
...@@ -1926,7 +1926,7 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im, ...@@ -1926,7 +1926,7 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im,
if (flags & BPF_TRAMP_F_IP_ARG) { if (flags & BPF_TRAMP_F_IP_ARG) {
/* save ip address of the traced function */ /* save ip address of the traced function */
emit_addr_mov_i64(A64_R(10), (const u64)orig_call, ctx); emit_addr_mov_i64(A64_R(10), (const u64)func_addr, ctx);
emit(A64_STR64I(A64_R(10), A64_SP, ip_off), ctx); emit(A64_STR64I(A64_R(10), A64_SP, ip_off), ctx);
} }
...@@ -2029,7 +2029,7 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im, ...@@ -2029,7 +2029,7 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im,
int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image,
void *image_end, const struct btf_func_model *m, void *image_end, const struct btf_func_model *m,
u32 flags, struct bpf_tramp_links *tlinks, u32 flags, struct bpf_tramp_links *tlinks,
void *orig_call) void *func_addr)
{ {
int i, ret; int i, ret;
int nregs = m->nr_args; int nregs = m->nr_args;
...@@ -2050,7 +2050,7 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, ...@@ -2050,7 +2050,7 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image,
if (nregs > 8) if (nregs > 8)
return -ENOTSUPP; return -ENOTSUPP;
ret = prepare_trampoline(&ctx, im, tlinks, orig_call, nregs, flags); ret = prepare_trampoline(&ctx, im, tlinks, func_addr, nregs, flags);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -2061,7 +2061,7 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, ...@@ -2061,7 +2061,7 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image,
ctx.idx = 0; ctx.idx = 0;
jit_fill_hole(image, (unsigned int)(image_end - image)); jit_fill_hole(image, (unsigned int)(image_end - image));
ret = prepare_trampoline(&ctx, im, tlinks, orig_call, nregs, flags); ret = prepare_trampoline(&ctx, im, tlinks, func_addr, nregs, flags);
if (ret > 0 && validate_code(&ctx) < 0) if (ret > 0 && validate_code(&ctx) < 0)
ret = -EINVAL; ret = -EINVAL;
......
...@@ -1098,10 +1098,10 @@ struct bpf_tramp_run_ctx; ...@@ -1098,10 +1098,10 @@ struct bpf_tramp_run_ctx;
* fexit = a set of program to run after original function * fexit = a set of program to run after original function
*/ */
struct bpf_tramp_image; struct bpf_tramp_image;
int arch_prepare_bpf_trampoline(struct bpf_tramp_image *tr, void *image, void *image_end, int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *image_end,
const struct btf_func_model *m, u32 flags, const struct btf_func_model *m, u32 flags,
struct bpf_tramp_links *tlinks, struct bpf_tramp_links *tlinks,
void *orig_call); void *func_addr);
u64 notrace __bpf_prog_enter_sleepable_recur(struct bpf_prog *prog, u64 notrace __bpf_prog_enter_sleepable_recur(struct bpf_prog *prog,
struct bpf_tramp_run_ctx *run_ctx); struct bpf_tramp_run_ctx *run_ctx);
void notrace __bpf_prog_exit_sleepable_recur(struct bpf_prog *prog, u64 start, void notrace __bpf_prog_exit_sleepable_recur(struct bpf_prog *prog, u64 start,
......
...@@ -1032,10 +1032,10 @@ bpf_trampoline_exit_t bpf_trampoline_exit(const struct bpf_prog *prog) ...@@ -1032,10 +1032,10 @@ bpf_trampoline_exit_t bpf_trampoline_exit(const struct bpf_prog *prog)
} }
int __weak int __weak
arch_prepare_bpf_trampoline(struct bpf_tramp_image *tr, void *image, void *image_end, arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *image_end,
const struct btf_func_model *m, u32 flags, const struct btf_func_model *m, u32 flags,
struct bpf_tramp_links *tlinks, struct bpf_tramp_links *tlinks,
void *orig_call) void *func_addr)
{ {
return -ENOTSUPP; return -ENOTSUPP;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment