🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by zhuorao yang Tue, 01 Dec 2026 12:26
[PATCH net] ipv6: reject permanent flag on temporary addresses
#25233
Author: zhuorao yang
Date: Tue, 01 Dec 2026 12:26
72 lines
13519 bytes
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 <alex000young@gmail.com>
---

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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads