BPF List
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: Amery Hung <amery.hung@bytedance.com>
Cc: bpf@vger.kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	alexei.starovoitov@gmail.com, martin.lau@kernel.org,
	houtao@huaweicloud.com, davemarchevsky@fb.com,
	ameryhung@gmail.com
Subject: Re: [PATCH bpf-next] selftests/bpf: Make sure stashed kptr in local kptr is freed recursively
Date: Wed, 28 Aug 2024 16:38:50 -0700	[thread overview]
Message-ID: <9b57a793-2b30-45bb-bddd-3034c80c1451@linux.dev> (raw)
In-Reply-To: <20240827011301.608620-1-amery.hung@bytedance.com>

On 8/26/24 6:13 PM, Amery Hung wrote:
> When dropping a local kptr, any kptr stashed into it is supposed to be
> freed through bpf_obj_free_fields->__bpf_obj_drop_impl recursively. Add a
> test to make sure it happens.
> 
> The test first stashes a referenced kptr to "struct task" into a local
> kptr and gets the reference count of the task. Then, it drops the local
> kptr and reads the reference count of the task again. Since
> bpf_obj_free_fields and __bpf_obj_drop_impl will go through the local kptr
> recursively during bpf_obj_drop, the dtor of the stashed task kptr should
> eventually be called. The second reference count should be one less than
> the first one.

Acked-by: Martin KaFai Lau <martin.lau@kernel.org>


  reply	other threads:[~2024-08-28 23:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27  1:13 [PATCH bpf-next] selftests/bpf: Make sure stashed kptr in local kptr is freed recursively Amery Hung
2024-08-28 23:38 ` Martin KaFai Lau [this message]
2024-08-29 19:20 ` patchwork-bot+netdevbpf

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=9b57a793-2b30-45bb-bddd-3034c80c1451@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=alexei.starovoitov@gmail.com \
    --cc=amery.hung@bytedance.com \
    --cc=ameryhung@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davemarchevsky@fb.com \
    --cc=houtao@huaweicloud.com \
    --cc=martin.lau@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox