Re: ath6kl: assure headroom of skbuff is writable in .start_xmit()

2017-05-19 Thread Kalle Valo
Arend Van Spriel  wrote:
> An issue was found brcmfmac driver in which a skbuff in .start_xmit()
> callback was actually cloned. So instead of checking for sufficient
> headroom it should also be writable. Hence use skb_cow_head() to
> check and expand the headroom appropriately.
> 
> Signed-off-by: Arend van Spriel 
> Tested-by: Steve deRosier 

Patch applied to ath-next branch of ath.git, thanks.

1ed760c9aca0 ath6kl: assure headroom of skbuff is writable in .start_xmit()

-- 
https://patchwork.kernel.org/patch/9697757/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



Re: ath6kl: assure headroom of skbuff is writable in .start_xmit()

2017-05-04 Thread Kalle Valo
Steve deRosier  writes:

> On Wed, Apr 26, 2017 at 12:54 PM, James Hughes
>  wrote:
>> On 26 April 2017 at 19:03, Arend Van Spriel
>>  wrote:
>>>
>>>
>>> On 26-4-2017 17:44, Steve deRosier wrote:
 On Wed, Apr 26, 2017 at 1:53 AM, Kalle Valo  wrote:
> Arend Van Spriel  wrote:
>> An issue was found brcmfmac driver in which a skbuff in .start_xmit()
>> callback was actually cloned. So instead of checking for sufficient
>> headroom it should also be writable. Hence use skb_cow_head() to
>> check and expand the headroom appropriately.
>>
>> Signed-off-by: Arend van Spriel 
>
> Steve, would you have time to run a quick test with this?
>
> Patch set to Deferred.
>

 Happy to give it a quick spin on both of my platforms.

>
> @ Arend and James, thanks for the info. I understand it, but
> unfortunately I can't seem to replicate the problems on my platforms
> with the limited time I have available to test it. It also may have to
> do with my platforms having special custom bridging related code, or
> just me having setup too simple of a test.
>
> That said...
>
> @Kalle: I have tested on both my 6004 and 6003 platforms. I didn't
> notice any incorrect behavior in my testing. But I don't have a test
> setup that would have shown the original problem as reported on the
> brcm driver so I can't say that the change actually _fixes_ anything.
> Only that in my testing it doesn't seem to break anything.
>
> Tested-by: Steve deRosier 

Yeah, I was mostly worried about regression. I didn't expect you to
replicate the bug. Thanks for testing, I'll add this patch to my queue.

-- 
Kalle Valo

Re: ath6kl: assure headroom of skbuff is writable in .start_xmit()

2017-04-27 Thread James Hughes
On 27 April 2017 at 05:55, Steve deRosier  wrote:
> On Wed, Apr 26, 2017 at 12:54 PM, James Hughes
>  wrote:
>> On 26 April 2017 at 19:03, Arend Van Spriel
>>  wrote:
>>>
>>>
>>> On 26-4-2017 17:44, Steve deRosier wrote:
 On Wed, Apr 26, 2017 at 1:53 AM, Kalle Valo  wrote:
> Arend Van Spriel  wrote:
>> An issue was found brcmfmac driver in which a skbuff in .start_xmit()
>> callback was actually cloned. So instead of checking for sufficient
>> headroom it should also be writable. Hence use skb_cow_head() to
>> check and expand the headroom appropriately.
>>
>> Signed-off-by: Arend van Spriel 
>
> Steve, would you have time to run a quick test with this?
>
> Patch set to Deferred.
>

 Happy to give it a quick spin on both of my platforms.

>
> @ Arend and James, thanks for the info. I understand it, but
> unfortunately I can't seem to replicate the problems on my platforms
> with the limited time I have available to test it. It also may have to
> do with my platforms having special custom bridging related code, or
> just me having setup too simple of a test.
>
> That said...
>
> @Kalle: I have tested on both my 6004 and 6003 platforms. I didn't
> notice any incorrect behavior in my testing. But I don't have a test
> setup that would have shown the original problem as reported on the
> brcm driver so I can't say that the change actually _fixes_ anything.
> Only that in my testing it doesn't seem to break anything.
>
> Tested-by: Steve deRosier 
>
> - Steve

