Re: [PATCH bpf-next v2 2/7] bpf: Support kptrs in local storage maps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 21, 2023 at 12:06 PM Kumar Kartikeya Dwivedi
<memxor@xxxxxxxxx> wrote:
>
> Enable support for kptrs in local storage maps by wiring up the freeing
> of these kptrs from map value.
>
> Cc: Martin KaFai Lau <martin.lau@xxxxxxxxxx>
> Cc: KP Singh <kpsingh@xxxxxxxxxx>
> Cc: Paul E. McKenney <paulmck@xxxxxxxxxx>
> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx>
> ---
>  kernel/bpf/bpf_local_storage.c | 35 ++++++++++++++++++++++++++++++----
>  kernel/bpf/syscall.c           |  6 +++++-
>  kernel/bpf/verifier.c          | 12 ++++++++----
>  3 files changed, 44 insertions(+), 9 deletions(-)
>
> diff --git a/kernel/bpf/bpf_local_storage.c b/kernel/bpf/bpf_local_storage.c
> index 35f4138a54dc..2803b85b30b2 100644
> --- a/kernel/bpf/bpf_local_storage.c
> +++ b/kernel/bpf/bpf_local_storage.c
> @@ -75,6 +75,7 @@ bpf_selem_alloc(struct bpf_local_storage_map *smap, void *owner,
>         if (selem) {
>                 if (value)
>                         copy_map_value(&smap->map, SDATA(selem)->data, value);
> +               /* No need to call check_and_init_map_value as memory is zero init */
>                 return selem;
>         }
>
> @@ -103,10 +104,17 @@ static void bpf_selem_free_rcu(struct rcu_head *rcu)
>         struct bpf_local_storage_elem *selem;
>
>         selem = container_of(rcu, struct bpf_local_storage_elem, rcu);
> +       bpf_obj_free_fields(SDATA(selem)->smap->map.record, SDATA(selem)->data);
> +       kfree(selem);

CI is saying that clang compiled kernel crashes here:
https://github.com/kernel-patches/bpf/actions/runs/4239645973/jobs/7368557262

[ 18.596262] BUG: unable to handle page fault for address: 00000000ffffffff
[ 18.599128] RIP: 0010:bpf_obj_free_fields+0x29/0x110 [ 18.605706] <TASK>
[ 18.605844] bpf_selem_free_tasks_trace_rcu+0x22/0x30
[ 18.606171] rcu_tasks_invoke_cbs+0x150/0x210
[ 18.606449] rcu_tasks_one_gp+0x401/0x430
[ 18.606701] rcu_tasks_kthread+0x35/0x50

map.record somehow became (u32)-1 ?

aarch64 failures look related too:
libbpf: prog 'test_ls_map_kptr_ref1': failed to attach: ERROR:
strerror_r(-524)=22
test_map_kptr_success:FAIL:bpf_program__attach ref1 unexpected error: -524
#124/26 map_kptr/success-map:FAIL

Please pay attention to CI in the future.
It's the developer's job to monitor it for their patches.



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux