mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
Revert "bpf: Remove unused insn_cnt argument from visit_[func_call_]insn()"
This reverts commit97bb6dab01which is commitdcb2288b1fupstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: I54a313a185430628b10240a94a96de8353040111 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -11099,7 +11099,8 @@ static int push_insn(int t, int w, int e, struct bpf_verifier_env *env,
|
|||||||
return DONE_EXPLORING;
|
return DONE_EXPLORING;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int visit_func_call_insn(int t, struct bpf_insn *insns,
|
static int visit_func_call_insn(int t, int insn_cnt,
|
||||||
|
struct bpf_insn *insns,
|
||||||
struct bpf_verifier_env *env,
|
struct bpf_verifier_env *env,
|
||||||
bool visit_callee)
|
bool visit_callee)
|
||||||
{
|
{
|
||||||
@@ -11130,13 +11131,13 @@ static int visit_func_call_insn(int t, struct bpf_insn *insns,
|
|||||||
* DONE_EXPLORING - the instruction was fully explored
|
* DONE_EXPLORING - the instruction was fully explored
|
||||||
* KEEP_EXPLORING - there is still work to be done before it is fully explored
|
* KEEP_EXPLORING - there is still work to be done before it is fully explored
|
||||||
*/
|
*/
|
||||||
static int visit_insn(int t, struct bpf_verifier_env *env)
|
static int visit_insn(int t, int insn_cnt, struct bpf_verifier_env *env)
|
||||||
{
|
{
|
||||||
struct bpf_insn *insns = env->prog->insnsi;
|
struct bpf_insn *insns = env->prog->insnsi;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (bpf_pseudo_func(insns + t))
|
if (bpf_pseudo_func(insns + t))
|
||||||
return visit_func_call_insn(t, insns, env, true);
|
return visit_func_call_insn(t, insn_cnt, insns, env, true);
|
||||||
|
|
||||||
/* All non-branch instructions have a single fall-through edge. */
|
/* All non-branch instructions have a single fall-through edge. */
|
||||||
if (BPF_CLASS(insns[t].code) != BPF_JMP &&
|
if (BPF_CLASS(insns[t].code) != BPF_JMP &&
|
||||||
@@ -11155,7 +11156,7 @@ static int visit_insn(int t, struct bpf_verifier_env *env)
|
|||||||
* async state will be pushed for further exploration.
|
* async state will be pushed for further exploration.
|
||||||
*/
|
*/
|
||||||
mark_prune_point(env, t);
|
mark_prune_point(env, t);
|
||||||
return visit_func_call_insn(t, insns, env,
|
return visit_func_call_insn(t, insn_cnt, insns, env,
|
||||||
insns[t].src_reg == BPF_PSEUDO_CALL);
|
insns[t].src_reg == BPF_PSEUDO_CALL);
|
||||||
|
|
||||||
case BPF_JA:
|
case BPF_JA:
|
||||||
@@ -11212,7 +11213,7 @@ static int check_cfg(struct bpf_verifier_env *env)
|
|||||||
while (env->cfg.cur_stack > 0) {
|
while (env->cfg.cur_stack > 0) {
|
||||||
int t = insn_stack[env->cfg.cur_stack - 1];
|
int t = insn_stack[env->cfg.cur_stack - 1];
|
||||||
|
|
||||||
ret = visit_insn(t, env);
|
ret = visit_insn(t, insn_cnt, env);
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case DONE_EXPLORING:
|
case DONE_EXPLORING:
|
||||||
insn_state[t] = EXPLORED;
|
insn_state[t] = EXPLORED;
|
||||||
|
|||||||
Reference in New Issue
Block a user