All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yonghong Song <yonghong.song@linux.dev>
To: bot+bpf-ci@kernel.org, bpf@vger.kernel.org
Cc: ast@kernel.org, andrii@kernel.org, daniel@iogearbox.net,
	eddyz87@gmail.com, kernel-team@fb.com, martin.lau@kernel.org,
	mason@kernel.org, ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v3 10/20] bpf: Dispatch exception cleanup pads from bpf_throw()
Date: Mon, 21 Sep 2026 08:55:21 -0700	[thread overview]
Message-ID: <fa10eda0-cdc1-4c31-afaa-5cfa0a0e848b@linux.dev> (raw)
In-Reply-To: <16d53b65310325ae6e5c4c49c2ddbc02146050c34ffba04b25a071a70ffdf9cf@mail.kernel.org>



On 9/19/26 11:32 PM, bot+bpf-ci@kernel.org wrote:
>> diff --git a/include/linux/bpf.h b/include/linux/bpf.h
>> index 5033b934ffd9..0502b9fc4a6d 100644
>> --- a/include/linux/bpf.h
>> +++ b/include/linux/bpf.h
> [ ... ]
>
>> diff --git a/kernel/bpf/exception.c b/kernel/bpf/exception.c
>> index 4859d6484cc8..d4dcbcf4fb25 100644
>> --- a/kernel/bpf/exception.c
>> +++ b/kernel/bpf/exception.c
> [ ... ]
>
>> @@ -499,3 +501,164 @@ int bpf_cleanup_pad_of_call(struct bpf_verifier_env *env, u32 idx)
>>
>>   	return pad ? (int)pad - 1 : -1;
>>   }
>> +
>> +int bpf_cleanup_alloc_info(struct bpf_prog_aux *aux)
>> +{
>> +	if (aux->exc)
>> +		return 0;
>> +	aux->exc = kzalloc_obj(struct bpf_exception_info, GFP_KERNEL_ACCOUNT | __GFP_NOWARN);
>> +	return aux->exc ? 0 : -ENOMEM;
>> +}
>> +
>> +int bpf_cleanup_attach_info(struct bpf_prog_aux *aux, struct bpf_cleanup_info *recs, u32 cnt)
>> +{
>> +	struct bpf_exception_info *exc = aux->exc;
>> +	struct bpf_cleanup_range *ranges;
>> +	u32 i, n_at, *at;
>> +
>> +	if (!cnt) {
>> +		kvfree(recs);
>> +		return 0;
>> +	}
> This isn't a bug, but bpf_cleanup_attach_info()'s only caller already
> returns early when cnt is zero - is the `if (!cnt)` arm here reachable,
> or would dropping it (and letting the caller keep owning that case) make
> the recs ownership easier to follow?

Will drop the above if condition.

>
>> +
>> +	ranges = kvcalloc(cnt, sizeof(*ranges), GFP_KERNEL_ACCOUNT | __GFP_NOWARN);
> [ ... ]
>
>> diff --git a/kernel/bpf/fixups.c b/kernel/bpf/fixups.c
>> index 558653d3046d..169cbf9f4415 100644
>> --- a/kernel/bpf/fixups.c
>> +++ b/kernel/bpf/fixups.c
> [ ... ]
>
>> @@ -1114,6 +1124,129 @@ static void bpf_restore_subprog_starts(struct bpf_verifier_env *env, u32 *orig_s
>>   	env->subprog_info[env->subprog_cnt].start = env->prog->len;
>>   }
>>
>> +static int cleanup_pad_body_for_subprog(struct bpf_verifier_env *env, struct bpf_prog *sub,
>> +					u32 start, u32 end)
>> +{
>> +	unsigned long *bits;
>> +	u32 i, cnt = 0;
>> +
>> +	for (i = start; i < end; i++)
>> +		if (env->insn_aux_data[i].in_cleanup_pad)
>> +			cnt++;
>> +	if (!cnt)
>> +		return 0;
>> +
>> +	bits = bitmap_zalloc(end - start, GFP_KERNEL_ACCOUNT | __GFP_NOWARN);
>> +	if (!bits)
>> +		return -ENOMEM;
>> +
>> +	for (i = start; i < end; i++)
>> +		if (env->insn_aux_data[i].in_cleanup_pad)
>> +			__set_bit(i - start, bits);
>> +
>> +	sub->aux->exc->pad_body = bits;
>> +	sub->aux->exc->nr_pad_body = end - start;
>> +	return 0;
>> +}
> This isn't a bug, but would naming this field after the bitmap size
> rather than nr_pad_body make it clearer that it is the bit count and not
> the number of pad-body instructions, given the nr_throw_at /
> nr_resume_at siblings are true counts?

Will rename to pad_body_bits.

>
> [ ... ]
>
>
> ---
> AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
>
> CI run summary: https://github.com/kernel-patches/bpf/actions/runs/35492765538


  reply	other threads:[~2026-09-21 15:55 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20  5:42 [PATCH bpf-next v3 00/20] bpf: Run exception cleanup landing pads when bpf_throw() unwinds Yonghong Song
2026-09-20  5:42 ` [PATCH bpf-next v3 01/20] bpf: Accept the compiler's exception cleanup table at program load Yonghong Song
2026-09-20  5:56   ` sashiko-bot
2026-09-21 15:43     ` Yonghong Song
2026-09-20  6:32   ` bot+bpf-ci
2026-09-21 15:28     ` Yonghong Song
2026-09-20  5:42 ` [PATCH bpf-next v3 02/20] bpf: Add the bpf_unwind_resume() kfunc Yonghong Song
2026-09-20  5:42 ` [PATCH bpf-next v3 03/20] bpf: Add lookups for exception cleanup resumes and landing pads Yonghong Song
2026-09-20  6:31   ` bot+bpf-ci
2026-09-21 14:06     ` Yonghong Song
2026-09-20  5:42 ` [PATCH bpf-next v3 04/20] bpf: Prepare for an exception cleanup table before the CFG walk Yonghong Song
2026-09-20  5:42 ` [PATCH bpf-next v3 05/20] bpf: Make exception landing pads reachable in the CFG Yonghong Song
2026-09-20  5:42 ` [PATCH bpf-next v3 06/20] bpf: Explore the landing pads no call site reaches Yonghong Song
2026-09-20  5:43 ` [PATCH bpf-next v3 07/20] bpf: Refuse exception cleanup shapes bpf_throw() cannot dispatch Yonghong Song
2026-09-20  6:32   ` bot+bpf-ci
2026-09-21 14:08     ` Yonghong Song
2026-09-20  5:43 ` [PATCH bpf-next v3 08/20] bpf: Walk the exception unwind in the verifier Yonghong Song
2026-09-20  5:43 ` [PATCH bpf-next v3 09/20] bpf: Refuse a private stack for a program with an exception cleanup table Yonghong Song
2026-09-20  5:43 ` [PATCH bpf-next v3 10/20] bpf: Dispatch exception cleanup pads from bpf_throw() Yonghong Song
2026-09-20  6:32   ` bot+bpf-ci
2026-09-21 15:55     ` Yonghong Song [this message]
2026-09-20  5:43 ` [PATCH bpf-next v3 11/20] bpf, x86: Dispatch exception cleanup pads at run time Yonghong Song
2026-09-20  5:43 ` [PATCH bpf-next v3 12/20] bpf, arm64: " Yonghong Song
2026-09-20  5:43 ` [PATCH bpf-next v3 13/20] libbpf: Resolve the compiler's _Unwind_Resume to the kernel's kfunc Yonghong Song
2026-09-20  5:43 ` [PATCH bpf-next v3 14/20] libbpf: Add cleanup_info to bpf_prog_load_opts Yonghong Song
2026-09-20  6:31   ` bot+bpf-ci
2026-09-21 15:00     ` Yonghong Song
2026-09-20  5:43 ` [PATCH bpf-next v3 15/20] libbpf: Collect .bpf_cleanup records and pass them to the kernel Yonghong Song
2026-09-20  5:43 ` [PATCH bpf-next v3 16/20] libbpf: Carry the exception cleanup table through the light skeleton Yonghong Song
2026-09-20  6:01   ` sashiko-bot
2026-09-21 14:14     ` Yonghong Song
2026-09-20  5:43 ` [PATCH bpf-next v3 17/20] libbpf: Let the static linker carry .bpf_cleanup relocations Yonghong Song
2026-09-20  6:00   ` sashiko-bot
2026-09-21 14:20     ` Yonghong Song
2026-09-20  6:31   ` bot+bpf-ci
2026-09-21 14:21     ` Yonghong Song
2026-09-20  5:43 ` [PATCH bpf-next v3 18/20] selftests/bpf: Add an end-to-end .bpf_cleanup exception test Yonghong Song
2026-09-20  5:59   ` sashiko-bot
2026-09-20  5:44 ` [PATCH bpf-next v3 19/20] selftests/bpf: Cover the exception cleanup shapes the chain does not reach Yonghong Song
2026-09-20  6:01   ` sashiko-bot
2026-09-20  6:46   ` bot+bpf-ci
2026-09-21 14:27     ` Yonghong Song
2026-09-20  5:44 ` [PATCH bpf-next v3 20/20] selftests/bpf: Load an exception cleanup program from a light skeleton Yonghong Song
2026-09-20  6:31   ` bot+bpf-ci
2026-09-21 14:30     ` Yonghong Song

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=fa10eda0-cdc1-4c31-afaa-5cfa0a0e848b@linux.dev \
    --to=yonghong.song@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bot+bpf-ci@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@kernel.org \
    --cc=mason@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.