lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ce812367-596a-0354-f008-725225f65af4@redhat.com>
Date:   Wed, 11 Apr 2018 09:50:40 +0800
From:   Jason Wang <jasowang@...hat.com>
To:     Daniel Borkmann <daniel@...earbox.net>,
        Kimitoshi Takahashi <ktaka@....ac.jp>
Cc:     xdp-newbies@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: XDP_TX for virtio_net not working in recent kernel?



On 2018年04月10日 18:17, Daniel Borkmann wrote:
> [ +jason +netdev ]
>
> On 04/10/2018 12:49 AM, Kimitoshi Takahashi wrote:
>> Hello,
>>
>> I'm totally newbie.
>>
>> I want to try some examples under the samples/bpf of the kernel tree using the virtio_net driver in kvm, in order to get familiar with the XDP. However, it seems to me that for kernels newer than linux-4.15, the xdp2 and xdp_tx_tunnel are not working in the case of virtio_net.
>>
>> Can somebody help me out to make them working?
>>
>>
>> 1) For linux-4.11.12, linux-4.12.14, and linux-4.14.31, xdp2 and xdp_tx_tunnel are working.
>>
>> [xdp2]
>> 10.0.0.27# ./xdp2 2 (or ./xdp -N 2)
>>
>> 10.0.0.254# hping3 10.0.0.27 -p 5000 -2
>>
>> 10.0.0.254# tcpdump -nei kbr0 udp port 5000
>> 06:18:37.677070 2e:c9:83:fb:5b:f3 > 52:54:00:11:00:1b, ethertype IPv4 (0x0800), length 42: 10.0.0.254.2982 > 10.0.0.27.5000: UDP, length 0
>> 06:18:37.677265 52:54:00:11:00:1b > 2e:c9:83:fb:5b:f3, ethertype IPv4 (0x0800), length 42: 10.0.0.254.2982 > 10.0.0.27.5000: UDP, length 0
>>
>> I can see the UDP packets with MAC addresses swapped.
>>
>> [xdp_tx_tunnel]
>>
>> 10.0.0.254# telnet 10.1.2.1 80
>>
>> 10.0.0.27# ./xdp_tx_iptunnel -i 2 -a 10.1.2.1 -p 80 -s 10.0.0.27 -d 10.0.0.24 -m 52:54:00:11:00:18
>>
>> 10.0.0.24# tcpdump -nei any proto 4
>> 22:08:20.510354  In 52:54:00:11:00:1b ethertype IPv4 (0x0800), length 96: 10.0.0.27 > 10.0.0.24: 10.0.0.254.60826 > 10.1.2.1.80: Flags [S], seq 3224377720, win 29200, options [mss 1460,sackOK,TS val 217801953 ecr 0,nop,wscale 7], length 0 (ipip-proto-4)
>>
>> I can see the encapsulated SYN packet that is forwarded by the 10.0.0.27.
>>
>> 2) For linux-4.15, linux-4.15.5, linux-4.15.13 and linux-4.16.1, xdp2 and xdp_tx_tunnel are NOT working.
>>
>> [xdp2]
>> 10.0.0.27# ./xdp2 -N 2
>>
>> 10.0.0.254# hping3 10.0.0.27 -p 5000 -2
>>
>> 10.0.0.254# tcpdump -nei br0 udp port 5000
>> 06:45:34.810046 2e:c9:83:fb:5b:f3 > 52:54:00:11:00:1b, ethertype IPv4 (0x0800), length 42: 10.0.0.254.2346 > 10.0.0.27.5000: UDP, length 0
>> 06:45:35.810176 2e:c9:83:fb:5b:f3 > 52:54:00:11:00:1b, ethertype IPv4 (0x0800), length 42: 10.0.0.254.2347 > 10.0.0.27.5000: UDP, length 0
>>
>> Only the outgoing packets can be seen.
>>
>> [xdp_tx_tunnel]
>>
>> 10.0.0.254# telnet 10.1.2.1 80
>>
>> 10.0.0.27# ./xdp_tx_iptunnel -i 2 -a 10.1.2.1 -p 80 -s 10.0.0.27 -d 10.0.0.24 -m 52:54:00:11:00:18
>>
>> 10.0.0.24# tcpdump -nei any proto 4
>>
>> I can NOT see the encapsulated SYN packet that is forwarded by the 10.0.0.27.
>>
>>
>> -- 
>> Sincerely,
>> Takahashi Kimitoshi

I suspect a kick is missed in the XDP_TX case.

Could you please try the attached patch to see if it fixes the issue?

Thanks

View attachment "0001-virtio-net-add-missing-virtqueue-kick-when-flushing-.patch" of type "text/x-patch" (1507 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