Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp4227126rwb; Tue, 16 Aug 2022 17:32:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR54TU3ZdbhzDxssiL6GtHqbN6ht+cQbSo+YHx8wIumfHYmmjmDuEBNqPm9PtpGhKxh0EFsH X-Received: by 2002:a17:907:a057:b0:730:a2d8:d5ac with SMTP id gz23-20020a170907a05700b00730a2d8d5acmr14838369ejc.764.1660696342304; Tue, 16 Aug 2022 17:32:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660696342; cv=none; d=google.com; s=arc-20160816; b=lqv7T75+U7a76NGwshQFGkUnRXdYe76iRve/LNFP/2zXF7W9ugYykizTZKRG3eAvaf x7XefWwZsBCiLSVsT9Nc4wIX8j3Xv1ff+CD7vf71h2bZOlfMYyeVxjubKQE2LTB+RPFV hi4zAZfghDQLJml5kiDQSEEIZk/7/KY9Sb3uKNMYQtAWJUkvWamE139F7/XPu4cM2Tg4 +5nuuhub5XD8U8pj2KkRagftUkaEx4Sm1ZtiVsCseG1RK15Cyomud5gL2IQu42Z43rq8 EcB7LzFcCxPC2gjWWVM1iaWhpROw4ZGXKAvQHQ6/gjwgC3hMnCN++snl9PEqtdp0Tcgn BdrA== 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=Qa4FOhE6ZQR0nP599i8okYXMztkfcq+wJ8QLsc5nrg0=; b=NsSw4Sxo6V344769ptcmLiLtl9lyPYcb258/FLeNOESOya2mUQivgu0lyfb2XXuc/v j8XrMZL9VbL88T7CDzEauBpFZhfvRaHFxpmNPFWT4okn2ANfa8NHfbChFTl6SFirtfJh 4aLR1nVJBn6A/6EowJJqv6VjuiIKrJ1G6i85XD33qc/5tIqZijGx/yCO8AF/9DxoamVE tmbOddEixonQuEIEfOl81X6zg16RC5LabM8sKFhlx812CRFNsz15ibzOjoC2qTp9Xwe+ f214agUgAQAi7GNIoWCam8HMvzVmavNiPXRtC3SfAzvQ8Q1O2k5tkwR9maqaq7xDFE+H j6dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uDEO8H5Q; 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 js17-20020a17090797d100b00732fd99cdb5si11239072ejc.854.2022.08.16.17.31.56; Tue, 16 Aug 2022 17:32:22 -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=uDEO8H5Q; 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 S237656AbiHPXoj (ORCPT + 99 others); Tue, 16 Aug 2022 19:44:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229675AbiHPXoi (ORCPT ); Tue, 16 Aug 2022 19:44:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C578915C2; Tue, 16 Aug 2022 16:44:37 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 3EA616134B; Tue, 16 Aug 2022 23:44:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B4F7C433C1; Tue, 16 Aug 2022 23:44:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660693476; bh=OAzkgD5LmFOw0cU+/xIlB9h5Vph5ExEgMh4qFj5H50A=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=uDEO8H5QZeU9XvjDP5n5ihdX6f32eqoyRUxcYOZ+bvYDd1xTbA2RNWjQB4igljzDh y6IpaJ62pAdBsyCSQvq/RUtbV3aYd422+8gP+ek/eY02kLD5grw6qqazi9T02C1uuP LJ8JdErwQK8O9NDuaB/SaX+Q2Cvp8TyKk6S0AY5OGhvuWr5RNTs/tFOPpNR0M+sbUC pFQmNwlP6KVQmXTdZ0rAOCW/iC7aydW6xumFXJN6vWXAbcKM8oiK/ZEw4V+/Mhil/z AyyuJbTmuNuoUrYr92W8nZ+kZY/ZuGtjoO+1FshsEgJ2Q+wmOEMV/6ICtNI8+7NnyN GgJ52V4PQ2xsw== Date: Tue, 16 Aug 2022 16:44:35 -0700 From: Jakub Kicinski To: David Howells Cc: Hawkins Jiawei , "David S. Miller" , Eric Dumazet , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , 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: <20220816164435.0558ef94@kernel.org> In-Reply-To: <804153.1660684606@warthog.procyon.org.uk> References: <20220816103452.479281-1-yin31149@gmail.com> <166064248071.3502205.10036394558814861778.stgit@warthog.procyon.org.uk> <804153.1660684606@warthog.procyon.org.uk> 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 22:16:46 +0100 David Howells wrote: > So either __rcu_dereference_sk_user_data_with_flags_check() has to be a macro, > or we need to go with something like the first version of my patch where I > don't pass the condition through. Do you have a preference? 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... One the naming - maybe just drop the _with_flags() ? There's no version of locked helper which does not take the flags. And not underscores?