[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230331170504.umr5zmcraburmtkg@dhcp-172-26-102-232.dhcp.thefacebook.com>
Date: Fri, 31 Mar 2023 10:05:04 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: David Vernet <void@...ifault.com>
Cc: bpf@...r.kernel.org, ast@...nel.org, daniel@...earbox.net,
andrii@...nel.org, martin.lau@...ux.dev, song@...nel.org,
yhs@...com, john.fastabend@...il.com, kpsingh@...nel.org,
sdf@...gle.com, haoluo@...gle.com, jolsa@...nel.org,
linux-kernel@...r.kernel.org, kernel-team@...a.com
Subject: Re: [PATCH bpf-next 1/3] bpf: Make struct task_struct an RCU-safe
type
On Thu, Mar 30, 2023 at 07:57:31PM -0500, David Vernet wrote:
> kernel/bpf/helpers.c | 11 ++-
> kernel/bpf/verifier.c | 1 +
> .../selftests/bpf/prog_tests/task_kfunc.c | 2 +
> .../selftests/bpf/progs/task_kfunc_common.h | 5 +
> .../selftests/bpf/progs/task_kfunc_failure.c | 98 +++++++++++++++++--
> .../selftests/bpf/progs/task_kfunc_success.c | 52 +++++++++-
> 6 files changed, 153 insertions(+), 16 deletions(-)
See CI failures on gcc compiled kernel:
https://github.com/kernel-patches/bpf/actions/runs/4570493668/jobs/8068004031
> __bpf_kfunc struct task_struct *bpf_task_acquire(struct task_struct *p)
> {
> - return get_task_struct(p);
> + if (refcount_inc_not_zero(&p->rcu_users))
> + return p;
> + return NULL;
> }
I wonder whether we should add a bit of safety net here.
Like do not allow acquire of tasks with PF_KTHREAD | PF_EXITING
or at least is_idle_task ?
Powered by blists - more mailing lists