Re: [RFC PATCH v1 01/14] bpf: Mark subprogs as throw reachable before do_check pass

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2024-02-01 at 04:20 +0000, Kumar Kartikeya Dwivedi wrote:

[...]

> +static int mark_exception_reachable_subprogs(struct bpf_verifier_env *env)
> +{

[...]

> +restart:
> +	subprog_end = subprog[idx + 1].start;
> +	for (; i < subprog_end; i++) {

[...]

> +		if (!bpf_pseudo_call(insn + i) && !bpf_pseudo_func(insn + i))
> +			continue;
> +		/* remember insn and function to return to */
> +		ret_insn[frame] = i + 1;
> +		ret_prog[frame] = idx;
> +
> +		/* find the callee */
> +		next_insn = i + insn[i].imm + 1;
> +		sidx = find_subprog(env, next_insn);
> +		if (sidx < 0) {
> +			WARN_ONCE(1, "verifier bug. No program starts at insn %d\n", next_insn);
> +			return -EFAULT;
> +		}

For programs like:

  foo():
    bar()
    bar()

this algorithm would scan bar() multiple times.
Would it be possible to remember if subprogram had been scanned
already and reuse collected .is_throw_reachable info?

[...]







[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux