Przeglądaj źródła

btf: add linux/btf.h include to xdp.c so BTF_TYPE_EMIT is declared

TheWildJames 1 miesiąc temu
rodzic
commit
785114abfa

+ 2 - 0
.github/actions/btf/action.yml

@@ -43,6 +43,8 @@ runs:
         # emission with BTF_TYPE_EMIT in net/core/xdp.c, which includes
         # <net/xdp.h> (the struct must be COMPLETE at the emit point, so it
         # cannot live in filter.c where xdp_buff is only forward-declared).
+        # The patch also adds #include <linux/btf.h> so BTF_TYPE_EMIT is
+        # declared in xdp.c (filter.c already pulls it in).
         # Idempotent/harmless on newer sublevels.
         patch -p1 -N < ${{ github.action_path }}/patches/0003-btf-emit-xdp-buff.patch
 

+ 11 - 3
.github/actions/btf/patches/0003-btf-emit-xdp-buff.patch

@@ -1,14 +1,22 @@
 --- a/net/core/xdp.c
 +++ b/net/core/xdp.c
-@@ -387,6 +387,13 @@
+@@ -12,6 +12,7 @@
+ #include <linux/idr.h>
+ #include <linux/rhashtable.h>
+ #include <linux/bug.h>
++#include <linux/btf.h>
+ #include <net/page_pool.h>
+ 
+ #include <net/xdp.h>
+@@ -387,6 +388,13 @@
  void xdp_return_buff(struct xdp_buff *xdp)
  {
  	__xdp_return(xdp->data, &xdp->rxq->mem, true, xdp);
 +	/* xdp_buff is referenced via BTF_ID_LIST_SINGLE(bpf_xdp_output_btf_ids)
 +	 * in net/core/filter.c but is not otherwise emitted into vmlinux BTF,
 +	 * so resolve_btfids aborts with "unresolved symbol xdp_buff". Force BTF
-+	 * emission here where the struct is complete (this file includes
-+	 * <net/xdp.h>). */
++	 * emission here where the struct is complete (this file includes both
++	 * <net/xdp.h> for the type and <linux/btf.h> for BTF_TYPE_EMIT). */
 +	BTF_TYPE_EMIT(struct xdp_buff);
 +
  }