Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4553054pxv; Tue, 6 Jul 2021 03:52:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyPWuL9RsqkgiaRMWMYkhpNmK9fL20la1LTmYBRkqD9W2o/8oDhEN6w4ZP+IBju9vKVDKk X-Received: by 2002:a05:6402:50c6:: with SMTP id h6mr22140067edb.296.1625568752100; Tue, 06 Jul 2021 03:52:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625568752; cv=none; d=google.com; s=arc-20160816; b=g2XOIXm3SEtHbTEYLjIqkClR3Eb6aTK24SG+CLo48z4Vo9g4Cd2kJXYZVddQVk9Q4/ N+1ypE4xz1jjgLFMG4v98zoMKCKWC8Fl4rz0rE/KNiklS52T45L4FlICerRTWwQSkacd 0O21edo87yTJ6+9UzqM56AF/BwkaTlQDqDTm9GRVg0UP1KsY5TL4KdlI7xP7nP8JH1/0 CcUjYOhxdaeotwE89lDnbohMirSDa0ZfZVVcNbNmM1i+XplzZUqjU6Zlsn6pr3gmL6fU r5LhkAn4JCUoP8ZDieAQynKAI7HU4X2+0BBCOhrEbolnE4Ek4CvnIpwaYHBjurd+HUiT coTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=HZyceiNYEc4HwTqzigTguM7c2drE1T/3F23lG3cmtLY=; b=GiH/fP1Z1RyILaSkCkVLpHvCV4WuQsPP8EQ/s+H901xXu01+IV/p6fMskPnkxj8GWK tdnSEiDDsLH+Eicned98p4E1DvaGM/ooD7yRtBdRlwMfSMM8OYaFPM343vWbGLzAA81n HzzeHzM1Yp+2xPZKoHfeVQ8XQ6ckszzTm3+E04vmtA12kbcHQIcclN11beIXdBelC63x XcjRAkuZBLFKWGHIWR+WI1+EoIULb/rCBO8rfwuNDf+VZ31TRs6T8JgxeIzVKTkZvinJ CsbLXXhvKG6sznXuxfA4W5kXOOOsRr4SV9iO0Wltk3HAikVKKhd7MxMwwOeE3uiqF14H 32iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hF+CJyGw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cy8si254649edb.477.2021.07.06.03.52.08; Tue, 06 Jul 2021 03:52:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hF+CJyGw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231569AbhGFKwG (ORCPT + 99 others); Tue, 6 Jul 2021 06:52:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:46062 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231450AbhGFKwF (ORCPT ); Tue, 6 Jul 2021 06:52:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CCA35619A9; Tue, 6 Jul 2021 10:49:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625568567; bh=GwNQpm53q/wD0dTeAU0sFMJs9aBW0jJQzZ/Q08A+rOA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hF+CJyGwa8VJ58W3zQfKAuUsEM7xJsHylSntyaxp050NhC0NH15kZ1d7AYJjL/EGy h5zsyzA8R3nfLDIJfLFqAJgm5XK/SzweauEFiEhBqboTBkjqEzsPpYmRsm1dVyAPC2 mq2lki54A9DBlljf3nCgswDbXqTHKuMxAX4B31gmiItaiDl1VsuYK2pliAaUxT8jMX Rcy26GPNbWZM6WCPlHPIPcyAMgJ7H5SegyOKIKIbu2HaANuu1rXx30ZJj+b6u69lgP wloSqlmfoNr9cPyAVsTLABR/dq85ZDTu2uLhjpdSsnZX39EeItD0zrvwRpeNH2X01D +htI3dExU6Faw== Date: Tue, 6 Jul 2021 12:49:24 +0200 From: Frederic Weisbecker To: Steffen Klassert Cc: LKML , Peter Zijlstra , "David S . Miller" , "Ahmed S . Darwish" , stable@vger.kernel.org, Varad Gautam , Herbert Xu , netdev@vger.kernel.org Subject: Re: [PATCH] xfrm: Fix RCU vs hash_resize_mutex lock inversion Message-ID: <20210706104924.GA107277@lothringen> References: <20210628133428.5660-1-frederic@kernel.org> <20210630065753.GU40979@gauss3.secunet.de> <20210705115850.GF40979@gauss3.secunet.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210705115850.GF40979@gauss3.secunet.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 05, 2021 at 01:58:50PM +0200, Steffen Klassert wrote: > On Wed, Jun 30, 2021 at 08:57:53AM +0200, Steffen Klassert wrote: > > On Mon, Jun 28, 2021 at 03:34:28PM +0200, Frederic Weisbecker wrote: > > > xfrm_bydst_resize() calls synchronize_rcu() while holding > > > hash_resize_mutex. But then on PREEMPT_RT configurations, > > > xfrm_policy_lookup_bytype() may acquire that mutex while running in an > > > RCU read side critical section. This results in a deadlock. > > > > > > In fact the scope of hash_resize_mutex is way beyond the purpose of > > > xfrm_policy_lookup_bytype() to just fetch a coherent and stable policy > > > for a given destination/direction, along with other details. > > > > > > The lower level net->xfrm.xfrm_policy_lock, which among other things > > > protects per destination/direction references to policy entries, is > > > enough to serialize and benefit from priority inheritance against the > > > write side. As a bonus, it makes it officially a per network namespace > > > synchronization business where a policy table resize on namespace A > > > shouldn't block a policy lookup on namespace B. > > > > > > Fixes: 77cc278f7b20 (xfrm: policy: Use sequence counters with associated lock) > > > Cc: stable@vger.kernel.org > > > Cc: Ahmed S. Darwish > > > Cc: Peter Zijlstra (Intel) > > > Cc: Varad Gautam > > > Cc: Steffen Klassert > > > Cc: Herbert Xu > > > Cc: David S. Miller > > > Signed-off-by: Frederic Weisbecker > > > > Your patch has a conflicht with ("commit d7b0408934c7 xfrm: policy: Read > > seqcount outside of rcu-read side in xfrm_policy_lookup_bytype") > > from Varad. Can you please rebase onto the ipsec tree? > > This patch is now applied to the ipsec tree (on top of the > revert of commit d7b0408934c7). > > Thanks everyone! Thanks a lot!