Skip to contentSkip to conversation

suspicius csum initialization in vmxnet3_rx_csum

PATCH Paolo Abeni 3 participants 8 messages May 24, 2018 – Jun 5, 2018 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

Paolo Abeni

author maintainer
#0 lore raw

Hi all,

we are hitting the BUG() condition in skb_checksum_help() - skb_checksum_start_offset(skb) >= skb_headlen(skb) for skb received from vmnxnet3 and queued from OVS to user-space

I think that the root cause is in vmxnet3_rx_csum():

			if (gdesc->rcd.csum) {
                                skb->csum = htons(gdesc->rcd.csum);
                                skb->ip_summed = CHECKSUM_PARTIAL;

CHECKSUM_PARTIAL looks suspicious here, as the csum field is initialized, instead of csum_offset/csum_start. To be honest I find also strange that the csum value is converted from host byte order.

I'm wild guessing something like the below patch should fix the issue, but I'm not familiar with the vmxnet3 code. Can you please have a look?

Thank you,

Paolo
---

drivers/net/vmxnet3/vmxnet3_drv.c +1 -1
index 9ebe2a689966..06ade074c32c 100644
@@ -1172,7 +1172,7 @@ vmxnet3_rx_csum(struct vmxnet3_adapter *adapter,
 		} else {
 			if (gdesc->rcd.csum) {
 				skb->csum = htons(gdesc->rcd.csum);
-				skb->ip_summed = CHECKSUM_PARTIAL;
+				skb->ip_summed = CHECKSUM_COMPLETE;
 			} else {
 				skb_checksum_none_assert(skb);
 			}
author maintainer
#3 lore raw
In reply to a message not in the archive

Hi,

Quoted 1 line · Guolin Yang

Yes, that code is not correct, we should fix that code

Did you have any chance to address the issue and/or to give a more in- deepth look to the change proposed in my initial email?

Thanks,

Paolo

#4 lore raw
Quoted 8 lines · Paolo Abeni

Hi,

Quoted 1 line · Guolin Yang

Yes, that code is not correct, we should fix that code

Did you have any chance to address the issue and/or to give a more in- deepth look to the change proposed in my initial email?

Hi Paolo,

Can you provide the esx build you are using? It can be found using "vmware -vl" on ESX host.

Did you try your proposed fix and did it work? Are you sure the packet hits the below if block and not the else block? I still don't think the ICMP packet will go through the below if block.

   if (gdesc->rcd.csum) {
	skb->csum = htons(gdesc->rcd.csum);
	skb->ip_summed = CHECKSUM_PARTIAL;
   } else {
	skb_checksum_none_assert(skb);

}

The vmxnet3 emulation does not calculate rcd.csum for ICMP packet and hence should go through the else block i.e. checksum none.

Thanks,
Ronak

#5 lore raw
Quoted 27 lines · Ronak Doshi
Quoted 8 lines · Paolo Abeni

Hi,

Quoted 1 line · Guolin Yang

Yes, that code is not correct, we should fix that code

Did you have any chance to address the issue and/or to give a more in- deepth look to the change proposed in my initial email?

Hi Paolo,

Can you provide the esx build you are using? It can be found using "vmware -vl" on ESX host.

Did you try your proposed fix and did it work? Are you sure the packet hits the below if block and not the else block? I still don't think the ICMP packet will go through the below if block.

   if (gdesc->rcd.csum) {
	skb->csum = htons(gdesc->rcd.csum);
	skb->ip_summed = CHECKSUM_PARTIAL;
   } else {
	skb_checksum_none_assert(skb);
   }
Quoted 3 lines

The vmxnet3 emulation does not calculate rcd.csum for ICMP packet and hence should go through the else block i.e. checksum none.

What packet types will rcd.csum be set for?
Neil

Quoted 3 lines

Thanks,
Ronak

#6 lore raw
Quoted 28 lines · Neil Horman
Quoted 27 lines · Ronak Doshi
Quoted 8 lines · Paolo Abeni

Hi,

Quoted 1 line · Guolin Yang

Yes, that code is not correct, we should fix that code

Did you have any chance to address the issue and/or to give a more in- deepth look to the change proposed in my initial email?

Hi Paolo,

Can you provide the esx build you are using? It can be found using "vmware -vl" on ESX host.

Did you try your proposed fix and did it work? Are you sure the packet hits the below if block and not the else block? I still don't think the ICMP packet will go through the below if block.

   if (gdesc->rcd.csum) {
	skb->csum = htons(gdesc->rcd.csum);
	skb->ip_summed = CHECKSUM_PARTIAL;
   } else {
	skb_checksum_none_assert(skb);
   }
Quoted 6 lines
Quoted 3 lines

The vmxnet3 emulation does not calculate rcd.csum for ICMP packet and hence should go through the else block i.e. checksum none.

What packet types will rcd.csum be set for?
Neil

I looked thorugh the emulation code and found that rcd.csum is not set. For valid v4/v6, TCP/UDP packets the code block above the mentioend "if" block will be executed or else it will go through checksum none.

That's why I wanted to know (in previous emails) which ESX build is being used while this was tested. The code block under "if (gdesc->rcd.csum)" block might seem incorrect but it shouldn't be hit as rcd.csum is not set. Hence, I asked did the fix provided by Paolo worked for the icmp test?

Thanks,
Ronak

#7 lore raw
Quoted 38 lines · Ronak Doshi
Quoted 28 lines · Neil Horman
Quoted 27 lines · Ronak Doshi
Quoted 8 lines · Paolo Abeni

Hi,

Quoted 1 line · Guolin Yang

Yes, that code is not correct, we should fix that code

Did you have any chance to address the issue and/or to give a more in- deepth look to the change proposed in my initial email?

Hi Paolo,

Can you provide the esx build you are using? It can be found using "vmware -vl" on ESX host.

Did you try your proposed fix and did it work? Are you sure the packet hits the below if block and not the else block? I still don't think the ICMP packet will go through the below if block.

   if (gdesc->rcd.csum) {
	skb->csum = htons(gdesc->rcd.csum);
	skb->ip_summed = CHECKSUM_PARTIAL;
   } else {
	skb_checksum_none_assert(skb);
   }
Quoted 6 lines
Quoted 3 lines

The vmxnet3 emulation does not calculate rcd.csum for ICMP packet and hence should go through the else block i.e. checksum none.

What packet types will rcd.csum be set for?
Neil

Quoted 9 lines

I looked thorugh the emulation code and found that rcd.csum is not set. For valid v4/v6, TCP/UDP packets the code block above the mentioend "if" block will be executed or else it will go through checksum none.

That's why I wanted to know (in previous emails) which ESX build is being used while this was tested. The code block under "if (gdesc->rcd.csum)" block might seem incorrect but it shouldn't be hit as rcd.csum is not set. Hence, I asked did the fix provided by Paolo worked for the icmp test?

Paolo will have to tell you that specifically I'm afraid. I'm not sure if the patch was tested or not.

Quoted 3 lines

Thanks,
Ronak

author maintainer
#8 lore raw
In reply to Ronak Doshi

Hi,

I'm sorry for the long delay in my answer, I've been travelling.

Quoted 11 lines · Ronak Doshi
Quoted 2 lines · Neil Horman

What packet types will rcd.csum be set for?
Neil

I looked thorugh the emulation code and found that rcd.csum is not set. For valid v4/v6, TCP/UDP packets the code block above the mentioend "if" block will be executed or else it will go through checksum none.

That's why I wanted to know (in previous emails) which ESX build is being used while this was tested. The code block under "if (gdesc->rcd.csum)" block might seem incorrect but it shouldn't be hit as rcd.csum is not set.

I'm unsure if I read the above correctly. Do you mean that the relevant code-path is never hit? If so, can we simply drop it, as we agreed that such code is uncorrect? Elsewhere, could you plese specify under which circumstances gdesc->rcd.csum is filled by the hypervisor?

Quoted 1 line

Hence, I asked did the fix provided by Paolo worked for the icmp test?

Unfortunatelly so far I've not been able to reproduce the issue outside a production environment and I can't run test kernel there.

Thanks,

Paolo

#9 lore raw
Quoted 13 lines · Paolo Abeni

Hi,

I'm sorry for the long delay in my answer, I've been travelling.

Quoted 8 lines · Ronak Doshi
Quoted 2 lines · Neil Horman

What packet types will rcd.csum be set for?
Neil

I looked thorugh the emulation code and found that rcd.csum is not set. For valid v4/v6, TCP/UDP packets the code block above the mentioend "if" block will be executed or else it will go through checksum none.

Quoted 9 lines
Quoted 3 lines

That's why I wanted to know (in previous emails) which ESX build is being used while this was tested. The code block under "if (gdesc->rcd.csum)" block might seem incorrect but it shouldn't be hit as rcd.csum is not set.

I'm unsure if I read the above correctly. Do you mean that the relevant code-path is never hit? If so, can we simply drop it, as we agreed that such code is uncorrect? Elsewhere, could you plese specify under which circumstances gdesc->rcd.csum is filled by the hypervisor?

I do not see hypervisor populating rcd.csum field or may be the code has changed over the years. So, the codepath should not be hit as it is not populated. I will check and fix it or remove the block if not required. But as far as your issue is concerned, that code block is not hit.

Thanks,
Ronak