Re: Ask for help about bpf map

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> writes:

> On Mon, Jul 12, 2021 at 11:35 PM luwei (O) <luwei32@xxxxxxxxxx> wrote:
>>
>> Hi, List:
>>
>>        I am a beginner about bpf and working on XDP now. I meet a
>> problem and feel difficult to figure it out.
>>
>>        In my following codes, I use two ways to define my_map: in SEC
>> maps and SEC .maps respectively. When I load the xdp_kern.o file,
>>
>> It has different results. The way I load is: ip link set dev ens3 xdp
>> obj xdp1_kern.o sec xdp1.
>>
>>        when I define my_map using SEC maps, it loads successfully but
>> fails to load using SEC .maps, it reports:
>>
>> "
>>
>> [12] TYPEDEF __u32 type_id=13
>> [13] INT unsigned int size=4 bits_offset=0 nr_bits=32 encoding=(none)
>> [14] FUNC_PROTO (anon) return=2 args=(10 ctx)
>> [15] FUNC xdp_prog1 type_id=14
>> [16] INT char size=1 bits_offset=0 nr_bits=8 encoding=SIGNED
>> [17] ARRAY (anon) type_id=16 index_type_id=4 nr_elems=4
>> [18] VAR _license type_id=17 linkage=1
>> [19] DATASEC .maps size=0 vlen=1 size == 0
>>
>>
>> Prog section 'xdp1' rejected: Permission denied (13)!
>>   - Type:         6
>>   - Instructions: 9 (0 over limit)
>>   - License:      GPL
>>
>> Verifier analysis:
>>
>> 0: (b7) r1 = 0
>> 1: (63) *(u32 *)(r10 -4) = r1
>> last_idx 1 first_idx 0
>> regs=2 stack=0 before 0: (b7) r1 = 0
>> 2: (bf) r2 = r10
>> 3: (07) r2 += -4
>> 4: (18) r1 = 0x0
>
> this shouldn't be 0x0.
>
> I suspect you have an old iproute2 which doesn't yet use libbpf to
> load BPF programs, so .maps definition is not yet supported. cc'ing
> netdev@vger, David and Toke

That would be my guess as well; what's the output of 'ip -V'?

-Toke




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux