public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: David Vernet <void@manifault.com>,
	ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org
Cc: kernel-team@fb.com, bpf@vger.kernel.org,
	linux-kernel@vger.kernel.org, yhs@fb.com, song@kernel.org,
	john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com,
	haoluo@google.com, jolsa@kernel.org, tj@kernel.org,
	memxor@gmail.com
Subject: Re: [PATCH v2 1/2] bpf: Add kfuncs for storing struct task_struct * as a kptr
Date: Mon, 3 Oct 2022 12:20:57 -0700	[thread overview]
Message-ID: <b27deaa1-7ab2-a969-3475-4fa78db34f86@linux.dev> (raw)
In-Reply-To: <20221001144716.3403120-2-void@manifault.com>

On 10/1/22 7:47 AM, David Vernet wrote:
> diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
> index b069517a3da0..36cbe1b8f8b1 100644
> --- a/kernel/bpf/helpers.c
> +++ b/kernel/bpf/helpers.c
> @@ -1700,20 +1700,93 @@ bpf_base_func_proto(enum bpf_func_id func_id)
>   	}
>   }
>   
> -BTF_SET8_START(tracing_btf_ids)
> +__diag_push();
> +__diag_ignore_all("-Wmissing-prototypes",
> +		  "Global functions as their definitions will be in vmlinux BTF");
> +
> +/**
> + * bpf_task_acquire - Acquire a reference to a task. A task acquired by this
> + * kfunc which is not stored in a map as a kptr, must be released by calling
> + * bpf_task_release().
> + * @p: The task on which a reference is being acquired.
> + */
> +__used noinline
> +struct task_struct *bpf_task_acquire(struct task_struct *p)
> +{
> +	refcount_inc(&p->rcu_users);

This probably needs to be refcount_inc_not_zero() also for the cases like during 
the task free tracepoint ?

  reply	other threads:[~2022-10-03 19:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-01 14:47 [PATCH v2 0/2] Support storing struct task_struct objects as kptrs David Vernet
2022-10-01 14:47 ` [PATCH v2 1/2] bpf: Add kfuncs for storing struct task_struct * as a kptr David Vernet
2022-10-03 19:20   ` Martin KaFai Lau [this message]
2022-10-03 21:06     ` David Vernet
2022-10-01 14:47 ` [PATCH v2 2/2] bpf/selftests: Add selftests for new task kfuncs David Vernet
2022-10-03  0:32   ` Kumar Kartikeya Dwivedi
2022-10-03 15:35     ` David Vernet
2022-10-03 15:56       ` Kumar Kartikeya Dwivedi
2022-10-03 19:53         ` Martin KaFai Lau
2022-10-03 21:03           ` Kumar Kartikeya Dwivedi
2022-10-03 21:59             ` David Vernet
2022-10-03 22:22               ` Kumar Kartikeya Dwivedi
2022-10-04 15:10                 ` David Vernet
2022-10-11  2:29                   ` Kumar Kartikeya Dwivedi
2022-10-11  2:40                     ` David Vernet
2022-10-04  5:10             ` Martin KaFai Lau

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=b27deaa1-7ab2-a969-3475-4fa78db34f86@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kernel-team@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=memxor@gmail.com \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=tj@kernel.org \
    --cc=void@manifault.com \
    --cc=yhs@fb.com \
    /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