@@ -973,9 +973,9 @@ struct bpf_verifier_ops {
const struct bpf_prog *prog,
struct bpf_insn_access_aux *info);
int (*gen_prologue)(struct bpf_insn *insn, bool direct_write,
- const struct bpf_prog *prog);
+ const struct bpf_prog *prog, struct module **module);
int (*gen_epilogue)(struct bpf_insn *insn, const struct bpf_prog *prog,
- s16 ctx_stack_off);
+ s16 ctx_stack_off, struct module **module);
int (*gen_ld_abs)(const struct bpf_insn *orig,
struct bpf_insn *insn_buf);
u32 (*convert_ctx_access)(enum bpf_access_type type,
@@ -580,6 +580,7 @@ bool btf_is_prog_ctx_type(struct bpf_verifier_log *log, const struct btf *btf,
int get_kern_ctx_btf_id(struct bpf_verifier_log *log, enum bpf_prog_type prog_type);
bool btf_types_are_same(const struct btf *btf1, u32 id1,
const struct btf *btf2, u32 id2);
+struct btf *btf_get_module_btf(const struct module *module);
#else
static inline const struct btf_type *btf_type_by_id(const struct btf *btf,
u32 type_id)
@@ -7965,7 +7965,7 @@ struct module *btf_try_get_module(const struct btf *btf)
/* Returns struct btf corresponding to the struct module.
* This function can return NULL or ERR_PTR.
*/
-static struct btf *btf_get_module_btf(const struct module *module)
+struct btf *btf_get_module_btf(const struct module *module)
{
#ifdef CONFIG_DEBUG_INFO_BTF_MODULES
struct btf_module *btf_mod, *tmp;
@@ -2503,7 +2503,8 @@ static u32 cg_sockopt_convert_ctx_access(enum bpf_access_type type,
static int cg_sockopt_get_prologue(struct bpf_insn *insn_buf,
bool direct_write,
- const struct bpf_prog *prog)
+ const struct bpf_prog *prog,
+ struct module **module)
{
/* Nothing to do for sockopt argument. The data is kzalloc'ated.
*/
@@ -19622,7 +19622,7 @@ static int convert_ctx_accesses(struct bpf_verifier_env *env)
if (ops->gen_epilogue) {
epilogue_cnt = ops->gen_epilogue(epilogue_buf, env->prog,
- -(subprogs[0].stack_depth + 8));
+ -(subprogs[0].stack_depth + 8), NULL);
if (epilogue_cnt >= ARRAY_SIZE(epilogue_buf)) {
verbose(env, "bpf verifier is misconfigured\n");
return -EINVAL;
@@ -19647,7 +19647,7 @@ static int convert_ctx_accesses(struct bpf_verifier_env *env)
return -EINVAL;
}
cnt = ops->gen_prologue(insn_buf, env->seen_direct_write,
- env->prog);
+ env->prog, NULL);
if (cnt >= ARRAY_SIZE(insn_buf)) {
verbose(env, "bpf verifier is misconfigured\n");
return -EINVAL;
@@ -8844,7 +8844,7 @@ static bool sock_filter_is_valid_access(int off, int size,
}
static int bpf_noop_prologue(struct bpf_insn *insn_buf, bool direct_write,
- const struct bpf_prog *prog)
+ const struct bpf_prog *prog, struct module **module)
{
/* Neither direct read nor direct write requires any preliminary
* action.
@@ -8927,7 +8927,7 @@ static int bpf_gen_ld_abs(const struct bpf_insn *orig,
}
static int tc_cls_act_prologue(struct bpf_insn *insn_buf, bool direct_write,
- const struct bpf_prog *prog)
+ const struct bpf_prog *prog, struct module **module)
{
return bpf_unclone_prologue(insn_buf, direct_write, prog, TC_ACT_SHOT);
}
@@ -9263,7 +9263,7 @@ static bool sock_ops_is_valid_access(int off, int size,
}
static int sk_skb_prologue(struct bpf_insn *insn_buf, bool direct_write,
- const struct bpf_prog *prog)
+ const struct bpf_prog *prog, struct module **module)
{
return bpf_unclone_prologue(insn_buf, direct_write, prog, SK_DROP);
}
@@ -1141,7 +1141,7 @@ static int bpf_test_mod_st_ops__test_pro_epilogue(struct st_ops_args *args)
}
static int st_ops_gen_prologue(struct bpf_insn *insn_buf, bool direct_write,
- const struct bpf_prog *prog)
+ const struct bpf_prog *prog, struct module **module)
{
struct bpf_insn *insn = insn_buf;
@@ -1164,7 +1164,7 @@ static int st_ops_gen_prologue(struct bpf_insn *insn_buf, bool direct_write,
}
static int st_ops_gen_epilogue(struct bpf_insn *insn_buf, const struct bpf_prog *prog,
- s16 ctx_stack_off)
+ s16 ctx_stack_off, struct module **module)
{
struct bpf_insn *insn = insn_buf;