Skip to content

Duplicated output from bpftool btf dump #196

@privacyguy123

Description

@privacyguy123

Not a "bug" report because I cannot rule out that the problem isn't indeed my old goofy Samsung kernel source.

I have tried running both pahole and bpftool dump on the kernel image outputted by stock build - I doesnt generate btf info by default but I backported the link-vmlinux.sh patch that fixes that part. Both dumps from both programs contain strange duplicated struct blocks which of course is a headache to deal with the size of the file, manual cleanup scripts are not getting me there and often just make the problem worse even. I would love to know what it is I am seeing that is going wrong here - here's an example of the duplicated mess I see from a bpftool dump out/vmlinux

struct xdp_bulk_queue___2 {
struct xdp_frame___2 {
        struct net_device___2 *dev_rx;
        struct mutex___2 mutex;
        spinlock_t___2 tx_completion_lock;
        spinlock_t___2 xsk_list_lock;
        int (*handler)(struct sk_buff___2 *);
        int (*input_handler)(struct sk_buff___2 *, int, __be32, int);
        int (*cb_handler)(struct sk_buff___2 *, int);
        int (*err_handler)(struct sk_buff___2 *, u32);
        int (*handler)(struct sk_buff___2 *);
        int (*cb_handler)(struct sk_buff___2 *, int);
        int (*err_handler)(struct sk_buff___2 *, struct inet6_skb_parm *, u8, u8, int, __be32);
        int (*handler)(struct sk_buff___2 *);
        int (*err_handler)(struct sk_buff___2 *, struct inet6_skb_parm *, u8, u8, int, __be32);
        int (*callback)(struct sk_buff___2 *, u8, int);
        struct module___2 *owner;
        rwlock_t___2 lock;
        struct module___2 *owner;
        int (*handler)(struct sk_buff___2 *);
        int (*err_handler)(struct sk_buff___2 *, u32);
        struct module___2 *owner;
        struct module___2 *owner;
        spinlock_t___2 lock;
        struct dentry___2 *root;
        spinlock_t___2 lock;
        struct mutex___2 mutex;
        struct dentry___2 *debugfs_root;
        struct dentry___2 *debugfs_slots;
        struct dentry___2 *parent;
        struct radix_tree_root___2 *trb_address_map;
        struct dentry___2 *root;
        struct radix_tree_root___2 trb_address_map;
        struct module___2 *me;
        struct module___2 *me;
        struct module___2 *me;
        struct rw_semaphore___2 init_lock;
        spinlock_t___2 wb_limit_lock;
        struct block_device___2 *bdev;
        struct task_struct___2 *wbd;
        spinlock_t___2 list_lock;
        spinlock_t___2 wb_table_lock;
        spinlock_t___2 bitmap_lock;
        struct mutex___2 blk_bitmap_lock;
        spinlock_t___2 lock;
        struct page___2 *s_page;
        struct page___2 *d_page;
        struct wait_queue_head___2 migration_wait;
        struct page___2 *first_page;
        struct mutex___2 set_reg_lock;
        struct mutex___2 set_lpmode_lock;
        struct mutex___2 modechange;
        struct mutex___2 work_lock;
        struct mutex___2 raw_data_lock;
        struct mutex___2 i2c_mutex;
        struct mutex___2 sponge_mutex;
        struct mutex___2 power_init;
        struct mutex___2 lock;
typedef int (*bpf_op_t)(struct net_device___2 *, struct netdev_bpf *);
typedef void compound_page_dtor(struct page___2 *);
typedef void compound_page_dtor___2(struct page *);
typedef u32 (*coresight_read_fn___2)(const struct device___2 *, u32);
typedef struct vfsmount___2 * (*debugfs_automount_t)(struct dentry *, void *);
typedef void (*dr_release_t___2)(struct device___2 *, void *);
typedef int drm_ioctl_compat_t(struct file___2 *, unsigned int, long unsigned int);
typedef void elevator_exit_icq_fn___2(struct io_cq___2 *);
typedef void elevator_init_icq_fn___2(struct io_cq___2 *);
typedef int gifconf_func_t(struct net_device___2 *, char *, int, int);
typedef struct sk_buff___2 * (*gro_receive_sk_t)(struct sock *, struct list_head *, struct sk_buff___2 *);
typedef struct sk_buff___2 * (*gro_receive_t)(struct list_head *, struct sk_buff___2 *);
typedef struct sk_buff * (*gro_receive_t___2)(struct list_head *, struct sk_buff *);
typedef void (*hci_req_complete_skb_t___2)(struct hci_dev *, u8, u16, struct sk_buff___2 *);
typedef void (*hfi_cmd_response_callback)(enum hal_command_response___2, void *);
typedef void (*hfi_cmd_response_callback___2)(enum hal_command_response, void *);
typedef int (*initxattrs)(struct inode___2 *, const struct xattr *, void *);
typedef loff_t (*iomap_actor_t)(struct inode___2 *, loff_t, loff_t, void *, struct iomap *);
typedef int (*iommu_fault_handler_t___2)(struct iommu_domain *, struct device___2 *, long unsigned int, int, void *);
typedef void ip6_icmp_send_t(struct sk_buff___2 *, u8, u8, __u32, const struct in6_addr *);
typedef int (*iw_handler___2)(struct net_device___2 *, struct iw_request_info *, union iwreq_data *, char *);
typedef enum lru_status (*list_lru_walk_cb)(struct list_head *, struct list_lru_one *, spinlock_t___2 *, void *);
typedef enum lru_status (*list_lru_walk_cb___2)(struct list_head *, struct list_lru_one *, spinlock_t *, void *);
typedef unsigned int nf_hookfn___2(void *, struct sk_buff___2 *, const struct nf_hook_state *);
typedef void nf_logfn___2(struct net___2 *, u_int8_t, unsigned int, const struct sk_buff *, const struct net_device *, const struct net_device *, const struct nf_loginfo *, const char *);
typedef void nf_logfn___3(struct net *, u_int8_t, unsigned int, const struct sk_buff___2 *, const struct net_device___2 *, const struct net_device___2 *, const struct nf_loginfo *, const char *);
typedef struct ns_common___2 *ns_get_path_helper_t(void *);
typedef void perf_iterate_f(struct perf_event___2 *, void *);
typedef int (*pkt_func_def___2)(u32, void *, struct msm_vidc_cb_info *);
typedef struct rt6_info * (*pol_lookup_t)(struct net___2 *, struct fib6_table *, struct flowi6 *, const struct sk_buff *, int);
typedef void (*poll_queue_proc___3)(struct file *, wait_queue_head_t___2 *, struct poll_table_struct *);
typedef void (*poll_queue_proc___4)(struct file___2 *, wait_queue_head_t___2 *, struct poll_table_struct *);
typedef void (*poll_queue_proc___5)(struct file___2 *, wait_queue_head_t *, struct poll_table_struct *);
typedef int (*proc_visitor)(struct task_struct___2 *, void *);
typedef int (*proc_write_t___2)(struct file *, char *, size_t);
typedef int (*pte_fn_t)(pte_t *, pgtable_t___2, long unsigned int, void *);
typedef void (*radix_tree_update_node_t)(struct radix_tree_node___2 *);
typedef void (*radix_tree_update_node_t___2)(struct radix_tree_node *);
typedef int (*request_key_actor_t___2)(struct key___2 *, void *);
typedef enum sctp_disposition sctp_state_fn_t___2(struct net *, const struct sctp_endpoint *, const struct sctp_association *, const union sctp_subtype, void *, struct sctp_cmd_seq *);
typedef u16 (*select_queue_fallback_t___3)(struct net_device___2 *, struct sk_buff *, struct net_device___2 *);
typedef int (*sk_read_actor_t___2)(read_descriptor_t *, struct sk_buff___2 *, unsigned int, size_t);
typedef int splice_actor(struct pipe_inode_info___2 *, struct pipe_buffer *, struct splice_desc *);
typedef int splice_direct_actor(struct pipe_inode_info___2 *, struct splice_desc *);
typedef void tcf_chain_head_change_t___2(struct tcf_proto___2 *, void *);
typedef struct sock * (*udp_lookup_t)(struct sk_buff___2 *, __be16, __be16);
typedef int (*wext_ioctl_func)(struct net_device___2 *, struct iwreq *, unsigned int, struct iw_request_info *, iw_handler___2);

pahole dump/compile/nearly every other switch combo makes a file without these dups but with broken enums like


struct TransportAddress {
	enum {
		eTransportAddress_ipAddress          = 0,
		eTransportAddress_ipSourceRoute      = 1,
		eTransportAddress_ipxAddress         = 2,
		eTransportAddress_ip6Address         = 3,
		eTransportAddress_netBios            = 4,
		eTransportAddress_nsap               = 5,
		eTransportAddress_nonStandardAddress = 6,
	} choice;                                        /*     0     4 */
	enum {
		eTransportAddress_ipAddress          = 0,
		eTransportAddress_ipSourceRoute      = 1,
		eTransportAddress_ipxAddress         = 2,
		eTransportAddress_ip6Address         = 3,
		eTransportAddress_netBios            = 4,
		eTransportAddress_nsap               = 5,
		eTransportAddress_nonStandardAddress = 6,
	};

	union {
		TransportAddress_ipAddress ipAddress;    /*     4     8 */
		TransportAddress_ip6Address ip6Address;  /*     4     8 */
	};                                               /*     4     8 */
	union {
		TransportAddress_ipAddress ipAddress;            /*     0     8 */
		TransportAddress_ip6Address ip6Address;          /*     0     8 */
	};


	/* size: 12, cachelines: 1, members: 2 */
	/* last cacheline: 12 bytes */
};
typedef struct TransportAddress TransportAddress;

so either way I've a massive headache to deal with. Before I go debugging 200k lines line by line all week - is there something I am doing wrong here re: generating the BTF section in the CONFIG_DEBUG_INFO enabled kernel? Let me know if there is some files I could attach for your review.

Look forward to hearing back from someone more knowledgeable!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions