mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: bot+bpf-ci@kernel.org
To: changwoo@igalia.com,ast@kernel.org,daniel@iogearbox.net,andrii@kernel.org
Cc: martin.lau@linux.dev,eddyz87@gmail.com,song@kernel.org,yonghong.song@linux.dev,john.fastabend@gmail.com,kpsingh@kernel.org,sdf@fomichev.me,haoluo@google.com,jolsa@kernel.org,shuah@kernel.org,kernel-dev@igalia.com,bpf@vger.kernel.org,sched-ext@lists.linux.dev,linux-kernel@vger.kernel.org,linux-kselftest@vger.kernel.org,changwoo@igalia.com,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,clm@meta.com,ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v1 2/2] selftests/bpf: Add tests for execution context kfuncs
Date: Fri, 23 Jan 2026 09:08:07 +0000 (UTC)	[thread overview]
Message-ID: <109e6caa10a260b0f02b2595fb021db560daf0b77e9b3d1db61ee57191d6fd25@mail.kernel.org> (raw)
In-Reply-To: <20260123084248.259278-3-changwoo@igalia.com>

[-- Attachment #1: Type: text/plain, Size: 1601 bytes --]

> diff --git a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
> index 77a81fa8ec6a..8c7add48e447 100644
> --- a/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c
> +++ b/tools/testing/selftests/bpf/test_kmods/bpf_testmod.c

[ ... ]

> +/* IRQ Work for HardIRQ context */
> +static void ctx_check_irq_fn(struct irq_work *work)
> +{
> +	bpf_testmod_test_hardirq_fn();
> +	tasklet_schedule(&ctx_check_tasklet);
> +}

[ ... ]

> @@ -1844,6 +1872,10 @@ static void bpf_testmod_exit(void)
>  	while (refcount_read(&prog_test_struct.cnt) > 1)
>  		msleep(20);
>
> +	/* Clean up tasklet and irqwork */
> +	tasklet_kill(&ctx_check_tasklet);
> +	irq_work_sync(&ctx_check_irq);

Should the cleanup order be reversed here? The irq_work handler
ctx_check_irq_fn() calls tasklet_schedule(&ctx_check_tasklet). If the
irq_work is still pending when tasklet_kill() is called, the subsequent
irq_work_sync() may trigger the irq_work to run, which would then re-schedule
the already-killed tasklet.

This could lead to a use-after-free if the module unload completes while a
newly scheduled tasklet is still pending, since ctx_check_tasklet_fn() would
point to freed module code.

Would swapping these to call irq_work_sync() first ensure the irq_work cannot
schedule any more tasklets before tasklet_kill() runs?


---
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/21280227502

      reply	other threads:[~2026-01-23  9:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-23  8:42 [PATCH bpf-next v1 0/2] bpf: Introduce execution context detection kfuncs Changwoo Min
2026-01-23  8:42 ` [PATCH bpf-next v1 1/2] " Changwoo Min
2026-01-23 16:37   ` Alexei Starovoitov
2026-01-24 11:29     ` Changwoo Min
2026-01-23  8:42 ` [PATCH bpf-next v1 2/2] selftests/bpf: Add tests for execution context kfuncs Changwoo Min
2026-01-23  9:08   ` bot+bpf-ci [this message]

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=109e6caa10a260b0f02b2595fb021db560daf0b77e9b3d1db61ee57191d6fd25@mail.kernel.org \
    --to=bot+bpf-ci@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=changwoo@igalia.com \
    --cc=clm@meta.com \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kernel-dev@igalia.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=sched-ext@lists.linux.dev \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --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

all inboxes | Powered by JetHome®