[<prev] [next>] [day] [month] [year] [list]
Message-ID: <a55558fe-0e43-422e-bd2c-9a434ce1b1e2@meta.com>
Date: Sun, 22 Jan 2023 15:29:56 -0800
From: Yonghong Song <yhs@...a.com>
To: nelakurthi koteswararao <koteswararao18@...il.com>,
Yonghong Song <yhs@...com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, netdev@...r.kernel.org
Subject: Re: Clang-14.0.6 compiled kernel/linux-5.4/samples/bpf/ failed to
load on x86-64 target
On 1/22/23 10:10 AM, nelakurthi koteswararao wrote:
> Dear LLVM BPF contributors
>
> I compiled samples/bpf/ programs for target 'bpf' using clang-14.0.6
> version compiler present in linux-5.4.202/samples/bpf directory but when
> i try to load the sample programs like (sock_ex1) on target x86-64, they
> are straightway failing to load in to the kernel.
> {{
> /var/log/gui_upload# ./sockex2
> libbpf: Error loading BTF: Invalid argument(22)
> libbpf: magic: 0xeb9f
> version: 1
> flags: 0x0
> hdr_len: 24
> type_off: 0
> type_len: 1000
> str_off: 1000
> str_len: 2290
> btf_total_size: 3314
> [1] PTR (anon) type_id=3
> [2] INT int size=4 bits_offset=0 nr_bits=32 encoding=SIGNED
> [3] ARRAY (anon) type_id=2 index_type_id=4 nr_elems=1
> [4] INT __ARRAY_SIZE_TYPE__ size=4 bits_offset=0 nr_bits=32 encoding=(none)
> [5] PTR (anon) type_id=6
> [6] TYPEDEF __be32 type_id=7
> [7] TYPEDEF __u32 type_id=8
> [8] INT unsigned int size=4 bits_offset=0 nr_bits=32 encoding=(none)
> [9] PTR (anon) type_id=10
> [10] STRUCT pair size=16 vlen=2
> packets type_id=11 bits_offset=0
> bytes type_id=11 bits_offset=64
> [11] INT long size=8 bits_offset=0 nr_bits=64 encoding=SIGNED
> [12] PTR (anon) type_id=13
> [13] ARRAY (anon) type_id=2 index_type_id=4 nr_elems=1024
> [14] STRUCT (anon) size=32 vlen=4
> type type_id=1 bits_offset=0
> key type_id=5 bits_offset=64
> value type_id=9 bits_offset=128
> max_entries type_id=12 bits_offset=192
> [15] VAR hash_map type_id=14 linkage=1
> [16] PTR (anon) type_id=17
> [17] STRUCT __sk_buff size=176 vlen=31
> len type_id=7 bits_offset=0
> pkt_type type_id=7 bits_offset=32
> mark type_id=7 bits_offset=64
> queue_mapping type_id=7 bits_offset=96
> protocol type_id=7 bits_offset=128
> vlan_present type_id=7 bits_offset=160
> vlan_tci type_id=7 bits_offset=192
> vlan_proto type_id=7 bits_offset=224
> priority type_id=7 bits_offset=256
> ingress_ifindex type_id=7 bits_offset=288
> ifindex type_id=7 bits_offset=320
> tc_index type_id=7 bits_offset=352
> cb type_id=18 bits_offset=384
> hash type_id=7 bits_offset=544
> tc_classid type_id=7 bits_offset=576
> data type_id=7 bits_offset=608
> data_end type_id=7 bits_offset=640
> napi_id type_id=7 bits_offset=672
> family type_id=7 bits_offset=704
> remote_ip4 type_id=7 bits_offset=736
> local_ip4 type_id=7 bits_offset=768
> remote_ip6 type_id=19 bits_offset=800
> local_ip6 type_id=19 bits_offset=928
> remote_port type_id=7 bits_offset=1056
> local_port type_id=7 bits_offset=1088
> data_meta type_id=7 bits_offset=1120
> (anon) type_id=20 bits_offset=1152
> tstamp type_id=22 bits_offset=1216
> wire_len type_id=7 bits_offset=1280
> gso_segs type_id=7 bits_offset=1312
> (anon) type_id=24 bits_offset=1344
> [18] ARRAY (anon) type_id=7 index_type_id=4 nr_elems=5
> [19] ARRAY (anon) type_id=7 index_type_id=4 nr_elems=4
> [20] UNION (anon) size=8 vlen=1
> flow_keys type_id=21 bits_offset=0
> [21] PTR (anon) type_id=33
> [22] TYPEDEF __u64 type_id=23
> [23] INT unsigned long long size=8 bits_offset=0 nr_bits=64 encoding=(none)
> [24] UNION (anon) size=8 vlen=1
> sk type_id=25 bits_offset=0
> [25] PTR (anon) type_id=34
> [26] FU
>
> NC_PROTO (anon) return=2 args=(16 skb)
> [27] FUNC bpf_prog2 type_id=26 vlen != 0
>
> libbpf: Error loading .BTF into kernel: -22.
> }}
> .BTF information is generated during compile time but loading to the
> kernel is failing.
> Is it due to clang-14.0.6 compatibility with libbpf version present in
> 5.4.202 kernel is leading to this issue?
You need to have a later version of libbpf. libbpf will probe kernel
and do proper sanitation if the kernel does not support above [27] encoding.
> Request to please provide input if possible
>
> Regards
> Koti
Powered by blists - more mailing lists