Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp4279296rwb; Tue, 16 Aug 2022 18:48:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Lx251iGmeIYl+i+G4ztxP2i5Iq9TR6oHc1FD/2Wv1he8u+Dvu1XSPCGqMTBSFc+Qixagi X-Received: by 2002:a05:6402:a47:b0:43d:17a0:fdc9 with SMTP id bt7-20020a0564020a4700b0043d17a0fdc9mr20818250edb.41.1660700914298; Tue, 16 Aug 2022 18:48:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660700914; cv=none; d=google.com; s=arc-20160816; b=QqF3l2m/TXCBrP0gxy+XsFvY0I7n24sPVaJFrV1hjoZeKV5f6Ppg1oeJd0qDgopKfJ Xlhlc6o/PS2PsFbrMwvpjWmzRkWPb64SARP9vQ3pEHoetbLGmILOM0pnjTgm/SVymm4D pIQxVuLPOcqSGnveNYcWIlYmozeBttEEb2QlU9lO+Oy2OIPnxnnAW2HfRpapeMN3G84h jmYu2nmRBv+LipdzBdqPj0I1RElsHQx+9v07D/Jbnlu42N5XUNPYKxJGopHDo9/kCapo Yp4BZCWgn9cTcrLvtK8ugWE82N8yJd95EHSpIL/nQbI+5i47DbDTIgQrD0Eefpfmxro1 jNeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=ThPcZn3/VYFBM7qj86XI6PF3bf3H85PrYv46P7Nlyqc=; b=NI+/jFwcTU7wjanUjPItqHP/AF+mDFHJiWC1LCjZq6MItMUIuyV2uh/dCimVuA0l42 qiBfc/HwkMi6/b1ddsu12pvDn6OHH+sl77/bwlycdRolHBEfDbHuvA1JXQc539eN2bI1 7uMyIWM1ZFcK2VSNvluqMvPcDnbyMf3OSZQ6yOAfn+XYNZCFwZm7EW62leWV8L/9s+gL FiCb+nCO7YxZsQoROU7RS9DtMl7f2wviq9MwtWj8gEwu4VtJTWta6kdcqZxa1K06zMWM hxVJC5VRGRaZAIq4TWsXftvsFXNIXZqsDWnjKv6WPSt6DXRZMZw/ERn34O8UOwu7ihd+ 6IpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EEknQiKr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs20-20020a1709073e9400b0073305fd2278si11966849ejc.864.2022.08.16.18.48.08; Tue, 16 Aug 2022 18:48:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EEknQiKr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S238251AbiHQBji (ORCPT + 99 others); Tue, 16 Aug 2022 21:39:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238042AbiHQBjg (ORCPT ); Tue, 16 Aug 2022 21:39:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5335995AFE; Tue, 16 Aug 2022 18:39:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6CAD8B81B8D; Wed, 17 Aug 2022 01:39:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81E42C433D6; Wed, 17 Aug 2022 01:39:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660700372; bh=WNI4T2l1xlFYKRJlgSA2O9Bc98a5ZBHH6E/B6tCD50A=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=EEknQiKrl/fuhzX2gYjfHuS2LhzKcvaeq3V/YtQcZVtcI78dfH+0IsdjveRIYTLHh 1grv26DVJhODDyf1ecCVDxMbjo1sSJ4DqiS37XphKS80Gl4NvqNQhdrIPoDTnt3Abz QmkJq5ksZu/qUhsA29utPhTN2t2Qz3uH2BuTQSYGUxF52YZT8KVZcInAT4lYyTZO+Y lDx+luMTE+zYuCCY/I1QGnAM3LhLa04WQaCJCog9XRcyZgpzcM340le5rc3eHddq+y mP8yQCYrjv4h0HShV9WvfJ8uR2lQaw0H292s6ns2Y3uuqlSs4UD0nXtewuds+18bpf VHHXp+xAm2gfQ== Date: Tue, 16 Aug 2022 18:39:30 -0700 From: Jakub Kicinski To: Martin KaFai Lau Cc: David Howells , Hawkins Jiawei , "David S. Miller" , Eric Dumazet , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Song Liu , Yonghong Song , John Fastabend , KP Singh , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, bpf@vger.kernel.org, Jakub Sitnicki Subject: Re: [PATCH] net: Fix suspicious RCU usage in bpf_sk_reuseport_detach() Message-ID: <20220816183930.2328d46d@kernel.org> In-Reply-To: <20220817004319.fd7dekpqeumbvmsh@kafai-mbp> References: <20220816103452.479281-1-yin31149@gmail.com> <166064248071.3502205.10036394558814861778.stgit@warthog.procyon.org.uk> <804153.1660684606@warthog.procyon.org.uk> <20220816164435.0558ef94@kernel.org> <20220817004319.fd7dekpqeumbvmsh@kafai-mbp> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 16 Aug 2022 17:43:19 -0700 Martin KaFai Lau wrote: > > I like your version because it documents what the lock protecting this > > field is. > > > > In fact should we also add && sock_owned_by_user(). Martin, WDYT? Would > > that work for reuseport? Jakub S is fixing l2tp to hold the socket lock > > while setting this field, yet most places take the callback lock... > > It needs to take a closer look at where the lock_sock() has already > been acquired and also need to consider the lock ordering with reuseport_lock. > It probably should work but may need a separate patch to discuss those > considerations ? Right, the users of the field with a bit allocated protect the writes with the callback lock, so we can hard code the check against the callback lock for now and revisit later if needed.