В ядре Linux была устранена следующая уязвимость: gve: DQO: fix длина заголовка, используемая gve_can_send_tso() for UDP GSO gve_can_send_tso(), вычисляет, сколько буферов будет охватывать каждый сегмент пакета GSO, и для этого требуется длина заголовков, которые устройство реплицирует перед каждым сегментом. Он безоговорочно использует skb_tcp_all_headers (), который читает поле DOFF заголовка TCP. Пакеты SKB_GSO_UDP_L4 не имеют заголовка TCP: tcp_hdrlen() затем считывает один байт полезной нагрузки UDP, а header_len может быть чем угодно в [0, 60] вместо смещения переноса плюс восемь байт заголовка UDP, которые gve_prep_tso() программирует в контекстный дескриптор TSO.
Неправильная длина заголовка сдвигает все границы сегмента, вычисленные в цикле, поэтому количество буферов на сегмент может быть больше или меньше. В первом случае GSO ненужно отключается для этого пакета gve_features_check_dqo(), и стек должен сегментировать его. Во втором случае драйвер передает устройству пакет, сегменты которого охватывают больше, чем буферы GVE_TX_MAX_DATA_DESCS.
Используйте длину заголовка UDP для пакетов SKB_GSO_UDP_L4, что соответствует gve_prep_tso().
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: gve: DQO: fix header length used by gve_can_send_tso() for UDP GSO gve_can_send_tso() computes how many buffers each segment of a GSO packet would span, and for this it needs the length of the headers that the device replicates in front of every segment. It unconditionally uses skb_tcp_all_headers(), which reads the doff field of the TCP header. SKB_GSO_UDP_L4 packets have no TCP header: tcp_hdrlen() then reads one byte of the UDP payload, and header_len can be anything in [0, 60] instead of the transport offset plus the eight bytes of the UDP header that gve_prep_tso() programs into the TSO context descriptor. A wrong header length shifts all the segment boundaries computed in the loop, so the number of buffers per segment can be over or under estimated. In the first case, GSO is needlessly disabled for this packet by gve_features_check_dqo() and the stack has to segment it. In the second case, the driver hands the device a packet whose segments span more than GVE_TX_MAX_DATA_DESCS buffers. Use the UDP header length for SKB_GSO_UDP_L4 packets, matching what gve_prep_tso() does.