• Dave Marchevsky's avatar
    selftests/bpf: Add refcounted_kptr tests · 6147f151
    Dave Marchevsky authored
    Test refcounted local kptr functionality added in previous patches in
    the series.
    
    Usecases which pass verification:
    
    * Add refcounted local kptr to both tree and list. Then, read and -
      possibly, depending on test variant - delete from tree, then list.
      * Also test doing read-and-maybe-delete in opposite order
    * Stash a refcounted local kptr in a map_value, then add it to a
      rbtree. Read from both, possibly deleting after tree read.
    * Add refcounted local kptr to both tree and list. Then, try reading and
      deleting twice from one of the collections.
    * bpf_refcount_acquire of just-added non-owning ref should work, as
      should bpf_refcount_acquire of owning ref just out of bpf_obj_new
    
    Usecases which fail verification:
    
    * The simple successful bpf_refcount_acquire cases from above should
      both fail to verify if the newly-acquired owning ref is not dropped
    Signed-off-by: default avatarDave Marchevsky <davemarchevsky@fb.com>
    Link: https://lore.kernel.org/r/20230415201811.343116-10-davemarchevsky@fb.comSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    6147f151
refcounted_kptr.c 368 Bytes