From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796214614; b=LPiDgLiBF1+UkAKol1cnb4gOuVBlOsrUR53Lk7BxeYOsUpZNCpiz62+Fzr+yc9haOVdf r23zzMSr1QxY11vYCFJvdi1BMhAY1KhqmEaOzpEKIrgOwicJxovgycretO6F4LF69tiSG fQGumDgpHFD/2Cr/BQp5tPI3bdaFYIbGaffEAavzACUKhE5FQ76DZp1aGOAnyq5mV9PRP VwZjgCYc70iJgpBkhnWdYAdOAFD2G/PTGcKH6+TSsGfXjLKN0lF9q1TAO4xfrVMOYwVrb jbwB5jaSeDtCK4X3zsIGZsOHg881m14GatYg4gBENWiXdFcqFZZvyEsLggjMxw/1Dgg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796214614; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:Message-ID: Date:MIME-Version:User-Agent:Subject:To:Cc:References: Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=sgWUoPcaA330np81yKxPZfUJ42EOKjXq9k+qoVJbC8Q=; b=trJTC8M7ewyrbn8m+L4BgSKI/LVdcmbOpqx2FDJlw7RjdveKdXcGtv1CTb2S3l/xuR9N c5VG8cpaWhUDSepyUPkM1ZTShbhinIFdirJUdNCnYLBtNGUSbenZC/CNXhzQocmcuaFJE e0/0b2BBMvjWtmiHTJnDySd32h8Vn48FD8fZruqzsi3x8HfOKyMEW4ZqPK/cK0kFYm9/s aGUZCjyRXmhKyJ8/xyNgZEBAMvx+Vo5E5+bYyIarF2lfkQdrBV7mrs/980jZyqC7NQnED q48Mqz1H9LzVqPW4yW/vYtaKWk/aFluJYvhbGf/oRZhod0JNjRZIecD516BhDeOPMqg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=FozrmHn6; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=google header.b=ZnpcEB8q; arc=none smtp.remote-ip=170.10.133.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 385C1606A327 for ; Wed, 2 Dec 2026 12:30:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 385C1606A327 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=FozrmHn6; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=google header.b=ZnpcEB8q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796214614; 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=sgWUoPcaA330np81yKxPZfUJ42EOKjXq9k+qoVJbC8Q=; b=FozrmHn6CfdCKzJJcxWpqeivUEZwTsSg+vHlgXqsae+7kFKO6b9v25bf4W2oVt0ebPwYEF Fm4v5VNxkUPhWhfa5KD7h+rnPw6kggj5auMlXJp7HqqkvepNWVfZS0DT1wdTkap5ZVZP7R oYaLftK5CF/DC1dd4InN4Trdf13PSSo= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-136-i7EgkLwzMTShUkU1HN-XCA-1; Wed, 2 Dec 2026 12:30:11 +0000 X-MC-Unique: i7EgkLwzMTShUkU1HN-XCA-1 X-Mimecast-MFC-AGG-ID: i7EgkLwzMTShUkU1HN-XCA_1796214610 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4bb67b2c00cso73152605e9.1 for ; Wed, 02 Dec 2026 04:30:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1796214610; x=1796819410; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=sgWUoPcaA330np81yKxPZfUJ42EOKjXq9k+qoVJbC8Q=; b=ZnpcEB8qzbQruAEGSW5ggHh4/5NZEfm/wGpdSVcoIbB4/7DKP7fi5TwFPtdusPRB0U TWH8m0DGdB0poXrm5I71hqF8uJi40iZoYJEGGV2WMDW501QaUbFzgLYlJRO1w8MxRBQY I7okwNJp5G+F+uul4hoFj08PFTmt7JJCT6ft/jQoLld90Ku48j+k4RchKKsDdWujWqji ti189jqAg3WdvxCVn0ZSu0IjUKapjwfCiZ0aTdlsxq81HbeQPojcSVoYzcFPKK8DyzW1 ygRpfg/3qY1YDmBy93xstbkL7XDVQa6TAD0X0VdqML+v8O3y76YyoEVzJcjjYtWq4wqM pBfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796214610; x=1796819410; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=sgWUoPcaA330np81yKxPZfUJ42EOKjXq9k+qoVJbC8Q=; b=WP7vqjp5Shl0wWJIjz1RP497cn9ih3/t4Mnou15lLH34EtPEgKdWWnm4jfIojJk2S7 QTBo1WoQi3Tqv89NMJc+JslxLYhEOwbp9CK7sf70m8OsC7ARJJPON+uAth0D6lqiNFub UZVwPMeM2ZxXX07NwSE7vDDpMhfZyk0l6lc/HdO/kW4yo07zUXK32jp3e2IKg6mEnHbD iQWXoK1UBhpCZudIOhb9HOMxDV4nHNshngZ4/NBfsHTamAg9HdRLEb6zOwvclMxt39/G sDz7lasIyyUVicRVma25ZZB+siTtySzgH35C8d8gggl1GbYZXq/ykU2baNMk5zewA4md mbiw== X-Gm-Message-State: APuU4Z/YAl2bAEAdg1dPhOfI1zcfEv1lr+wCkdxCAu8xBF08bDh0DleJ j/lMm0Zmk7fkeaur5UeZbQd4mcpuqMP9/eJiHTeO8BCPhbldrcjVL4hhUprJSMByILyv6hfQmjO UBebmDFdAiq61feHUc1GntVNAamZKNAKuncFNG3QZA5SAxRWLUC+fwo9RKg== X-Gm-Gg: AZFdTZetYyftO1xDLGOtPC2yo5qCdqJclwrSP+uac1QVmLqZBnyyoD4LRazEakTJrJP 5nsPKdiJsQq45WwM2t690D++N32kS4IxtSAn4HFHLv/D0RzG3l/bxwjrhHg+aAdXzQoez9iH+ce mKpod0O/QBORWZHGlvXoRFo1BddriHKTnM1X+fpbBeK1Rx0Id2WDcURR7fw0ox3kPc3w+Zi+iCy qbhq2m1y7XkUXKZcBVgAWWM2yXJGuFYg6whcPbtO8+vIrNpFLQbMmmYGtOvrE68scbV6bFOAzJP mbzZiforSaugFAAzajpLTNc0hI6g0lVAQ5tmi9C0/oHBNVl6ZoJIoHuScedDuM6h8SDy0mJ6nsI O1U00vkKDfsLYYuPZg/0S5/1Sd5rBDx9v2UfzEBAE803xtRAHeZoyZxjY7vIqJ7ryA1m2elmFzz KrDQGhxNwpdumFkyPrZ34pM5DrMtIMGOLHKv8haJBwnGc= X-Received: by 2002:a05:600c:b8a:b0:4a0:20b4:ba93 with SMTP id 5b1f17b1804b1-4bb88818156mr791224375e9.16.1796214610329; Wed, 02 Dec 2026 04:30:10 -0800 (PST) X-Received: by 2002:a05:600c:b8a:b0:4a0:20b4:ba93 with SMTP id 5b1f17b1804b1-4bb88818156mr791223475e9.16.1796214609761; Wed, 02 Dec 2026 04:30:09 -0800 (PST) Received: from [192.168.88.30] (ip231-128-192-82.pool-bba.aruba.it. [82.192.128.231]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb884b8429sm1724853695e9.14.2026.12.02.04.30.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Dec 2026 04:30:09 -0800 (PST) Message-ID: Date: Wed, 2 Dec 2026 13:30:08 +0100 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net v2] sctp: diag: fix stack garbage in IPv6 scope_id during dump_one lookup To: Xin Long , netdev-bot+sashiko@kernel.org Cc: netdev@vger.kernel.org, linux-sctp@vger.kernel.org, davem@davemloft.net, kuba@kernel.org, edumazet@kernel.org, horms@kernel.org, marcelo.leitner@gmail.com References: <7cc69548f249ff63527a663c22d9dc918d3c3e84.1795621751.git.lucien.xin@gmail.com> <179570816138.3135.14968815049241245107@kernel.org> Content-Language: en-US From: Paolo Abeni In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 11/26/26 21:27, Xin Long wrote: > On Thu, Nov 26, 2026 at 10:49 AM wrote: >> >> Thank you for your contribution! Sashiko AI review found 1 potential >> issue(s) to consider. >> >> Critical: 0 · High: 0 · Medium: 1 · Low: 0 >> >> If you believe none of the issues are legitimate, please reply to each >> issue of Medium severity or higher and explain why the AI is wrong. >> If any of them are legitimate and you plan to respin, please let patchwork >> know by including "pw-bot: cr" as a separate line at the end of your reply >> (one such reply per series is enough). >> >> - [Medium] The commit message justifies the wildcard scope_id with: "The >> dif check in sctp_addrs_lookup_transport() already filters by… >> >> -- >> >> sctp: diag: fix stack garbage in IPv6 scope_id during dump_one lookup >> >> This commit zero-initializes the laddr and paddr lookup addresses in >> sctp_diag_dump_one(). As a result, sin6_scope_id and sin6_flowinfo no >> longer hold stack garbage. A zero sin6_scope_id then acts as a wildcard in >> __sctp_v6_cmp_addr(), and idiag_if is used only as a dif filter. >> >>> diff --git a/net/sctp/diag.c b/net/sctp/diag.c >>> index c2a0de2adf6fd..564a5b51e6ce3 100644 >>> --- a/net/sctp/diag.c >>> +++ b/net/sctp/diag.c >>> @@ -433,7 +433,7 @@ static int sctp_diag_dump_one(struct netlink_callback *cb, >>> struct sk_buff *skb = cb->skb; >>> struct net *net = sock_net(skb->sk); >>> const struct nlmsghdr *nlh = cb->nlh; >>> - union sctp_addr laddr, paddr; >>> + union sctp_addr laddr = {}, paddr = {}; >>> int dif = req->id.idiag_if; >> >> [Severity: Medium] >> >> The commit message says: >> >> The dif check in sctp_addrs_lookup_transport() already filters by >> sk_bound_dev_if, so scope_id on the lookup addresses is unnecessary. >> >> Does this hold for SCTP the way it does for TCP and UDP? >> >> For TCP, connect() to a link-local peer binds the socket to the scope >> interface, so a dif filter on sk_bound_dev_if is enough. SCTP does not >> seem to set sk_bound_dev_if from the peer's scope. The scope is kept only >> in the transport address: >> >> net/sctp/ipv6.c:sctp_v6_get_dst() { >> ... >> if (ipv6_addr_type(&daddr->v6.sin6_addr) & IPV6_ADDR_LINKLOCAL) >> fl6->flowi6_oif = daddr->v6.sin6_scope_id; >> else if (asoc) >> fl6->flowi6_oif = asoc->base.sk->sk_bound_dev_if; >> ... >> } >> >> On the dump side, idiag_if also reports something other than >> sk_bound_dev_if: >> >> net/sctp/diag.c:inet_diag_msg_sctpasoc_fill() { >> ... >> r->id.idiag_if = dst ? dst->dev->ifindex : 0; >> ... >> } >> >> For a link-local peer, this is in effect the peer's scope interface. >> >> On the lookup side, the call chain >> sctp_transport_lookup_process()->sctp_addrs_lookup_transport() passes dif >> to sctp_sk_bound_dev_eq(). For an unbound socket (bound_dev_if == 0), >> inet_bound_dev_eq() returns !sdif || l3mdev_accept. That is true by >> default, so any dif passes. >> >> With sin6_scope_id now always 0, __sctp_v6_cmp_addr() matches link-local >> transports on every interface. sctp_hash_transport() treats two different >> non-zero scope_ids as distinct. So an unbound socket can hold associations >> to fe80::X%ethA and fe80::X%ethB on the same port at the same time. > This is very uncommon. > > I would rather NOT set sin6_scope_id from req->id.idiag_if to support this case. > > Even if we want to support it, it should go to a separate patch in the future. BTW please note that this kind of changes - broken from day1 long time in the past, with little impact, are net-next material at this point of the cycle. /P