Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync with latest net-next bpf headers #2001

Merged
merged 1 commit into from
Oct 10, 2018
Merged

sync with latest net-next bpf headers #2001

merged 1 commit into from
Oct 10, 2018

Conversation

yonghong-song
Copy link
Collaborator

Sync compat bpf.h and virtual_bpf.h with latest net-next versions

Signed-off-by: Yonghong Song [email protected]

@yonghong-song
Copy link
Collaborator Author

@drzaeus77 the test failure seems related to test infra. Could you take a look?

@yonghong-song
Copy link
Collaborator Author

[buildbot, test this please]

1 similar comment
@yonghong-song
Copy link
Collaborator Author

[buildbot, test this please]

@yonghong-song
Copy link
Collaborator Author

The failure on ubuntu 16.04 is legitimate.

15: 37: (bf) r1 = r6
15: 38: (85) call 12
15: 39: (05) goto pc+23
15: 63: (b7) r0 = 1
15: 64: (95) exit
15: 
15: from 29 to 63: safe
15: 
15: from 21 to 63: R0=imm0 R6=ctx R10=fp
15: 63: (b7) r0 = 1
15: 64: (95) exit
15: 
15: from 2 to 9: R1=inv R6=ctx R10=fp
15: 9: (79) r1 = *(u64 *)(r6 +48)
15: invalid bpf_context access off=48 size=8
15: 

The __sk_buff cb is accessed with size of 8. This is not allowed in 4.4 verifier but
relaxed in later verifier. The thing I do not understand is why the issue is triggered
here by llvm.

@yonghong-song
Copy link
Collaborator Author

Tried on my local ubuntu 16.04 VM and it runs successfully.

yhs@ubuntu:~/work/bcc/tests/python$ uname -a
Linux ubuntu 4.4.0-87-generic #110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
yhs@ubuntu:~/work/bcc/tests/python$ sudo ./test_brb.py test_brb.c
net.ipv4.ip_forward = 1
ARPING 100.1.1.254
Timeout

--- 100.1.1.254 statistics ---
1 packets transmitted, 0 packets received, 100% unanswered (0 extra)

ARPING 200.1.1.254
Timeout

--- 200.1.1.254 statistics ---
1 packets transmitted, 0 packets received, 100% unanswered (0 extra)

PING 200.1.1.1 (200.1.1.1) 56(84) bytes of data.
64 bytes from 200.1.1.1: icmp_seq=1 ttl=63 time=0.084 ms
64 bytes from 200.1.1.1: icmp_seq=2 ttl=63 time=0.053 ms

--- 200.1.1.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.053/0.068/0.084/0.017 ms
[ ID] Interval       Transfer     Bandwidth
[  7]  0.0- 1.0 sec  5.97 GBytes  51.3 Gbits/sec
[ ID] Interval       Transfer     Bandwidth
[ 10]  0.0- 1.0 sec  5.97 GBytes  50.9 Gbits/sec
Starting netserver with host 'IN(6)ADDR_ANY' port '12865' and family AF_UNSPEC
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 200.1.1.1 () port 0 AF_INET : demo
Recv   Send    Send                          
Socket Socket  Message  Elapsed              
Size   Size    Size     Time     Throughput  
bytes  bytes   bytes    secs.    10^6bits/sec  

 87380  16384  65160    1.00     53080.34   
MIGRATED TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 200.1.1.1 () port 0 AF_INET : demo : first burst 0
Local /Remote
Socket Size   Request  Resp.   Elapsed  Trans.
Send   Recv   Size     Size    Time     Rate         
bytes  Bytes  bytes    bytes   secs.    per sec   

16384  87380  1        1       1.00     11951.51   
16384  87380 
.
----------------------------------------------------------------------
Ran 1 test in 7.171s

OK
yhs@ubuntu:~/work/bcc/tests/python$ 

The testbot has version 4.4.0-116-generic and mine is 4.4.0-87-generic.
Will run one more time and it still failed then will change test_brb.c code.

Sync compat bpf.h and virtual_bpf.h with latest net-next versions

Also add a barrier for the test_brb bpf program like below
         meta.prog_id = skb->cb[0];
+        asm volatile("" ::: "memory");
         meta.rx_port_id = skb->cb[1];
so two cb read does not become a 8 byte load which is not
allowed for ubuntu 16.04 kernel (4.4 based). The 8 byte load
is allowed for skb->cb's for later kernels.

Signed-off-by: Yonghong Song <[email protected]>
@yonghong-song
Copy link
Collaborator Author

[buildbot, test this please]

3 similar comments
@yonghong-song
Copy link
Collaborator Author

[buildbot, test this please]

@yonghong-song
Copy link
Collaborator Author

[buildbot, test this please]

@yonghong-song
Copy link
Collaborator Author

[buildbot, test this please]

@yonghong-song yonghong-song merged commit d4b2387 into master Oct 10, 2018
CrackerCat pushed a commit to CrackerCat/bcc that referenced this pull request Jul 31, 2024
Sync compat bpf.h and virtual_bpf.h with latest net-next versions

Also add a barrier for the test_brb bpf program like below
         meta.prog_id = skb->cb[0];
+        asm volatile("" ::: "memory");
         meta.rx_port_id = skb->cb[1];
so two cb read does not become a 8 byte load which is not
allowed for ubuntu 16.04 kernel (4.4 based). The 8 byte load
is allowed for skb->cb's for later kernels.

Signed-off-by: Yonghong Song <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant