Re: [PATCH v2 bpf-next 03/10] bpf: encapsulate precision backtracking bookkeeping

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

 



On Thu, May 04, 2023 at 05:09:01PM -0700, Andrii Nakryiko wrote:
> +struct backtrack_state {
> +	struct bpf_verifier_env *env;
> +	u32 frame;
> +	u32 bitcnt;
> +	u32 reg_masks[MAX_CALL_FRAMES];
> +	u64 stack_masks[MAX_CALL_FRAMES];
> +};
> +

> +static inline u32 bt_empty(struct backtrack_state *bt)
> +{
> +	u64 mask = 0;
> +	int i;
> +
> +	for (i = 0; i < MAX_CALL_FRAMES; i++)
> +		mask |= bt->reg_masks[i] | bt->stack_masks[i];
> +
> +	return mask == 0;
> +}
> +
...
> +static inline void bt_set_frame_reg(struct backtrack_state *bt, u32 frame, u32 reg)
> +{
> +	if (bt->reg_masks[frame] & (1 << reg))
> +		return;
> +
> +	bt->reg_masks[frame] |= 1 << reg;
> +	bt->bitcnt++;
> +}

So you went with bitcnt and bt_empty ?
I'm confused. I thought we discussed it's one or another.
I have slight preference towards bt_empty() as above. fwiw.




[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