]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
vsock: prevent child netns mode switch from local to global
authorStefano Garzarella <sgarzare@redhat.com>
Thu, 12 Feb 2026 20:59:16 +0000 (21:59 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 13 Feb 2026 20:28:38 +0000 (12:28 -0800)
commit6a997f38bdf822d4c5cc10b445ff1cb26872580a
tree6a32a60dd65bd2bda4e58c905049b6f3f88dfc2b
parent9dd391493a727464e9a03cfff9356c8e10b8da0b
vsock: prevent child netns mode switch from local to global

A "local" namespace can change its `child_ns_mode` sysctl to "global",
allowing nested namespaces to access global CIDs. This can be exploited
by an unprivileged user who gained CAP_NET_ADMIN through a user
namespace.

Prevent this by rejecting writes that attempt to set `child_ns_mode` to
"global" when the current namespace's mode is "local".

Fixes: eafb64f40ca4 ("vsock: add netns to vsock core")
Cc: bobbyeshleman@meta.com
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Bobby Eshleman <bobbyeshleman@meta.com>
Link: https://patch.msgid.link/20260212205916.97533-3-sgarzare@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/vmw_vsock/af_vsock.c