Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp566460lqs; Thu, 13 Jun 2024 21:00:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVtWhgAG/jLiCPeVNqlsxOD7yWlWEqNutK4o0fwGj9PyP/hAbmKDZ5RwWYoBoeVgJbvBX0KfUKzSn3IYrpey43wqCsKW3ZORQj+6Z/8Mg== X-Google-Smtp-Source: AGHT+IFY+688BFC+xMTifd4dO7GoxV6MLVZnCIuX0aKntPuo5SyLOHvWXdSbGL2it4BXVKlMMcrl X-Received: by 2002:a05:620a:4413:b0:796:842c:7804 with SMTP id af79cd13be357-798d240efa7mr146485385a.18.1718337644297; Thu, 13 Jun 2024 21:00:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718337644; cv=pass; d=google.com; s=arc-20160816; b=Y2d9IYYV2tGTIxFKR1dsgylPjbiYrIYIfNVZ8P8QTmzvJXd8zTj2YGeApqyt/UncfN 5pi3g8JheODE8ZgiV3Oa2a+0fDGc6568ir+wy6Z1uMDGTWxw6ggoo83qyJ5qCIDbBwPZ G4QksD2eMqE7ssRQEgkeQkn9FNfqK7vc1+erpZrkP1xxNLo30bP+0byNqoX/OKFBchBi f1sljyZncSnvPhf4dH5pU7CdMKOHzenwBeQYFonpfqksLVvcTH2jgq2J7Fo5jbFrK6f2 +GIjlHSeb0lcdw1Tvp0avo+Isua+4kss+ToVKE9e4UJPqrU8LsBBsYqWj8QDC28daizZ YtsQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=+QJdvgldPrvymr/OgCF76gW0hwnT5SVZOv+cbI/xQLA=; fh=T7ERhH6hYC+MTsJMV3OLJLe/YDRg8VIHU0TRq9PzHa0=; b=mIodI6SHW0xWEWxaj891tfDgCaYRnDsxFQ9+ooBvAWPuQka8JIT9hhzupKUrb1hb9Q MH3KOdze6yZvDC3JqGSgXo8Z5X6PHh4b7qyCL50qRSmrq8SMMvggr3yxqw0DNK1sWw2Z Bv5ICzz4aqC3ebtU0jf/9nuqY21vO/QHFxJ6LDASgvJ99M1nLupD9/bS8dLemBnpV61N XmGZIIFM5rwDJ3HNG7XyoLbKOZfMuRekp41n4Yv+cyn9GVYeUr5IE2aKbxUbGmJk67t7 oqqnWGjJaTfmfoSxRxergeGhyAI2SQns3Fur8e0vM+2DDXCskfe+EvYHvn0yVwxa3Xd9 HxgA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=i-love.sakura.ne.jp); spf=pass (google.com: domain of linux-kernel+bounces-214327-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214327-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-798aeb8cfd6si314395985a.474.2024.06.13.21.00.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 21:00:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214327-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=i-love.sakura.ne.jp); spf=pass (google.com: domain of linux-kernel+bounces-214327-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214327-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 078771C212E9 for ; Fri, 14 Jun 2024 04:00:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DF661146019; Fri, 14 Jun 2024 04:00:37 +0000 (UTC) Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C4F9738B for ; Fri, 14 Jun 2024 04:00:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.181.97.72 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718337637; cv=none; b=Io8uMpqbM818j5WLpJdWyZhJPTibJ9KLchPFnpGoQgEGiP1xHI8Tf8wQ/LoanC3rIAUu5kr0a+SROKIWVN7SWnPkpFutXaiSRc5iMzBYlB0gVC+0cvxv4hXqn2QztO4vgjfmDu+0dl4LNwHnYSECnvpis0T83z31wCn37Ccek04= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718337637; c=relaxed/simple; bh=YD/hzsHGKMaPc9AEbzcC6z/zcPMYzbpxMvd818N27SE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=eBPNg7fWsLy6u5Jill9bg98hLUxSacI9OS/duN02qWxH1I44BTtSRj5XmRDBdzPrASd95GZQwXrYiNYhvdqV0rs6/7O/vWh3wJSNOPIQWYFjZGzuYVWk4G1zSHr1n6OS8dZw9QKm4Kv0Nc76s3sEIiW+PnU5m6TueNhuZQyo5rw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=I-love.SAKURA.ne.jp; spf=pass smtp.mailfrom=I-love.SAKURA.ne.jp; arc=none smtp.client-ip=202.181.97.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=I-love.SAKURA.ne.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=I-love.SAKURA.ne.jp Received: from fsav415.sakura.ne.jp (fsav415.sakura.ne.jp [133.242.250.114]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 45E40WLc079668; Fri, 14 Jun 2024 13:00:32 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav415.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav415.sakura.ne.jp); Fri, 14 Jun 2024 13:00:32 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav415.sakura.ne.jp) Received: from [192.168.1.6] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 45E40WRc079665 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Fri, 14 Jun 2024 13:00:32 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Message-ID: <522c0b17-c515-475d-8224-637ca0eaf6a2@I-love.SAKURA.ne.jp> Date: Fri, 14 Jun 2024 13:00:30 +0900 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [net/sched] Question: Locks for clearing ERR_PTR() value from idrinfo->action_idr ? To: Pedro Tammela , Jamal Hadi Salim , Cong Wang , Jiri Pirko Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Network Development , LKML References: <8d61200a-a739-4200-a8a3-5386a834d44f@I-love.SAKURA.ne.jp> Content-Language: en-US From: Tetsuo Handa In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 2024/06/14 11:47, Pedro Tammela wrote: > On 13/06/2024 21:58, Tetsuo Handa wrote: >> >> Is there a possibility that tcf_idr_check_alloc() is called without holding >> rtnl_mutex? > > There is, but not in the code path of this reproducer. > >> If yes, adding a sleep before "goto again;" would help. But if no, >> is this a sign that some path forgot to call tcf_idr_{cleanup,insert_many}() ? > > The reproducer is sending a new action message with 2 actions. > Actions are committed to the idr after processing in order to make them visible > together and after any errors are caught. > > The bug happens when the actions in the message refer to the same index. Since > the first processing succeeds, adding -EBUSY to the index, the second processing, > which references the same index, will loop forever. > > After the change to rely on RCU for this check, instead of the idr lock, the hangs > became more noticeable to syzbot since now it's hanging a system-wide lock. Thank you for explanation. Then, what type of sleep do we want? schedule_timeout_uninteruptible(1) (based on an assumption that conflict will be solved shortly) ? wait_event()/wake_up_all() using one global waitqueue (based on an assumption that conflict is rare) ? wait_event()/wake_up_all() using per struct tcf_idrinfo waitqueue (based on an assumption that conflict might not be rare) ?