Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp4091804rwb; Tue, 16 Aug 2022 14:26:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Njv08plEG0Xey8MSgmEw5vP5kv2I0bKHtS7bs1ItmMiH6GPFeN3T0xIJ3IJEQx0aSoVSI X-Received: by 2002:a17:90b:4b8a:b0:1f5:942:dcc6 with SMTP id lr10-20020a17090b4b8a00b001f50942dcc6mr540043pjb.78.1660685213724; Tue, 16 Aug 2022 14:26:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660685213; cv=none; d=google.com; s=arc-20160816; b=S0aZ9Z5ZArrQEc5eEVvUDjy2HgQhlyDkJHbzkyClyAteghNvZ/cIxuo4EZG9y4HTpO Yxz/I0GDhT2cV/E5IEllKNrre9byoXTss/khbaCuPOb98ela7xy8FZdRgnq2Zl6TQ8au cZk++mrX6ZVQ70iDUyxgcBsyASPKnc8LzSjHvq+nmTAsk75ArXoqjrWyt2OHLsm/R1ja UVV0BGd8oyrAl3N0NY/KCL/OY+Ue8sNYH8rfiCAHONt0oHoOhIJUwmNRiBII8ZKGgIqE th7tAUPS1mzvKsr83J8kUuWH/pUkgSWn6wlYHIPa/CBLT559EJaL5P5+c0072lc29+QM 5L3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-transfer-encoding :content-id:mime-version:subject:cc:to:references:in-reply-to:from :organization:dkim-signature; bh=2iqj6YUSsuItIPg1WhM2vpcdPov5sWXfn7fAfkdN2WE=; b=jLDJGT24D5KGWKPBT9quHY5GEDabCZIDpD25YhVtAAiJKFZN+/+Cq6FzB4t2M/vwa8 g9nrhJDHtcH39CXVG+R9Qqw0j8jqi2b/2IQffaX5zKvTV+gORUjjBYmOnbfSColYWQcs XCWUJApwTXvaYDKnoskTTG+ilCJmel/6zx7e/PFnsE42XxNhLPeG0u00Dofau6h7i/Mh UCVGAf67L0tB58eX38+e4kmqmsbklIvAIU4wjBKoM8Fh3M8zC5Od80zVD6l1sNuX1T+m z6fb7hAU4WifURyE2FjL9G2fJDxA9rGHHH6mXuXZ+kwm3HObrVXZ09iL3JxNqlFCukAa PW3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Wn9XUu50; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v5-20020a63f205000000b0041d17e08467si14487582pgh.381.2022.08.16.14.26.37; Tue, 16 Aug 2022 14:26:53 -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=@redhat.com header.s=mimecast20190719 header.b=Wn9XUu50; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237569AbiHPVRn (ORCPT + 99 others); Tue, 16 Aug 2022 17:17:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237495AbiHPVRW (ORCPT ); Tue, 16 Aug 2022 17:17:22 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6223F8B985 for ; Tue, 16 Aug 2022 14:16:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660684613; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2iqj6YUSsuItIPg1WhM2vpcdPov5sWXfn7fAfkdN2WE=; b=Wn9XUu50xNoPmZLjBbu066Xse0UHbe5amKgB3Z4IV5Ww2nkhgT0JFlgibS9a8uAg7wwGHL YfuF5XMJOhFTAobW7J4upzZJdRqjMinKXWuVSKq9LY252uUDhDZb3nZ3/+fRgDn0bT4LCy XgN6YsJOP0WqoXEQPfQCEdNIQUMl8SQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-111-60_09m4xMDqeYoZnVse8mQ-1; Tue, 16 Aug 2022 17:16:50 -0400 X-MC-Unique: 60_09m4xMDqeYoZnVse8mQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A80E61C13945; Tue, 16 Aug 2022 21:16:48 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id B088518ECC; Tue, 16 Aug 2022 21:16:46 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20220816103452.479281-1-yin31149@gmail.com> References: <20220816103452.479281-1-yin31149@gmail.com> <166064248071.3502205.10036394558814861778.stgit@warthog.procyon.org.uk> To: Hawkins Jiawei Cc: dhowells@redhat.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , 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 Subject: Re: [PATCH] net: Fix suspicious RCU usage in bpf_sk_reuseport_detach() MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <804152.1660684606.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Tue, 16 Aug 2022 22:16:46 +0100 Message-ID: <804153.1660684606@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Hawkins Jiawei wrote: > +__rcu_dereference_sk_user_data_with_flags_check(const struct sock *sk, > + uintptr_t flags, bool condition) That doesn't work. RCU_LOCKDEP_WARN() relies on anything passing on a condition down to it to be a macro so that it can vanish the 'condition' argument without causing an undefined symbol for 'lockdep_is_held' if lock= dep is disabled: x86_64-linux-gnu-ld: kernel/bpf/reuseport_array.o: in function `bpf_sk_reu= seport_detach': /data/fs/linux-fs/build3/../kernel/bpf/reuseport_array.c:28: undefined ref= erence to `lockdep_is_held' So either __rcu_dereference_sk_user_data_with_flags_check() has to be a ma= cro, 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? David