From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18F57C07E9C for ; Mon, 5 Jul 2021 11:58:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 02EF861370 for ; Mon, 5 Jul 2021 11:58:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231281AbhGEMBb (ORCPT ); Mon, 5 Jul 2021 08:01:31 -0400 Received: from mailout1.secunet.com ([62.96.220.44]:52068 "EHLO mailout1.secunet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230174AbhGEMB3 (ORCPT ); Mon, 5 Jul 2021 08:01:29 -0400 Received: from cas-essen-01.secunet.de (unknown [10.53.40.201]) by mailout1.secunet.com (Postfix) with ESMTP id F0CCB80004A; Mon, 5 Jul 2021 13:58:50 +0200 (CEST) Received: from mbx-essen-01.secunet.de (10.53.40.197) by cas-essen-01.secunet.de (10.53.40.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 5 Jul 2021 13:58:50 +0200 Received: from gauss2.secunet.de (10.182.7.193) by mbx-essen-01.secunet.de (10.53.40.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Mon, 5 Jul 2021 13:58:50 +0200 Received: by gauss2.secunet.de (Postfix, from userid 1000) id 52696318041B; Mon, 5 Jul 2021 13:58:50 +0200 (CEST) Date: Mon, 5 Jul 2021 13:58:50 +0200 From: Steffen Klassert To: Frederic Weisbecker CC: LKML , Peter Zijlstra , "David S . Miller" , "Ahmed S . Darwish" , , Varad Gautam , Herbert Xu , Subject: Re: [PATCH] xfrm: Fix RCU vs hash_resize_mutex lock inversion Message-ID: <20210705115850.GF40979@gauss3.secunet.de> References: <20210628133428.5660-1-frederic@kernel.org> <20210630065753.GU40979@gauss3.secunet.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20210630065753.GU40979@gauss3.secunet.de> X-ClientProxiedBy: cas-essen-02.secunet.de (10.53.40.202) To mbx-essen-01.secunet.de (10.53.40.197) X-EXCLAIMER-MD-CONFIG: 2c86f778-e09b-4440-8b15-867914633a10 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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!