It was quite difficult to reproduce on the Pi - in general the system
seems to recover from corrupted headers, but on the Pi the Wifi driver
was writing in some information to the header, then checking it again
later (after I think some sort of loopback, but not sure) - it was
corrupted. It requires BOTH drivers to have to same fault, i.e. both
failed to unclone, and it also required both drivers to be writing
something to the header in a place that was subsequently checked by
one of the drivers somehow to see if the data was valid. Even then it
only appeared to happen on certain packet types, in my case DHCP
packets using IPv6 seemed to kick it off.

So quite unpredictable when an error may occur.


Re: ath6kl: assure headroom of skbuff is writable in .start_xmit()

2017-04-26 Thread Steve deRosier
On Wed, Apr 26, 2017 at 12:54 PM, James Hughes
 wrote:
> On 26 April 2017 at 19:03, Arend Van Spriel
>  wrote:
>>
>>
>> On 26-4-2017 17:44, Steve deRosier wrote:
>>> On Wed, Apr 26, 2017 at 1:53 AM, Kalle Valo  wrote:
 Arend Van Spriel  wrote:
> An issue was found brcmfmac driver in which a skbuff in .start_xmit()
> callback was actually cloned. So instead of checking for sufficient
> headroom it should also be writable. Hence use skb_cow_head() to
> check and expand the headroom appropriately.
>
> Signed-off-by: Arend van Spriel 

 Steve, would you have time to run a quick test with this?

 Patch set to Deferred.

>>>
>>> Happy to give it a quick spin on both of my platforms.
>>>

@ Arend and James, thanks for the info. I understand it, but
unfortunately I can't seem to replicate the problems on my platforms
with the limited time I have available to test it. It also may have to
do with my platforms having special custom bridging related code, or
just me having setup too simple of a test.

That said...

@Kalle: I have tested on both my 6004 and 6003 platforms. I didn't
notice any incorrect behavior in my testing. But I don't have a test
setup that would have shown the original problem as reported on the
brcm driver so I can't say that the change actually _fixes_ anything.
Only that in my testing it doesn't seem to break anything.

Tested-by: Steve deRosier 

- Steve


Re: ath6kl: assure headroom of skbuff is writable in .start_xmit()

2017-04-26 Thread James Hughes
On 26 April 2017 at 19:03, Arend Van Spriel
 wrote:
>
>
> On 26-4-2017 17:44, Steve deRosier wrote:
>> On Wed, Apr 26, 2017 at 1:53 AM, Kalle Valo  wrote:
>>> Arend Van Spriel  wrote:
 An issue was found brcmfmac driver in which a skbuff in .start_xmit()
 callback was actually cloned. So instead of checking for sufficient
 headroom it should also be writable. Hence use skb_cow_head() to
 check and expand the headroom appropriately.

 Signed-off-by: Arend van Spriel 
>>>
>>> Steve, would you have time to run a quick test with this?
>>>
>>> Patch set to Deferred.
>>>
>>
>> Happy to give it a quick spin on both of my platforms.
>>
>> @Arend: is there some demonstrable before/after that shows a problem I
>> can detect at runtime?  I understand your thought about putting a
>> skb_clone() in there, but what are the expectations?  And is any
>> problem evident without explicitly modding the code with the clone?
>
> Ok. So the root cause is explained in a email to netdev mailing list,
> but I can not find it. The sender was probably not a member. I will
> forward that email to you and cc: linux-wireless. Basically, you need to
> setup a bridge and run hostapd in bridged mode. Incoming multicast
> traffic will be cloned by bridge and sent all interfaces in the bridge.
> If more than one driver puts additional payload in the headroom they are
> basically mucking about in the same buffer space so packets probably
> never end up in the devices. In case of ath6kl the patch is in area
> where driver/device determines IP checksum if it is supported (if I am
> not mistaken). So not sure how easy it is to replicate without patching
> it for testing.
>
> Regards,
> Arend

That was me. The full mechanism can be seen on the Raspberry Pi github
issue tracker  here

https://github.com/raspberrypi/firmware/issues/673

In brief, when bridging between two devices, if both devices fail to
'unclone' then
header corruption could occur if both the devices made header changes
since they are
both looking at the same data.

