1. 24 8月, 2022 29 次提交
  2. 27 7月, 2022 2 次提交
  3. 06 7月, 2022 1 次提交
  4. 23 5月, 2022 1 次提交
  5. 21 10月, 2021 2 次提交
  6. 19 10月, 2021 2 次提交
  7. 19 4月, 2021 1 次提交
  8. 09 4月, 2021 1 次提交
    • M
      libbpf: Ignore non function pointer member in struct_ops · c982af9f
      Martin KaFai Lau 提交于
      stable inclusion
      from stable-5.10.20
      commit c8de71a7ae39e5f55b4ef5851387e2661c87f30b
      bugzilla: 50608
      
      --------------------------------
      
      [ Upstream commit d2836ddd ]
      
      When libbpf initializes the kernel's struct_ops in
      "bpf_map__init_kern_struct_ops()", it enforces all
      pointer types must be a function pointer and rejects
      others.  It turns out to be too strict.  For example,
      when directly using "struct tcp_congestion_ops" from vmlinux.h,
      it has a "struct module *owner" member and it is set to NULL
      in a bpf_tcp_cc.o.
      
      Instead, it only needs to ensure the member is a function
      pointer if it has been set (relocated) to a bpf-prog.
      This patch moves the "btf_is_func_proto(kern_mtype)" check
      after the existing "if (!prog) { continue; }".  The original debug
      message in "if (!prog) { continue; }" is also removed since it is
      no longer valid.  Beside, there is a later debug message to tell
      which function pointer is set.
      
      The "btf_is_func_proto(mtype)" has already been guaranteed
      in "bpf_object__collect_st_ops_relos()" which has been run
      before "bpf_map__init_kern_struct_ops()".  Thus, this check
      is removed.
      
      v2:
      - Remove outdated debug message (Andrii)
        Remove because there is a later debug message to tell
        which function pointer is set.
      - Following mtype->type is no longer needed. Remove:
        "skip_mods_and_typedefs(btf, mtype->type, &mtype_id)"
      - Do "if (!prog)" test before skip_mods_and_typedefs.
      
      Fixes: 590a0088 ("bpf: libbpf: Add STRUCT_OPS support")
      Signed-off-by: NMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
      Acked-by: NAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20210212021030.266932-1-kafai@fb.comSigned-off-by: NSasha Levin <sashal@kernel.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      c982af9f
  9. 12 1月, 2021 1 次提交