RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2066976 - AF_PACKET SOCK_RAW drops GSO tagged packets.
Summary: AF_PACKET SOCK_RAW drops GSO tagged packets.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: kernel
Version: 8.8
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Hangbin Liu
QA Contact: Jianwen Ji
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-03-22 23:33 UTC by Flavio Leitner
Modified: 2022-11-08 11:51 UTC (History)
4 users (show)

Fixed In Version: kernel-4.18.0-404.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-11-08 10:26:02 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Reproducer (6.60 KB, text/plain)
2022-03-22 23:33 UTC, Flavio Leitner
no flags Details
Reproducer (6.60 KB, text/plain)
2022-03-22 23:53 UTC, Flavio Leitner
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Gitlab redhat/rhel/src/kernel rhel-8 merge_requests 2689 0 None None None 2022-05-10 07:48:20 UTC
Gitlab redhat/rhel/src/kernel rhel-8 merge_requests 2876 0 None None None 2022-06-06 02:50:04 UTC
Red Hat Issue Tracker RHELPLAN-116442 0 None None None 2022-03-22 23:33:44 UTC
Red Hat Product Errata RHSA-2022:7683 0 None None None 2022-11-08 10:26:47 UTC

Description Flavio Leitner 2022-03-22 23:33:20 UTC
Created attachment 1867603 [details]
Reproducer

Description of problem:


The kernel drops GSO tagged packets while untagged packets are forwarded.

The reproducer only requires a veth pair, one side in the host and another in a another netns.

ip netns add test
ip link add veth1 type veth peer name veth2
ip link set veth2 netns test 
ip netns exec test ip link add veth2.10 link veth2 type vlan id 10 
ip netns exec test ip link set veth2 up 
ip netns exec test ip link set veth2.10 up 
ip netns exec test ip address add 192.168.200.31/24 dev veth2.10
ip link set veth1 up 


On one terminal run tcpdump:
ip netns exec test tcpdump -n -nn -e -v -i veth2 

On another terminal run the reproducer:
# gcc -o repro sock-gso.c 
#./repro veth1 untag gso

The above should show the packet being forwarded ok:
20:21:48.533856 52:54:00:40:f8:92 > 56:16:b4:8a:ca:12, ethertype IPv4 (0x0800), length 2048: (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 2024)
    192.168.200.11.3320 > 192.168.200.31.8080: Flags [P], cksum 0xe6a8 (incorrect -> 0x5d97), seq 666:2650, win 1536, length 1984: HTTP


Now running with VLAN tag:
# ./repro veth1 tag gso 

This doesn't show any packet. Not even in veth1 interface.


Disabling GSO without VLAN tag:
# ./repro veth1 untag n


The above shows the packet below being forwarded ok:
20:23:55.307572 52:54:00:40:f8:92 > 56:16:b4:8a:ca:12, ethertype IPv4 (0x0800), length 400: (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 376)
    192.168.200.11.3320 > 192.168.200.31.8080: Flags [P], cksum 0xed18 (incorrect -> 0x6407), seq 666:1002, win 1536, length 336: HTTP


Disabling GSO with tagged VLAN:
# ./repro veth1 tag n
20:25:04.375593 52:54:00:40:f8:92 > 56:16:b4:8a:ca:12, ethertype 802.1Q (0x8100), length 400: vlan 10, p 0, ethertype IPv4 (0x0800), (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 376)
    192.168.200.11.3320 > 192.168.200.31.8080: Flags [P], cksum 0xed18 (incorrect -> 0x6407), seq 666:1002, win 1536, length 336: HTTP

That works too, so forwarding fails only with the GSO + VLAN tag.

The TX drop increases in veth1 interface in that case.

A quick look at the kernel sources indicates the issue might be in inet_gso_segment().


Version-Release number of selected component (if applicable):

The issue happens with 5.17.0-rc7+ as well.

How reproducible:
Always


Actual results:
The GSO tagged packet is dropped.


Expected results:
The GSO tagged packet should be forwarded.

Comment 1 Flavio Leitner 2022-03-22 23:53:45 UTC
Created attachment 1867615 [details]
Reproducer

Comment 2 Hangbin Liu 2022-03-28 09:53:53 UTC
> A quick look at the kernel sources indicates the issue might be in inet_gso_segment().

        skb_reset_network_header(skb);
        nhoff = skb_network_header(skb) - skb_mac_header(skb);
        if (unlikely(!pskb_may_pull(skb, sizeof(*iph))))
                goto out;

        iph = ip_hdr(skb);
        ihl = iph->ihl * 4;
        if (ihl < sizeof(*iph))
                goto out;

Looks it doesn't check if there is a VLAN header. Need to see how to fix it, as there may also has QinQ header.

Comment 3 Hangbin Liu 2022-04-14 06:27:05 UTC
OK, since we don't support VLAN in inet_gso_segment, we should return error to userspace.
But the packet_snd() didn't do it as it only checks if error > 0, while it sometime may return error < 0.

```
static int packet_snd()
        [...]
        err = po->xmit(skb);
        if (err > 0 && (err = net_xmit_errno(err)) != 0)
                goto out_unlock;

        [...]
}
```

So a simple fix is to also check if error < 0. But in a long time, we'd better try to implement VLAN GSO.

Comment 4 Flavio Leitner 2022-04-14 11:23:07 UTC
We are actually implementing TSO/GSO support in OVS user space and that is how I found out about this problem.
If the kernel doesn't support that, it means user space needs to segment the packet and lose performance.
fbl

Comment 5 Hangbin Liu 2022-04-15 01:31:42 UTC
(In reply to Flavio Leitner from comment #4)
> We are actually implementing TSO/GSO support in OVS user space and that is
> how I found out about this problem.
> If the kernel doesn't support that, it means user space needs to segment the
> packet and lose performance.

I'm still investing the reason. There may have a bug as in skb_mac_gso_segment() it should deal with the VLANs, but actually not.

Comment 13 Hangbin Liu 2022-06-01 01:59:42 UTC
Move back to Assigned as there is a followup fix need to backport.

Comment 17 Hangbin Liu 2022-06-15 04:24:26 UTC
FYI, reproducer https://syzkaller.appspot.com/bug?extid=7160965e6a93d826048a for the second patch

Comment 23 errata-xmlrpc 2022-11-08 10:26:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: kernel security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:7683


Note You need to log in before you can comment on or make changes to this bug.