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: <1d8c901f-e292-43e4-970f-8440b26e92b0@nvidia.com>
Date: Thu, 2 Jan 2025 11:33:34 +0800
From: Jianbo Liu <jianbol@...dia.com>
To: Hangbin Liu <liuhangbin@...il.com>, Jakub Kicinski <kuba@...nel.org>
CC: <netdev@...r.kernel.org>, Jay Vosburgh <jv@...sburgh.net>, Andy Gospodarek
	<andy@...yhouse.net>, "David S. Miller" <davem@...emloft.net>, Eric Dumazet
	<edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Nikolay Aleksandrov
	<razor@...ckwall.org>, Simon Horman <horms@...nel.org>, Tariq Toukan
	<tariqt@...dia.com>, Andrew Lunn <andrew+netdev@...n.ch>, Shuah Khan
	<shuah@...nel.org>, <linux-kselftest@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net 0/2] bond: fix xfrm offload feature during init



On 1/2/2025 10:44 AM, Hangbin Liu wrote:
> On Fri, Dec 13, 2024 at 07:31:27PM -0800, Jakub Kicinski wrote:
>> On Fri, 13 Dec 2024 07:18:08 +0000 Hangbin Liu wrote:
>>> On Thu, Dec 12, 2024 at 06:27:34AM -0800, Jakub Kicinski wrote:
>>>> On Wed, 11 Dec 2024 07:11:25 +0000 Hangbin Liu wrote:
>>>>> The first patch fixes the xfrm offload feature during setup active-backup
>>>>> mode. The second patch add a ipsec offload testing.
>>>>
>>>> Looks like the test is too good, is there a fix pending somewhere for
>>>> the BUG below? We can't merge the test before that:
>>>
>>> This should be a regression of 2aeeef906d5a ("bonding: change ipsec_lock from
>>> spin lock to mutex"). As in xfrm_state_delete we called spin_lock_bh(&x->lock)
>>> for the xfrm state delete.
>>>
>>> But I'm not sure if it's proper to release the spin lock in bond code.
>>> This seems too specific.
>>>
>>> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>>> index 7daeab67e7b5..69563bc958ca 100644
>>> --- a/drivers/net/bonding/bond_main.c
>>> +++ b/drivers/net/bonding/bond_main.c
>>> @@ -592,6 +592,7 @@ static void bond_ipsec_del_sa(struct xfrm_state *xs)
>>>   	real_dev->xfrmdev_ops->xdo_dev_state_delete(xs);
>>>   out:
>>>   	netdev_put(real_dev, &tracker);
>>> +	spin_unlock_bh(&xs->lock);
>>>   	mutex_lock(&bond->ipsec_lock);
>>>   	list_for_each_entry(ipsec, &bond->ipsec_list, list) {
>>>   		if (ipsec->xs == xs) {
>>> @@ -601,6 +602,7 @@ static void bond_ipsec_del_sa(struct xfrm_state *xs)
>>>   		}
>>>   	}
>>>   	mutex_unlock(&bond->ipsec_lock);
>>> +	spin_lock_bh(&xs->lock);
>>>   }
>>>   
>>>
>>> What do you think?
>>
>> Re-locking doesn't look great, glancing at the code I don't see any
>> obvious better workarounds. Easiest fix would be to don't let the
>> drivers sleep in the callbacks and then we can go back to a spin lock.
>> Maybe nvidia people have better ideas, I'm not familiar with this
>> offload.
> 
> I don't know how to disable bonding sleeping since we use mutex_lock now.
> Hi Jianbo, do you have any idea?
> 

I think we should allow drivers to sleep in the callbacks. So, maybe 
it's better to move driver's xdo_dev_state_delete out of state's spin lock.

Thanks!
Jianbo


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