public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>
To: Eduard Zingerman <eddyz87@gmail.com>,
	bpf@vger.kernel.org, ast@kernel.org, andrii@kernel.org
Cc: daniel@iogearbox.net, martin.lau@linux.dev, kernel-team@fb.com,
	yonghong.song@linux.dev
Subject: Re: [PATCH bpf-next 01/14] bpf: share several utility functions as internal API
Date: Thu, 9 Apr 2026 18:00:31 +0100	[thread overview]
Message-ID: <048e6632-1388-4643-91b2-18dd5844cf5e@gmail.com> (raw)
In-Reply-To: <20260408-patch-set-v1-1-1a666e860d42@gmail.com>


On 4/9/26 2:33 AM, Eduard Zingerman wrote:
> Namely:
> - bpf_subprog_is_global
> - bpf_vlog_alignment
> 
> Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
> ---

Simple renaming, all callsites are covered.
Acked-by: Mykyta Yatsenko <yatsenko@meta.com>

>   include/linux/bpf_verifier.h |  2 ++
>   kernel/bpf/log.c             |  4 ++--
>   kernel/bpf/verifier.c        | 10 +++++-----
>   3 files changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
> index 36bfd96d4563087209d73dfcfe43786df0184256..15f7f9f35be98f6f30c46cdf03cf5c0249a8ac38 100644
> --- a/include/linux/bpf_verifier.h
> +++ b/include/linux/bpf_verifier.h
> @@ -1121,12 +1121,14 @@ void print_verifier_state(struct bpf_verifier_env *env, const struct bpf_verifie
>   			  u32 frameno, bool print_all);
>   void print_insn_state(struct bpf_verifier_env *env, const struct bpf_verifier_state *vstate,
>   		      u32 frameno);
> +u32 bpf_vlog_alignment(u32 pos);
>   
>   struct bpf_subprog_info *bpf_find_containing_subprog(struct bpf_verifier_env *env, int off);
>   int bpf_jmp_offset(struct bpf_insn *insn);
>   struct bpf_iarray *bpf_insn_successors(struct bpf_verifier_env *env, u32 idx);
>   void bpf_fmt_stack_mask(char *buf, ssize_t buf_sz, u64 stack_mask);
>   bool bpf_calls_callback(struct bpf_verifier_env *env, int insn_idx);
> +bool bpf_subprog_is_global(const struct bpf_verifier_env *env, int subprog);
>   
>   int bpf_find_subprog(struct bpf_verifier_env *env, int off);
>   int bpf_compute_const_regs(struct bpf_verifier_env *env);
> diff --git a/kernel/bpf/log.c b/kernel/bpf/log.c
> index 37d72b0521920daf6f3274ad77d055c8b3aafa1b..f0902ecb7df69b6d43deaf808b4c0f00cc3438f2 100644
> --- a/kernel/bpf/log.c
> +++ b/kernel/bpf/log.c
> @@ -847,7 +847,7 @@ void print_verifier_state(struct bpf_verifier_env *env, const struct bpf_verifie
>   		mark_verifier_state_clean(env);
>   }
>   
> -static inline u32 vlog_alignment(u32 pos)
> +u32 bpf_vlog_alignment(u32 pos)
>   {
>   	return round_up(max(pos + BPF_LOG_MIN_ALIGNMENT / 2, BPF_LOG_ALIGNMENT),
>   			BPF_LOG_MIN_ALIGNMENT) - pos - 1;
> @@ -859,7 +859,7 @@ void print_insn_state(struct bpf_verifier_env *env, const struct bpf_verifier_st
>   	if (env->prev_log_pos && env->prev_log_pos == env->log.end_pos) {
>   		/* remove new line character */
>   		bpf_vlog_reset(&env->log, env->prev_log_pos - 1);
> -		verbose(env, "%*c;", vlog_alignment(env->prev_insn_print_pos), ' ');
> +		verbose(env, "%*c;", bpf_vlog_alignment(env->prev_insn_print_pos), ' ');
>   	} else {
>   		verbose(env, "%d:", env->insn_idx);
>   	}
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 84699a428077d66f68203cdcccddee5f8207cd34..dd81cfbad680712e4d871163b8ee179fafe8587c 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -421,7 +421,7 @@ static struct btf_record *reg_btf_record(const struct bpf_reg_state *reg)
>   	return rec;
>   }
>   
> -static bool subprog_is_global(const struct bpf_verifier_env *env, int subprog)
> +bool bpf_subprog_is_global(const struct bpf_verifier_env *env, int subprog)
>   {
>   	struct bpf_func_info_aux *aux = env->prog->aux->func_info_aux;
>   
> @@ -4610,7 +4610,7 @@ static int backtrack_insn(struct bpf_verifier_env *env, int idx, int subseq_idx,
>   			if (subprog < 0)
>   				return -EFAULT;
>   
> -			if (subprog_is_global(env, subprog)) {
> +			if (bpf_subprog_is_global(env, subprog)) {
>   				/* check that jump history doesn't have any
>   				 * extra instructions from subprog; the next
>   				 * instruction after call to global subprog
> @@ -6971,7 +6971,7 @@ static int check_max_stack_depth_subprog(struct bpf_verifier_env *env, int idx,
>   		if (subprog[idx].has_tail_call)
>   			tail_call_reachable = true;
>   
> -		frame = subprog_is_global(env, idx) ? 0 : frame + 1;
> +		frame = bpf_subprog_is_global(env, idx) ? 0 : frame + 1;
>   		if (frame >= MAX_CALL_FRAMES) {
>   			verbose(env, "the call stack of %d frames is too deep !\n",
>   				frame);
> @@ -11040,7 +11040,7 @@ static int check_func_call(struct bpf_verifier_env *env, struct bpf_insn *insn,
>   	err = btf_check_subprog_call(env, subprog, caller->regs);
>   	if (err == -EFAULT)
>   		return err;
> -	if (subprog_is_global(env, subprog)) {
> +	if (bpf_subprog_is_global(env, subprog)) {
>   		const char *sub_name = subprog_name(env, subprog);
>   
>   		if (env->cur_state->active_locks) {
> @@ -25186,7 +25186,7 @@ static int do_check_subprogs(struct bpf_verifier_env *env)
>   again:
>   	new_cnt = 0;
>   	for (i = 1; i < env->subprog_cnt; i++) {
> -		if (!subprog_is_global(env, i))
> +		if (!bpf_subprog_is_global(env, i))
>   			continue;
>   
>   		sub_aux = subprog_aux(env, i);
> 


  reply	other threads:[~2026-04-09 17:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-09  1:33 [PATCH bpf-next 00/14] bpf: static stack liveness data flow analysis Eduard Zingerman
2026-04-09  1:33 ` [PATCH bpf-next 01/14] bpf: share several utility functions as internal API Eduard Zingerman
2026-04-09 17:00   ` Mykyta Yatsenko [this message]
2026-04-09  1:33 ` [PATCH bpf-next 02/14] bpf: save subprogram name in bpf_subprog_info Eduard Zingerman
2026-04-09  2:14   ` bot+bpf-ci
2026-04-09  1:33 ` [PATCH bpf-next 03/14] bpf: Add spis_*() helpers for 4-byte stack slot bitmasks Eduard Zingerman
2026-04-09  3:12   ` bot+bpf-ci
2026-04-09  1:33 ` [PATCH bpf-next 04/14] bpf: make liveness.c track stack with 4-byte granularity Eduard Zingerman
2026-04-09  2:26   ` bot+bpf-ci
2026-04-09  1:33 ` [PATCH bpf-next 05/14] bpf: 4-byte precise clean_verifier_state Eduard Zingerman
2026-04-09  1:33 ` [PATCH bpf-next 06/14] bpf: prepare bpf_liveness api for use by static analysis pass Eduard Zingerman
2026-04-09  1:33 ` [PATCH bpf-next 07/14] bpf: introduce forward arg-tracking dataflow analysis Eduard Zingerman
2026-04-09  2:26   ` bot+bpf-ci
2026-04-09  1:33 ` [PATCH bpf-next 08/14] bpf: record arg tracking results in bpf_liveness masks Eduard Zingerman
2026-04-09  2:26   ` bot+bpf-ci
2026-04-09  1:33 ` [PATCH bpf-next 09/14] bpf: simplify liveness to use (callsite, depth) keyed func_instances Eduard Zingerman
2026-04-09  2:26   ` bot+bpf-ci
2026-04-09  1:33 ` [PATCH bpf-next 10/14] bpf: change logging scheme for live stack analysis Eduard Zingerman
2026-04-09  2:14   ` bot+bpf-ci
2026-04-09  1:33 ` [PATCH bpf-next 11/14] selftests/bpf: update existing tests due to liveness changes Eduard Zingerman
2026-04-09  1:33 ` [PATCH bpf-next 12/14] selftests/bpf: adjust verifier_log buffers Eduard Zingerman
2026-04-09  1:33 ` [PATCH bpf-next 13/14] selftests/bpf: add new tests for static stack liveness analysis Eduard Zingerman
2026-04-09  1:33 ` [PATCH bpf-next 14/14] bpf: poison dead stack slots Eduard Zingerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=048e6632-1388-4643-91b2-18dd5844cf5e@gmail.com \
    --to=mykyta.yatsenko5@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@linux.dev \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox