From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.53 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796128044; b=x8xupv1v6odwAF8fNCFZ/JDatZWxv4en0I3xNK+8mXootX74gSmrjoTwE9e0hIuYRj94 RiLo8tQHhl69m9WFlCpN8C30aj1/KoD9Ns2Nu5kAVxwGS4dbrIc8EVPb7zjANX8YJwDZ8 vR4cOFZpjBsM76cjapN3sF9iwL91iTCdKOkU981ezbzdr3V2CNeSi+lw7KlaQ67VeiRP9 P8fAhi1I+Q+7mpN/kYSgA+vyXYck+1629DGzw8tBAC47y7/Vu7sCX0WBzoL30V3E+2Ebj 8IqWzgalFxZLFEPoAsdTr4e50j6EuqpU5ozYMu3Cp4Jtehw8+13VP2rCu3/BctAZAig== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796128044; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=/SsLQZtihWR9BDy/Kk+3aNqSQBYrfe3jDS0HomprRbU=; b=PvmQVFBJFXh0NbEmgC6mjYB5jllgVIf1xSGMkOFbX+nFRElDG6BLwhH3eCXXjFHjTOJ6 4SRc5t94DaYQR6eWPNCTKe76lnMNo+d285tGT8bzSqqIVDs/TFAPQ1BeCd4iiiaCTd7rF 45kcLvwUHg9HX6eJN15tms5/a0GqsJcLf+QHh/RXKzy768FhUjFnjhE15ZgVFQPcaZjRF 686OR4/kB75nI3U1ZSl9X9Ocx5cY6F72mECe8+Ryivu1afV6fgVVIQ1duq3nQXicXySM3 1oF/N5zqXtuK4/OSe+jKp/y/fhuXqmHyiPZs6GWru52n/DmXuoCRsPg3nEdrjspG8LQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=lDstODfl; arc=none smtp.remote-ip=209.85.216.53 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (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 1A6EA606A320 for ; Tue, 1 Dec 2026 12:27:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1A6EA606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=lDstODfl Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-3b3a42a4bcdso4755867a91.0 for ; Tue, 01 Dec 2026 04:27:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796128043; x=1796732843; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=/SsLQZtihWR9BDy/Kk+3aNqSQBYrfe3jDS0HomprRbU=; b=lDstODfl/I4X3qMJLCaS93X55kRSs98y6FRskv67z/fpcbXEyZnlC6F8IhhZLPCfFP m+hZo7KJdeMLSkyVL2w3RnH5m+zKXYXsRda+GgbXZXFdHFQRYqRp9GWPsybGQwq4ismP 70hi2nv63Txvq3zgPgCS/6ZZaf9SEsaRReMd2ftJBpzVkvNpbVox0knJr+X8CQn3hN8P XZpAEExBmgSQijz6geH1u0WKkcqcp4DZ0f31lw2ROP20xTmRvURbAxPnXtxHBaqcOsn2 EEPv9amMNaIaXWPWWQizxl2e4KS/l8SR/yV7Amh5WifSoryJLS8xw/i/MGxsYFs9pD9t FOzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796128043; x=1796732843; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=/SsLQZtihWR9BDy/Kk+3aNqSQBYrfe3jDS0HomprRbU=; b=hmKJHbA1SoRNvrWWZNChNWWJXfh51O1UHkGpRc7YpzUw99fgNhxqGVJdJbvAN+z+Pu wgk0DF2XFQowagB/V5qKNDO/JtKdcGFO18Kll1frnAlA/YNmhAmFr4Zi/hhfWAmU0lBI ZHEqJcoBdfes7OAZleGb6EZtSktygFfltafPMQdgc76ISmz4TX/C956S8teIJEm7Bw+4 J5fsEA34ZSOTEMQ52jhKBOb+ftMYD4o4xjRe9CDkBWV3yIElQvEQPtHIZ7lCYbOB9K7l gE8YfEQHp8xJ38bgipqqnh4UpWCiKE/5dKaR4dJ2vJ8PlSB9B8CcG9hqiHyoIyP8XwGB ozAA== X-Gm-Message-State: APuU4Z/VRp/RVF/8LkmiLonHGMPk7BX5Um6QHr5K27dk5pSuOuzB12Em c57WgBHHoFbzy8WAypu0aJTp3w8xUWlSMmvL1zLVtMW0Oh3sL2NDrXWHF4vcQEVxV2I= X-Gm-Gg: AZFdTZfGhEOICKbvpeHXR1NpeljO1u3zOW4nPbEJDCGYsCQ8nt+iuU5CmaP5Gp32qmZ ufd64a6m09OM4M/NjBGr7nXykoqnKmlLSf4QSn8+E6yLvD0ST7aFpKYFKaz4lfcrc/AiLNtOxzz GVicN0FE6+9UUvS0dNZS3MMOuily4DBnUuo9ebdXDeTEs/3xEpjDGVkZ8sXI6kQUVdXVgi2nG5b 3DDCqBIv8SyF52LKSaUhM6VXF+ZRff3uFWqS4Mvg7XRlJv2Gm3Jh96hYVzZogwkj6T+ANTtgLMR opuf0n1XjEb56jgaDBSiiyVQaNFwceKE3SvbvO1+BsSbbiouVOKRvuly/N+EQCbMZJp8x39ygsn z5E7mhrIcGCSUA7/KW2p2zEtnEkcRoRh/t13UWrC6DULkqe4VmBsVxGY+id+weEl+3rVH1dPT6Q v/7jnvt20H2JXNb+A2WJ+xAtEdQ8iJDvAA2lEvIc5xo9ACqqEIqV85nwPOEEZfqHu+0ntrE/X8R Ygn54A03FF51IthUT5S7e+b1Odzjf9X8zI9j2+ivOjyyq3zRr6OO5m8Jo+e9Zx+l35AGp27aB6B 2ofhB3ihlSVf6j/Voc6JSs/Fo5N7/Xaj7tMSXfcJTc6VrQ7F/Rs= X-Received: by 2002:a17:90b:1644:b0:3b0:ae41:2711 with SMTP id 98e67ed59e1d1-3b41c911824mr35927547a91.24.1796128042954; Tue, 01 Dec 2026 04:27:22 -0800 (PST) Received: from [127.0.0.1] ([43.132.141.21]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b40a878d50sm60556946a91.11.2026.12.01.04.27.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 04:27:22 -0800 (PST) From: zhuorao yang To: David Ahern , Ido Schimmel , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn Cc: netdev@vger.kernel.org Subject: [PATCH net] ipv6: reject permanent flag on temporary addresses Date: Tue, 1 Dec 2026 20:26:05 +0800 Message-ID: <20261201122605.8080-1-alex000young@gmail.com> X-Mailer: git-send-email 2.56.0 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 Content-Transfer-Encoding: 8bit RTM_NEWADDR always adds IFA_F_PERMANENT to cfg->ifa_flags. inet6_addr_modify() clears the permanent bit on the existing address, then ORs the requested flags back, but leaves IFA_F_TEMPORARY set. This can create a temporary address with permanent semantics. If keep_addr_on_down is enabled, addrconf_ifdown() first removes the address from tempaddr_list and then preserves it because it is marked permanent. A later RTM_DELADDR calls ipv6_del_addr(), which deletes the already poisoned tmp_list node and crashes the kernel. Reject attempts to change a temporary address to permanent semantics. Temporary addresses are managed through their public prefix. Fixes: f1705ec197e7 ("net: ipv6: Make address flushing on ifdown optional") Signed-off-by: zhuorao yang --- Vulnerability report Affected versions: Linux v4.6 and later with CONFIG_IPV6 and keep_addr_on_down support; reproduced on Linux 7.4-rc5. Trigger conditions: Attacker has CAP_NET_ADMIN in the target netns (obtainable in an unprivileged user namespace); device type allows temporary addresses (e.g. veth/dummy); net.ipv6.conf.*.use_tempaddr>=1 and keep_addr_on_down=1 set. Steps: add a /64 public address with IFA_F_MANAGETEMPADDR (or via RA) creating an IFA_F_TEMPORARY address on idev->tempaddr_list; send RTM_NEWADDR with NLM_F_REPLACE and no IFA_CACHEINFO, which unconditionally sets IFA_F_PERMANENT (addrconf.c:5054) and inet6_addr_modify (addrconf.c:4942-4945) does not reject TEMPORARY, yielding IFA_F_TEMPORARY|IFA_F_PERMANENT with INFINITY lifetime; bring the device down triggering addrconf_ifdown(dev,false), which removes the address from tempaddr_list (addrconf.c:3978-3992) but the keep check (addrconf.c:4008-4009) returns true for PERMANENT non-link-local, retaining the address with state PREDAD (addrconf.c:4013-4021); then send RTM_DELADDR (or any path invoking ipv6_del_addr()) causing ipv6_del_addr at addrconf.c:1343-1344 to list_del the already-removed tmp_list again. Reproducer status: Same-version Linux 7.4-rc5 KASAN QEMU: RTM_NEWADDR replace created a temporary address with permanent semantics; ifdown retained a poisoned tmp_list address and RTM_DELADDR caused an ipv6_del_addr LIST_POISON fault and kernel panic. With this patch, replace returned EINVAL, the temporary address retained finite lifetimes, ifdown removed it, and the kernel powered down without KASAN or panic. Reproducer material is intentionally withheld from this public message. AI assistance: DeepSeek identified the issue and drafted the patch. The submitter reviewed the code and certified the Developer Certificate of Origin. net/ipv6/addrconf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index d9d13e78bf13..0942bffbae97 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -4921,6 +4921,10 @@ static int inet6_addr_modify(struct net *net, struct inet6_ifaddr *ifp, ASSERT_RTNL_NET(net); + if ((ifp->flags & IFA_F_TEMPORARY) && + (cfg->ifa_flags & IFA_F_PERMANENT)) + return -EINVAL; + if (cfg->ifa_flags & IFA_F_MANAGETEMPADDR && (ifp->flags & IFA_F_TEMPORARY || ifp->prefix_len != 64)) return -EINVAL; -- 2.56.0