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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A595EEB64DB for ; Wed, 14 Jun 2023 16:53:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236432AbjFNQxG (ORCPT ); Wed, 14 Jun 2023 12:53:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236187AbjFNQxD (ORCPT ); Wed, 14 Jun 2023 12:53:03 -0400 Received: from smtp-fw-80009.amazon.com (smtp-fw-80009.amazon.com [99.78.197.220]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C0CA1BC6; Wed, 14 Jun 2023 09:53:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1686761582; x=1718297582; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eplfOdVA/Gtb1sMFHGiGQO4cWp3IaiH84feaBJgtGc8=; b=vTaROZBP2k5WputhhE4s4JzQMQObZ6l8rA87stgxP7t7z++VgEZ9goK1 iHGjYVHjxl0/VkbkZH7UQGA922bgHQnaD1+cgH6P2eSWQEbU5oAnkd419 BQKTmSTwQTAX6/BDZF9putnKTloOptdSD7xo0prG9/7nU/LCFA6qbvy0L Q=; X-IronPort-AV: E=Sophos;i="6.00,243,1681171200"; d="scan'208";a="10138159" Received: from pdx4-co-svc-p1-lb2-vlan3.amazon.com (HELO email-inbound-relay-pdx-2b-m6i4x-7fa2de02.us-west-2.amazon.com) ([10.25.36.214]) by smtp-border-fw-80009.pdx80.corp.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2023 16:53:00 +0000 Received: from EX19MTAUWC002.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-pdx-2b-m6i4x-7fa2de02.us-west-2.amazon.com (Postfix) with ESMTPS id C812240DF5; Wed, 14 Jun 2023 16:52:58 +0000 (UTC) Received: from EX19D004ANA001.ant.amazon.com (10.37.240.138) by EX19MTAUWC002.ant.amazon.com (10.250.64.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 14 Jun 2023 16:52:56 +0000 Received: from 88665a182662.ant.amazon.com (10.187.170.18) by EX19D004ANA001.ant.amazon.com (10.37.240.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 14 Jun 2023 16:52:51 +0000 From: Kuniyuki Iwashima To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH bpf-next v2 3/6] net: remove duplicate reuseport_lookup functions Date: Wed, 14 Jun 2023 09:52:44 -0700 Message-ID: <20230614165244.59782-1-kuniyu@amazon.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.187.170.18] X-ClientProxiedBy: EX19D046UWB002.ant.amazon.com (10.13.139.181) To EX19D004ANA001.ant.amazon.com (10.37.240.138) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lorenz Bauer Date: Wed, 14 Jun 2023 16:25:05 +0100 > On Tue, Jun 13, 2023 at 7:57 PM Kuniyuki Iwashima wrote: > > > > else { > > result = sk; > > } > > > > The assignment to result below is buggy. Let's say SO_REUSEPROT group > > have TCP_CLOSE and TCP_ESTABLISHED sockets. > > I'm not very familiar with SO_REUSEPORT, I assumed (incorrectly > probably) that such a group would only ever have TCP_CLOSE in UDP case > and TCP_LISTENING in TCP case. Can you explain how I could end up in > this situation? When we call conenct() for UDP socket in SO_REUSEPORT group, the state is changed from TCP_CLOSE to TCP_ESTABLISHED in __ip4_datagram_connect(), and the socket remains in the group. That's why we check TCP_ESTABLISHED in reuseport_select_sock_by_hash() that is always false for TCP but true for UDP in the case above.