update 2026-10-19 17:31:01

This commit is contained in:
action committed 2026-10-19 17:31:01 +08:00
1 parent 6604b3420d
commit 313fe55d56
38 files changed
+982 -1508

No files matched your search

+76
View File
@@ -0,0 +1,76 @@
#include <linux/kconfig.h>
#ifndef KBUILD_MODNAME
#define KBUILD_MODNAME "shadow_btf_core"
#endif
#ifndef KBUILD_BASENAME
#define KBUILD_BASENAME "shadow_btf_core"
#endif
#include <linux/types.h>
#include <linux/ptrace.h>
#include <linux/sched.h>
#include <linux/mm_types.h>
#include <linux/fs.h>
#include <linux/dcache.h>
#include <linux/cred.h>
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/if_ether.h>
#include <linux/ip.h>
#include <linux/tcp.h>
#include <linux/udp.h>
#include <linux/icmp.h>
#include <linux/bpf.h>
#include <linux/bpf_perf_event.h>
#include <net/sock.h>
#include <net/inet_sock.h>
#include <net/inet_connection_sock.h>
#include <net/net_namespace.h>
#include <net/dst.h>
#include <net/neighbour.h>
#include <net/xdp.h>
#include <net/ip.h>
#if __has_include(<net/netdev_rx_queue.h>)
#include <net/netdev_rx_queue.h>
#endif
#if __has_include(<linux/bpf_iter.h>)
#include <linux/bpf_iter.h>
#endif
#if IS_ENABLED(CONFIG_CGROUPS)
#include <linux/cgroup.h>
#endif
#define BTF_KEEP(name, type) \
static type * __attribute__((used, section(".discard.btf_keep"))) \
__btf_keep_##name
BTF_KEEP(pt_regs, struct pt_regs);
BTF_KEEP(task_struct, struct task_struct);
BTF_KEEP(mm_struct, struct mm_struct);
BTF_KEEP(file, struct file);
BTF_KEEP(dentry, struct dentry);
BTF_KEEP(inode, struct inode);
BTF_KEEP(cred, struct cred);
BTF_KEEP(module, struct module);
BTF_KEEP(sk_buff, struct sk_buff);
BTF_KEEP(net_device, struct net_device);
BTF_KEEP(netdev_queue, struct netdev_queue);
BTF_KEEP(netdev_rx_queue, struct netdev_rx_queue);
BTF_KEEP(sock, struct sock);
BTF_KEEP(inet_sock, struct inet_sock);
BTF_KEEP(inet_connection_sock, struct inet_connection_sock);
BTF_KEEP(tcp_sock, struct tcp_sock);
BTF_KEEP(udp_sock, struct udp_sock);
BTF_KEEP(net, struct net);
BTF_KEEP(dst_entry, struct dst_entry);
BTF_KEEP(neighbour, struct neighbour);
BTF_KEEP(xdp_buff, struct xdp_buff);
BTF_KEEP(bpf_perf_event_data, struct bpf_perf_event_data);
#if IS_ENABLED(CONFIG_CGROUPS)
BTF_KEEP(cgroup, struct cgroup);
#endif
+79
View File
@@ -0,0 +1,79 @@
#include <linux/kconfig.h>
#ifndef KBUILD_MODNAME
#define KBUILD_MODNAME "shadow_btf_modules"
#endif
#ifndef KBUILD_BASENAME
#define KBUILD_BASENAME "shadow_btf_modules"
#endif
#include <linux/types.h>
#define BTF_KEEP(name, type) \
static type * __attribute__((used, section(".discard.btf_keep"))) \
__btf_keep_##name
#if IS_ENABLED(CONFIG_INET)
#include <net/route.h>
#include <net/ip_fib.h>
BTF_KEEP(rtable, struct rtable);
#endif
#if IS_ENABLED(CONFIG_IPV6)
#include <net/ipv6.h>
#include <net/if_inet6.h>
BTF_KEEP(ipv6_pinfo, struct ipv6_pinfo);
#endif
#if IS_ENABLED(CONFIG_NETFILTER)
#include <linux/netfilter.h>
BTF_KEEP(nf_hook_state, struct nf_hook_state);
#endif
#if IS_ENABLED(CONFIG_NF_CONNTRACK)
#include <net/netfilter/nf_conntrack.h>
#include <net/netfilter/nf_conntrack_tuple.h>
BTF_KEEP(nf_conn, struct nf_conn);
BTF_KEEP(nf_conntrack_tuple, struct nf_conntrack_tuple);
#endif
#if IS_ENABLED(CONFIG_NF_NAT) && __has_include(<net/netfilter/nf_nat.h>)
#include <net/netfilter/nf_nat.h>
BTF_KEEP(nf_conn_nat, struct nf_conn_nat);
#endif
#if IS_ENABLED(CONFIG_NF_TABLES) && __has_include(<net/netfilter/nf_tables.h>)
#include <net/netfilter/nf_tables.h>
BTF_KEEP(nft_pktinfo, struct nft_pktinfo);
#endif
#if IS_ENABLED(CONFIG_NF_FLOW_TABLE) && __has_include(<net/netfilter/nf_flow_table.h>)
#include <net/netfilter/nf_flow_table.h>
BTF_KEEP(flow_offload, struct flow_offload);
#endif
#if IS_ENABLED(CONFIG_NETFILTER_XTABLES)
#include <linux/netfilter/x_tables.h>
BTF_KEEP(xt_table, struct xt_table);
BTF_KEEP(xt_action_param, struct xt_action_param);
#endif
#if IS_ENABLED(CONFIG_NET_SCHED)
#include <net/sch_generic.h>
#include <net/pkt_sched.h>
BTF_KEEP(qdisc, struct Qdisc);
#endif
#if IS_ENABLED(CONFIG_NET_CLS) && __has_include(<net/pkt_cls.h>)
#include <net/pkt_cls.h>
BTF_KEEP(tcf_result, struct tcf_result);
#endif
#if IS_ENABLED(CONFIG_NET_CLS_ACT) && __has_include(<net/act_api.h>)
#include <net/act_api.h>
#endif
#if IS_ENABLED(CONFIG_XDP_SOCKETS) && __has_include(<net/xdp_sock.h>)
#include <net/xdp_sock.h>
BTF_KEEP(xdp_sock, struct xdp_sock);
#endif
+23
View File
@@ -0,0 +1,23 @@
#include <linux/kconfig.h>
#ifndef KBUILD_MODNAME
#define KBUILD_MODNAME "shadow_btf_private"
#endif
#ifndef KBUILD_BASENAME
#define KBUILD_BASENAME "shadow_btf_private"
#endif
#define BTF_KEEP(name, type) \
static type * __attribute__((used, section(".discard.btf_keep"))) \
__btf_keep_##name
#if IS_ENABLED(CONFIG_BRIDGE) && __has_include("net/bridge/br_private.h")
#include "net/bridge/br_private.h"
BTF_KEEP(net_bridge, struct net_bridge);
BTF_KEEP(net_bridge_port, struct net_bridge_port);
#endif
#if __has_include("fs/mount.h")
#include "fs/mount.h"
BTF_KEEP(mount, struct mount);
#endif