From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.219.71 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795963167; b=oq7NMEbj/smcBr2Pho/+G87gt66gdrh+94xEo/s2n5XmKPUviT8pNcguLc5ELfqG/vf5 U1PfMveysZhPsrJ+sf2CpUDaDE19ylp0TamrzStGHQ6tmoFKv+jqVDY8WgfNJElzlVCZ2 yTNsYNBmHbVCUQLm9tJpUaFgdfljpZ5eF9qVgjFYS7au1/DJvb2eu4aOGtAX0VRaQyv/1 KOax/PvDoJFd/F4VbivF5Wp/y4bDsXEXgbbh+b7y9CutI6gE2oZKqUotOETSW2A7UWGJA mZt3Dy80Ai69IWMBaCom+6v16Aff5rnSazQgm1b6b/JkxjHJW/HuWlQ8CQuu35IwQmw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795963167; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:Message-ID:Subject:From:To:Cc:Content-Type; bh=uAHokaPBJpNz8vQGumlObz1OsgSGR94s1DoHIXOiE8o=; b=XBa0Z8/qmbePCzcUt5uOx9ETw9zALEBFfnkQBBfAojVC0a03fDFKND7c9dk4sEo10ZC+ vQzv76ZHlyxgxb+Yy/iu7g7Dlj1I5RekjoTXWq7ejjCIObhsChp+exMoxoIwlRwYwI+oe dTdi9u7VCVsYyRS+xZ0Lrsu3kQ8JwPmhdYpgzal8F5weYDVqEA/HdqxXSPuthQcv3PxhS ixx1PSd9gHE/R72lCf+4Ln8aev6S2PH8h9E8WLVM+EiZHhq/DfIopk8ja9LYpvNQXwvT+ ZRTwSlf4u8PbEBm1BIwCJggjGrqWFJC8fMrFnY5Wze6+BorxRT5muUGmK/UDg0g1i4A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--willemb.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=KD7YRsWU; arc=none smtp.remote-ip=209.85.219.71 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1B31606A31C for ; Sun, 29 Nov 2026 14:39:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A1B31606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--willemb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=KD7YRsWU Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-92126ecb4b8so154454126d6.3 for ; Sun, 29 Nov 2026 06:39:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1795963165; x=1796567965; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=uAHokaPBJpNz8vQGumlObz1OsgSGR94s1DoHIXOiE8o=; b=KD7YRsWUd3GEwEJuAUrNz7xVnJjhwwvfDIEAOmNPl0xqlsOQ4QC3t+PBEji0NzxdNl IMEB5B2tKZoR0HEKBV872BwjbatWzJgs+SId2foOE3YTSYeejBzcSRU1fMPzuRataVU+ iO6fritTUCvkTB9VwHJizIoBo7RRcVeATSKADKvnwMkjehchgibSd6BQgCMvCklQet6V yuiLVQw0NKe4LqWi3ouEJYa3cV800cf4HrEINNvF4yHjl0OQ79xHG+YmKGYxipJVrQLv 96CiX+EVimNun/4/rfoYC7a0vk6Noba+CwWgNJhTq1UlsR0atPr98zYARU0wSc+NdPXU T5Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795963165; x=1796567965; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=uAHokaPBJpNz8vQGumlObz1OsgSGR94s1DoHIXOiE8o=; b=t6XhRUoR0ug3paXbkX4AxlJOzDV3VTjdCm2IIpZRUomsGZVmgIfjVEmE3DXVyhPFtE HKfk360zwjI7LWlknQcUAdVaVj1Q8HaYZF0yZVyV9rbrc0TkB+47tY/O2dZkQHP46r2R MEkqr4iYM8KzkfiG6LRPw0dPip+WZ7NdhPojcit+5xD756Lb7VdUV5R9MXvqBKKhW5Z0 uNyjY6U659GM6fKJveq/KvYxfEV3DfKwPVu7FG62ztdl+yrGwvaRtI8Gk/n9IFb9X0+I i1Tc1TpDiMnwt10jVe3end5BnYxwzwH8mcmXXFPdPoYSwNswhdBOSagKuKimzQW/NIK9 /2Cw== X-Forwarded-Encrypted: i=1; AL+hErEVTAJJBOysYOZYh9Alr22i1pqt7Oazfn8zcvusUVeIQJ23sMQ5KSBf86kI3qr4Jaryhma0Fvh3IaOAZ9M1vkE=@vger.kernel.org X-Gm-Message-State: APuU4Z9hE3UArdPqvyvp2aIe2I3SrVDyOJjc58eleUDu8RqpaTTw7Kv+ 6wh+8OqTcFng5ea/AxoJZZMJ0ZK3pzUS5AjGmWHo3+g8+8V2CV6s4qlaAM0xTD8Xq/0yhpZ6oM+ ofFLXwN1H2A== X-Received: from qvbcp20.prod.google.com ([2002:ad4:4af4:0:b0:91e:fe23:63bf]) (user=willemb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6214:c42:b0:91e:f3ad:b744 with SMTP id 6a1803df08f44-92134b2e713mr618124456d6.32.1795963165241; Sun, 29 Nov 2026 06:39:25 -0800 (PST) Date: Sun, 29 Nov 2026 09:39:24 -0500 In-Reply-To: <20261120174341.35873-1-juanagusnicco@gmail.com> X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261120174341.35873-1-juanagusnicco@gmail.com> Message-ID: Subject: Re: [PATCH net 0/4] udp: Fix bind conflict check bypasses From: willemb@google.com To: Juan Agustin Niccolini , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Simon Horman , Kuniyuki Iwashima , Willem de Bruijn , Willem de Bruijn , Eric Garver , Shuah Khan , linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8"; format=flowed; delsp=yes Juan Agustin Niccolini wrote: > An unprivileged user can get a UDP socket bound to an address and port > that another user's socket holds, in a state bind() would have refused, > and receive that socket's datagrams. This series fixes three bugs that > allow that and adds a selftest. > These are sibling vulnerabilities of the TCP one fixed by my > commit f675070191f2 ("tcp: Fix the SO_REUSEPORT bind cache admitting a > conflicting socket"). The one in patch 1 has the same kind of cause: a > SO_REUSEPORT shortcut that lets one matching socket stand for every > socket on the port. The other two predate git. All were discovered > during an LLM-based audit. > Juan Agustin Niccolini (4): > udp: Fix bind conflict check stopping at the first reuseport socket > udp: Keep the bound device on disconnect unless connect() set it > udp: Ignore a connect()-set device in the bind conflict check > selftests: net: Add UDP bind conflict tests No need to fix the pre-existing issues (connect() address narrowing, L2TP/IPv6, VRF conflict checks, or the residual ABA window), indeed. But please respin v2 onto net for the following: 1. Drop Patch 1 and rebase Patches 2-4 onto net: commit d77700039d09 ("udp: only quit inuse scan early on identical SO_REUSEPORT sockets") already landed in net with the same fix. Please keep the reuseport_* selftests in Patch 4 (with an updated commit message). 2. Patch 2: fix the new unlocked sk->sk_userlocks RMW race in __udp_disconnect() for ping/raw/L2TP that Sashiko flagged (which is a regression since __udp_disconnect() previously never wrote sk_userlocks). 3. Patch 2: address Sashiko's note on the VRF disconnect behavior change (at minimum move it from the "---" notes into the commit message, or preserve/restore the pre-connect ifindex). 4. Patch 3 (while rebasing): drop the redundant udp_bound_dev_if() calls. -- details - For (3), see also the parallel patch saving the pre-connect ifindex: https://lore.kernel.org/r/20261124180603.72523-1-dmnk@google.com - For (4), sk is being bound under lock_sock(sk), so read sk->sk_bound_dev_if directly, and load udp_bound_dev_if(sk2) once per candidate and pass it to udp_sk_reuseport_match(). -- pw-bot: cr