The Pi has a smsc9x ethernet device and the Brcm Wireless chip - both
had the fault, so we
were getting corrupted headers, and eventual failure of ethernet.

The same fault appears in a large subset of drivers in my brief examinations.

James


Re: ath6kl: assure headroom of skbuff is writable in .start_xmit()

2017-04-26 Thread Arend Van Spriel


On 26-4-2017 17:44, Steve deRosier wrote:
> On Wed, Apr 26, 2017 at 1:53 AM, Kalle Valo  wrote:
>> Arend Van Spriel  wrote:
>>> An issue was found brcmfmac driver in which a skbuff in .start_xmit()
>>> callback was actually cloned. So instead of checking for sufficient
>>> headroom it should also be writable. Hence use skb_cow_head() to
>>> check and expand the headroom appropriately.
>>>
>>> Signed-off-by: Arend van Spriel 
>>
>> Steve, would you have time to run a quick test with this?
>>
>> Patch set to Deferred.
>>
> 
> Happy to give it a quick spin on both of my platforms.
> 
> @Arend: is there some demonstrable before/after that shows a problem I
> can detect at runtime?  I understand your thought about putting a
> skb_clone() in there, but what are the expectations?  And is any
> problem evident without explicitly modding the code with the clone?

Ok. So the root cause is explained in a email to netdev mailing list,
but I can not find it. The sender was probably not a member. I will
forward that email to you and cc: linux-wireless. Basically, you need to
setup a bridge and run hostapd in bridged mode. Incoming multicast
traffic will be cloned by bridge and sent all interfaces in the bridge.
If more than one driver puts additional payload in the headroom they are
basically mucking about in the same buffer space so packets probably
never end up in the devices. In case of ath6kl the patch is in area
where driver/device determines IP checksum if it is supported (if I am
not mistaken). So not sure how easy it is to replicate without patching
it for testing.

Regards,
Arend


Re: ath6kl: assure headroom of skbuff is writable in .start_xmit()

2017-04-26 Thread Steve deRosier
On Wed, Apr 26, 2017 at 1:53 AM, Kalle Valo  wrote:
> Arend Van Spriel  wrote:
>> An issue was found brcmfmac driver in which a skbuff in .start_xmit()
>> callback was actually cloned. So instead of checking for sufficient
>> headroom it should also be writable. Hence use skb_cow_head() to
>> check and expand the headroom appropriately.
>>
>> Signed-off-by: Arend van Spriel 
>
> Steve, would you have time to run a quick test with this?
>
> Patch set to Deferred.
>

Happy to give it a quick spin on both of my platforms.

@Arend: is there some demonstrable before/after that shows a problem I
can detect at runtime?  I understand your thought about putting a
skb_clone() in there, but what are the expectations?  And is any
problem evident without explicitly modding the code with the clone?

- Steve


Re: ath6kl: assure headroom of skbuff is writable in .start_xmit()

2017-04-26 Thread Arend van Spriel

On 4/26/2017 10:53 AM, Kalle Valo wrote:

Arend Van Spriel  wrote:

An issue was found brcmfmac driver in which a skbuff in .start_xmit()
callback was actually cloned. So instead of checking for sufficient
headroom it should also be writable. Hence use skb_cow_head() to
check and expand the headroom appropriately.

Signed-off-by: Arend van Spriel 


Steve, would you have time to run a quick test with this?

Patch set to Deferred.


Just a hint. I tested the equivalent patch in brcmfmac by doing a 
skb_clone() just before the headroom if-statement (and a kfree_skb() 
afterwards obviously ;-) ).


Regards,
Arend


Re: ath6kl: assure headroom of skbuff is writable in .start_xmit()

2017-04-26 Thread Kalle Valo
Arend Van Spriel  wrote:
> An issue was found brcmfmac driver in which a skbuff in .start_xmit()
> callback was actually cloned. So instead of checking for sufficient
> headroom it should also be writable. Hence use skb_cow_head() to
> check and expand the headroom appropriately.
> 
> Signed-off-by: Arend van Spriel 

Steve, would you have time to run a quick test with this?

Patch set to Deferred.

-- 
https://patchwork.kernel.org/patch/9697757/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches