Storing sk_buffs as kptrs in map

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

 



Hello eBPFers,

I have a use case where I would like to store sk_buff pointers as kptrs in
eBPF map. To do so, I am borrowing skb kfuncs for acquire/release/destroy
from Amery Hung's bpf qdisc set [0], but they are registered for
BPF_PROG_TYPE_SCHED_CLS programs.

TL;DR - due to following callstack:

do_check()
  check_kfunc_call()
    check_kfunc_args()
      get_kfunc_ptr_arg_type()
          btf_is_prog_ctx_type()
              btf_is_projection_of() -- return true

sk_buff argument is being interpreted as KF_ARG_PTR_TO_CTX, but what we
have there is KF_ARG_PTR_TO_BTF_ID. Verifier is unhappy about it. Should
this be workarounded via some typedef or adding mentioned kfuncs to
special_kfunc_list ? If the latter, then what else needs to be handled?

Commenting out sk_buff part from btf_is_projection_of() makes it work, but
that probably is not a solution:)

Another question is in case bpf qdisc set lands, could we have these
kfuncs not being limited to BPF_PROG_TYPE_STRUCT_OPS ?

I would be thankful for any pointers/stions regarding this issue.
Maciej

[0]: https://lore.kernel.org/bpf/20240714175130.4051012-7-amery.hung@xxxxxxxxxxxxx/




[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