From nobody Sat Jul 25 15:25:32 2026 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8CDC36EAAB for ; Thu, 16 Jul 2026 20:35:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784234109; cv=none; b=l362n41A4DKuBJkKilh3bp75jOImmW5jnBfRTgJaJUt4OwTGOmEX0KloWJXXx3aV1Kls5T6eOs+DoLJAWHZ7iDxUB7Zza0+KGaL5TTZGtZyYzJc+su89bJCJ+8HHnUGinQkZIqXlSzy4gPWq8VnysH2LNWHEz5ctSY2GFMHNAq4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784234109; c=relaxed/simple; bh=Q/XwJn3N7sbVhwP2i8d4DE4nh1H7M9Rkrz42kIVBVIc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C8nwkgVnhervk2zOzPQIZzHbo1UkGgnQJczJ6Wn60LV7UqdFc4GvyNxL0zrG1eKUcYOIyxFR3bChRLrYE20oIikCPPrHu9vGdY6riwOFz/i23AeCaN+p+z2soAE6UIGgl7RbHdVNpe56RK1xsqVDAj7pXRXWbUdc+eKM3pjffLk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=0sec.ai; spf=pass smtp.mailfrom=0sec.ai; dkim=temperror (0-bit key) header.d=0sec.ai header.i=@0sec.ai header.b=jD6/UkwW; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=0sec.ai Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=0sec.ai Authentication-Results: smtp.subspace.kernel.org; dkim=temperror (0-bit key) header.d=0sec.ai header.i=@0sec.ai header.b="jD6/UkwW" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-49547fc63a0so1148315e9.2 for ; Thu, 16 Jul 2026 13:35:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=0sec.ai; s=google; t=1784234106; x=1784838906; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=4QQAjFNHULURUxSmt1j/8JCkMYnUwWWzf2sKXPLOVu8=; b=jD6/UkwWShmjem3JZtOPdbsInHPv5UIkYyG1zh9K/ZdbVd8kLLQVzTAl/YbJEEHaX3 t3SjWBQx1JOsja/oD9C8smf7PN/FgdDGVyDAX9Mq+xKcIJ+VC4ZFCwb0dTyP1qjk7EuP Oop7gU4ySNq94CT28y9+9/X/YSZ9HiNGqIHpOHjRYd62uYa2SwnhvRCf+Kn/czsBpEvi euG64O22kcMo0KsrmBJHS1SdEjqaYCEBkjFmW1pSiVSsxmhjutEq19xzQ/d0l2IcbkBo kCSh2YHiQKNnguiS4lOpyfqhiiUwVgV8wpPyflQJaQxkVbxM0yXXAIe4cCAB9ZbubQed J0tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784234106; x=1784838906; h=content-transfer-encoding:mime-version:references:in-reply-to :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=4QQAjFNHULURUxSmt1j/8JCkMYnUwWWzf2sKXPLOVu8=; b=H+R2zQX6QTvx9bKuBl12hqwP4Iiq34S+wAjtvBisJXDrztq7G7Dvs/LJPr5qLZipCB aVUHLPlJcZL0e4DCEUtAUqH6zevm3UXwyeTBMng9ASAjsKHi0hm7pvrSbzaYmsLHvkj4 CGFHNREmuYlvK1DnxWW+D4wxvED9vActD2W49b2hiZHTlKv/CpeBgyn9vzkC8RCZP3Os FbCy9sPgF1tNAREBeKa+Ii2vh+wR3aEqtWMuYlt+LQETkpG8uEwu17ma7LG1TibcNH3G jHychWOV18G9nBrYAxU3Y0kqMGjY011I6jty4qzJ42XvIVcUpYp4yPNxRaUeYWDpxo+0 a3Sw== X-Forwarded-Encrypted: i=1; AHgh+RrURUY//eYVDzvqqjGuMiGjz08UQqZxWRxd8uAWwGvGlIONg+099um8ryUDXfSnYKoCwQ2JX/2jjCs6lKs=@vger.kernel.org X-Gm-Message-State: AOJu0Yy2rp/c0N4Iz4gbBnPm5/gIj7DyY0MVLaWxaGQxd2JjXhwIOOOR RTCbl+j/y+TqcLe2ow6a+kumv5RYB1zY65DIbvREffl4+qTnMFWarKrMDhj843YZI/cs X-Gm-Gg: AfdE7ckjNLg2DADUj2uBknKxJu/xuYIsLEiNG885R/26oQfcFcJK/Z8AlgOPjitoMEW wZQu/riFH6hvnEVbNpU8EdP6CJav33Ny+YeF2fmhwW/uXorhVwjKJwaJS9twiVCbSsf3yerymtq tmErXeyFgFGK3kiavipTCvlQm7dN5P8p2YAcdY1b5S2xdGqYYzV6+41MzcZ5oMJJ7vXVvcSvyI9 rCIAdhDzOZayMZaRnIO9OSZovQC9qH54/HWegr3hU+h/k+WhLFX2Sr+tEqzoDVJdWwa6jSv1Gqr 9kuphGiJuQKb98oqaP4bnmC7NsPk1v8l8eG5iKjlT1z8y4DYIHMPnk7w2aPKQUjmVMMVolu5Vdr GAoS8Xd4UhYoUG+iiiP6vUhCSGVzm2KJyLLnVqoIWfo2sEIZKwOUSL3LIGlKZw2tJYj8RY2QoOt H/5ckhPMlqqCNqQ0MdufhBl+X/wLTMmBfQImPYx++MTupSOJk4AxkSssrwPUD4gcpEfnFdZG4rz iZzhBYLe4xOi9d4X9v4XEgN X-Received: by 2002:a05:600c:8b6d:b0:495:3fc4:81b4 with SMTP id 5b1f17b1804b1-495403fcaadmr67069805e9.30.1784234105873; Thu, 16 Jul 2026 13:35:05 -0700 (PDT) Received: from PeakBook-Mini.tail8e484.ts.net ([178.197.218.188]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49548e075d4sm4602835e9.1.2026.07.16.13.35.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 16 Jul 2026 13:35:04 -0700 (PDT) From: Doruk Tan Ozturk To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch Cc: fmancera@suse.de, sd@queasysnail.net, linville@tuxdriver.com, mschiffer@universe-factory.net, maoyixie.tju@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH net v2 1/2] vxlan: require CAP_NET_ADMIN in the device netns for changelink Date: Thu, 16 Jul 2026 22:34:59 +0200 Message-ID: <20260716203500.70573-2-doruk@0sec.ai> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260716203500.70573-1-doruk@0sec.ai> References: <20260716203500.70573-1-doruk@0sec.ai> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A tunnel changelink() operates on at most two netns, dev_net(dev) and the sticky underlay netns vxlan->net. They differ once the device is created in or moved to a netns other than the one the request runs in. The rtnl changelink path checks CAP_NET_ADMIN only against dev_net(dev), so a caller privileged there but not in vxlan->net can rewrite a vxlan device whose underlay lives in vxlan->net. vxlan_changelink() validates and applies the new configuration against vxlan->net (vxlan_config_validate(vxlan->net, ...)) and can reopen the underlay socket in that netns, so the same reasoning as the tunnel changelink series applies here. Gate vxlan_changelink() with rtnl_dev_link_net_capable(), at the top of the op before any attribute is parsed, matching ipgre_changelink() and the rest of the "require CAP_NET_ADMIN in the device netns for changelink" series. Found by 0sec automated security-research tooling (https://0sec.ai). Fixes: 8bcdc4f3a20b ("vxlan: add changelink support") Cc: stable@vger.kernel.org Assisted-by: 0sec:multi-model Signed-off-by: Doruk Tan Ozturk Reviewed-by: Fernando Fernandez Mancera --- v2: correct the Fixes: tag to the commit that added changelink (Fernando Ma= ncera). drivers/net/vxlan/vxlan_core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c index 67c367cc5662..d834a4865aec 100644 --- a/drivers/net/vxlan/vxlan_core.c +++ b/drivers/net/vxlan/vxlan_core.c @@ -4421,6 +4421,9 @@ static int vxlan_changelink(struct net_device *dev, s= truct nlattr *tb[], struct vxlan_rdst *dst; int err; =20 + if (!rtnl_dev_link_net_capable(dev, vxlan->net)) + return -EPERM; + dst =3D &vxlan->default_dst; err =3D vxlan_nl2conf(tb, data, dev, &conf, true, extack); if (err) --=20 2.43.0 From nobody Sat Jul 25 15:25:32 2026 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35F79379998 for ; Thu, 16 Jul 2026 20:35:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784234110; cv=none; b=B/v+uBYjfs5NWqC2SfemKFvvd+SCd3giewbEVJSpmqVJWw8K4YaeFIJbUS+baxBsSlxD2tKR8KfeV+JdhflKQmmVqLM2wB6PPDkvd9QLCkO48Aoh0I2HKy8aGiQ5YaLy1Z4isAzhTBPy8MztdzOy/oEWMgYhQ7H+2VVcKehYtuY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784234110; c=relaxed/simple; bh=/yKBv8dM3IO/k8ppxNy++w7jpfealC+yafsqdCvv8Pc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pOrfkDT7IHy0t0gRfr+fsFVVbqIaRac+7WqNDE+sRb6nesB/bpnze2a6lUZg9meVaTcSfyvMBwc2ScVVgxz3b0rsWseAfsnUcoS7qyUubDLLMxeFx4Dx9P3pmUYYbWRx2kdlYxYtqR2P9n91CsFyM83VFHUideCMGzMOi6vvsto= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=0sec.ai; spf=pass smtp.mailfrom=0sec.ai; dkim=temperror (0-bit key) header.d=0sec.ai header.i=@0sec.ai header.b=Y7SjOtZT; arc=none smtp.client-ip=209.85.221.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=0sec.ai Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=0sec.ai Authentication-Results: smtp.subspace.kernel.org; dkim=temperror (0-bit key) header.d=0sec.ai header.i=@0sec.ai header.b="Y7SjOtZT" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-47df440fcd5so3888031f8f.3 for ; Thu, 16 Jul 2026 13:35:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=0sec.ai; s=google; t=1784234107; x=1784838907; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Gt+XqollboNjdwVY0zqegEHGGajybfgvTuk+LVVaP6M=; b=Y7SjOtZT9Dq1E+vZy2p5bwNaf/aI5KaLxDKVxkPjDzDQrwsbGq/32QOpOKgWRMrAgm W8XLJia6RM3u04PibTaHvjmDo9/XbB9CpWx4LZf+QLE2rbYKHOdMufEl4DIlxZeaqKgw +yVvvtj+4MCzPZnfFfeW/A39OSPHHB8Mkgbfr31x88UU3DlIyNOfv7Pn/2Uxy2IxecNT R4c8TJmXOU6Y7wrpRrg67zgY7x6r3d+46qZIiT/fNtaI+6mdtlLUilC/OWlYgiq4uwQW 1T5DNnhVtKE6dJAZAUBH7qJjG3GAtM8UhAjNDmiN/v/vRBGnqKDMG5gt4+jpjgS93z1m jWCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784234107; x=1784838907; h=content-transfer-encoding:mime-version:references:in-reply-to :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=Gt+XqollboNjdwVY0zqegEHGGajybfgvTuk+LVVaP6M=; b=slspXHIYVawJni0fi1AmAzzT9LIUWFgRt91iE9r3z07p5/ZJLpAq6RNKQAblO30XqU N/5ECC936VJZgJ2wUM52Q8sLnNRT2j4VuAmsbuw/2j9kOcA2UbOuFjMgLknY6oIqf/4t 8KL7Tf8YlEwO89ZvmkTe0iQWs7JkzUiafhOHK59F2DIbLRUASK/jI8XZ2/F2my4RAdLY xGPJL3zXNGffR/spKdNk5zEEANezKd94TTjP7+47Om4j8Eg47zxq2F7+sCS2yLWi5mFV TCADf5sqosmCupLkFjzSD2CtSk1LBXnng6ev4O/jfgacHyosQTFbYWiPC7BSNz4TEybr Kd/g== X-Forwarded-Encrypted: i=1; AHgh+Rp2/yiMpjA3zmWKPjiz/mFYJuVLt6udCGMTVx9pT30TUBQrACpb+GB7JqgBGhmyLsP3LaijcUjiEyFyYlc=@vger.kernel.org X-Gm-Message-State: AOJu0YzB420EPeMlVtlJG7jL3bHTkza1KNV1ab5TFHiokDUe2jU9p9sd Gl4OiCZamCZ70kJsDLJ9BuEAXn69sZG5o13ttWGan1Etl0GQQJqXbVGgNUCTXt9+sFB3 X-Gm-Gg: AfdE7clk47ksjxF1d1hnyjppjRy6/nkQG+aVYpy2/kpZFZ/jfWkG1CPboV7n3Cose7r RYKaGUxkaT1aa0wSh9bNglGdiBqG+K0GFu5dt9Ad8cFbnApFEYEJNMp76Bl2STcuLJBqP4HCtUB L+ase1rSsFHzJkXRLcbgb3GLjry8MTKeu9c2Yt7W3gqbK3qX8qxwUSPvTLtz+8am26gm0sJikY/ NMU4V2CGwIaUePLczcItwAjh4ccV4BQT8q08la1hlr3aLO+rY6MZYY3gpaJS18uz2igepvn+Ohx r0rwceYtfoitVTAtEAlocWWRxnULZ4xygOPG2h6q5Sxnx4/0RDBYiHPVsjsn9d4uYf5DxyWCZ48 QVDg+ORCzyW4cHuNuqNgLhu9Ccx/OVOUp2f1nD66TgXXHQu2BOUExHpRlIMCaFCVRO1typhnn+j asQ4QN3iDWWdhbD/C2XYX0VLuEVN/55yEkQJtPouPXNHCk+MYJkSY/QOywf+Jw9lCDxmaiet82H PDw7rM/vgsb/6DrAe33wK9TrtKBreHLUXI= X-Received: by 2002:a05:600c:a47:b0:495:39aa:1359 with SMTP id 5b1f17b1804b1-4953c143b28mr95999535e9.3.1784234107463; Thu, 16 Jul 2026 13:35:07 -0700 (PDT) Received: from PeakBook-Mini.tail8e484.ts.net ([178.197.218.188]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49548e075d4sm4602835e9.1.2026.07.16.13.35.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 16 Jul 2026 13:35:06 -0700 (PDT) From: Doruk Tan Ozturk To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch Cc: fmancera@suse.de, sd@queasysnail.net, linville@tuxdriver.com, mschiffer@universe-factory.net, maoyixie.tju@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH net v2 2/2] geneve: require CAP_NET_ADMIN in the device netns for changelink Date: Thu, 16 Jul 2026 22:35:00 +0200 Message-ID: <20260716203500.70573-3-doruk@0sec.ai> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260716203500.70573-1-doruk@0sec.ai> References: <20260716203500.70573-1-doruk@0sec.ai> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A tunnel changelink() operates on at most two netns, dev_net(dev) and the sticky underlay netns geneve->net. They differ once the device is created in or moved to a netns other than the one the request runs in. The rtnl changelink path checks CAP_NET_ADMIN only against dev_net(dev), so a caller privileged there but not in geneve->net can rewrite a geneve device whose underlay lives in geneve->net. geneve_changelink() applies the new configuration against geneve->net: geneve_link_config() and the geneve_quiesce()/geneve_unquiesce() pair reopen the underlay sockets in that netns (geneve_sock_add() uses geneve->net), so the same reasoning as the tunnel changelink series applies here. Gate geneve_changelink() with rtnl_dev_link_net_capable(), at the top of the op before any attribute is parsed, matching ipgre_changelink() and the rest of the "require CAP_NET_ADMIN in the device netns for changelink" series. Found by 0sec automated security-research tooling (https://0sec.ai). Fixes: 5b861f6baa3a ("geneve: add rtnl changelink support") Cc: stable@vger.kernel.org Assisted-by: 0sec:multi-model Signed-off-by: Doruk Tan Ozturk Reviewed-by: Fernando Fernandez Mancera --- v2: correct the Fixes: tag to the commit that added changelink (Fernando Ma= ncera). drivers/net/geneve.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index 396e1a113cd4..03c99a016298 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -2376,6 +2376,9 @@ static int geneve_changelink(struct net_device *dev, = struct nlattr *tb[], struct geneve_config cfg; int err; =20 + if (!rtnl_dev_link_net_capable(dev, geneve->net)) + return -EPERM; + /* If the geneve device is configured for metadata (or externally * controlled, for example, OVS), then nothing can be changed. */ --=20 2.43.0