From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailtransmit05.runbox.com (mailtransmit05.runbox.com [185.226.149.38]) (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 B96893BB117; Fri, 26 Jun 2026 20:43:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.226.149.38 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782506590; cv=none; b=tidVCxZCqiOBJj6c1xv1XjeXWYSZ+LmGj59epyWIfS+iQhJFoJS3JYUNsp0Hbki5hfIty04RI2gA18JT9PiVetEUyyq9xQbrg+kFC9IvlDSeX+RghokbdNOvLVlkgFn9bY9TSK7uEtC+pZ58SSc1DaifembxaZ8tqHF9o8d96Rg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782506590; c=relaxed/simple; bh=8OIk93A1yIg8RtXTheftIilx7caQYAZJV41zNjm/1DA=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=q7btU/IaqBnNTeVwo4NIPbm38u/1cUj6KHzEQUCp4ZJPdAvxyd3zEVNUuJ1YwELG5BmZR/QYeEc6mL8BGhFajYX0lolUu8K+vxugliNyXpDRve8HvXXVvHFkhyyHOnnRVGiRXvdKRaUNQGTAevBijvQFCfzccDAZNVqzjlmR+Cs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rbox.co; spf=pass smtp.mailfrom=rbox.co; dkim=pass (2048-bit key) header.d=rbox.co header.i=@rbox.co header.b=Oi8VJY/Z; arc=none smtp.client-ip=185.226.149.38 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rbox.co Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rbox.co Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rbox.co header.i=@rbox.co header.b="Oi8VJY/Z" Received: from mailtransmit03.runbox ([10.9.9.163] helo=aibo.runbox.com) by mailtransmit05.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1wdDO6-00DCO6-1T; Fri, 26 Jun 2026 22:42:58 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=rbox.co; s=selector2; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References: Cc:To:Subject:From:MIME-Version:Date:Message-ID; bh=n/DYGvtv0ZMjSlvJQCCdtxc5LTPcQ2fzJLG4TjguW0s=; b=Oi8VJY/Zy1oeierb4nNV8eGQDF 9g4Jj8A5MI19pIms/GcJQdQwLMhjSkcEtj6tVbPlDEW5KXqq6M8AL1ywGt4JwBgJmx1yN5LdzMoGH eSF2vjychtf7eIKnwvhx7tNroBAiUkV47ACgRsYlZSM+Sfn0M/VlcMyIlnLRnala2B3IwUyFRPBWy 9cjoxw+Up3XkJn0edJQwbn8c9yMkt7bQsCfSXttlaaAtNHoR2OMeLdd5/uJWToaFOOxNHdFsNQnJV tkAdq9jkQekGBPHU9f8X5RveUQEF2KJ39uZx4mMsTqEwLHm60k2l3815uaTnciKUu7YiZVxQxCLVZ BU5y1l1A==; Received: from [10.9.9.74] (helo=submission03.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1wdDO0-0003yQ-Cr; Fri, 26 Jun 2026 22:42:52 +0200 Received: by submission03.runbox with esmtpsa [Authenticated ID (604044)] (TLS1.2:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.95) id 1wdDNn-008BEG-3k; Fri, 26 Jun 2026 22:42:39 +0200 Message-ID: Date: Fri, 26 Jun 2026 22:42:33 +0200 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Michal Luczaj Subject: Re: [PATCH bpf 1/2] bpf, sockmap: Don't leak UDP socks on lookup-bind-release To: Jakub Sitnicki , Kuniyuki Iwashima Cc: Willem de Bruijn , John Fastabend , Jiayuan Chen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Alexei Starovoitov , Cong Wang , Daniel Borkmann , Andrii Nakryiko , Eduard Zingerman , Kumar Kartikeya Dwivedi , Martin KaFai Lau , Song Liu , Yonghong Song , Jiri Olsa , Emil Tsalapatis , Shuah Khan , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org References: <20260623-sockmap-lookup-udp-leak-v1-0-05804f9308e4@rbox.co> <20260623-sockmap-lookup-udp-leak-v1-1-05804f9308e4@rbox.co> <87wlvoxdq1.fsf@cloudflare.com> <87o6gyyjxk.fsf@cloudflare.com> Content-Language: pl-PL, en-GB In-Reply-To: <87o6gyyjxk.fsf@cloudflare.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 6/25/26 12:48, Jakub Sitnicki wrote: > On Wed, Jun 24, 2026 at 02:39 PM -07, Kuniyuki Iwashima wrote: >> On Wed, Jun 24, 2026 at 2:33 PM Kuniyuki Iwashima wrote: >>> ... >>> Setting SOCK_RCU_FREE itself should not cause a problem, but I think >>> we should take a step back. >>> >>> AFAIU, 0c48eefae712 was to allow putting AF_UNIX SOCK_DGRAM sockets >>> into sockmap, not to allow using unconnected UDP sockets in sk_lookup etc. >>> >>> Actually, v4 of the patch was implemented as such but did not get any feedback, >>> https://lore.kernel.org/bpf/20210508220835.53801-9-xiyou.wangcong@gmail.com/#t >>> >>> ... and v5 (the final commit) somehow removed the restriction for unconnected >>> UDP socket as well. >>> https://lore.kernel.org/bpf/20210704190252.11866-3-xiyou.wangcong@gmail.com/ >>> >>> Given the initial use case, sockmap redirect, is still blocked by >>> TCP_ESTABLISHED >>> check in sock_map_redirect_allowed(), I feel there is no point in supporting >>> unconnected UDP sockets in sockmap. It cannot get any skb from anywhere >>> (without buggy sk_lookup). >> >> s/unconnected/unhashed/g :) > > Rejecting unhashed UDP sockets on insert to sockmap SGTM. > It is also in line with disable-problematic-cases strategy. OK, here's v2 with the sock_map_sk_state_allowed() check reintroduced: https://lore.kernel.org/bpf/20260626-sockmap-lookup-udp-leak-v2-0-7e7e201c951a@rbox.co/ Thanks, Michal