* [Devel] [PATCH hci-8.2 0/2] ms/ipc: backport mqueue mount leak fix
@ 2026-11-19 1:52 Eva Kurchatova
2026-11-19 1:52 ` [Devel] [PATCH hci-8.2 1/2] ms/ipc: create_ipc_ns: drop mqueue mount on sysctl setup failure Eva Kurchatova
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Eva Kurchatova @ 2026-11-19 1:52 UTC (permalink / raw)
To: vladimir.riabchun; +Cc: devel
Patchset for task https://virtuozzo.atlassian.net/browse/VSTOR-155528
Christian Brauner (1):
ms/ipc: drop the mqueue mount with kern_unmount() on setup failure
Vlad Kulikov (1):
ms/ipc: create_ipc_ns: drop mqueue mount on sysctl setup failure
ipc/namespace.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
--
2.56.1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Devel] [PATCH hci-8.2 1/2] ms/ipc: create_ipc_ns: drop mqueue mount on sysctl setup failure
2026-11-19 1:52 [Devel] [PATCH hci-8.2 0/2] ms/ipc: backport mqueue mount leak fix Eva Kurchatova
@ 2026-11-19 1:52 ` Eva Kurchatova
2026-11-19 2:00 ` no-reply
2026-11-19 17:06 ` Konstantin Khorenko
2026-11-19 1:52 ` [Devel] [PATCH hci-8.2 2/2] ms/ipc: drop the mqueue mount with kern_unmount() on " Eva Kurchatova
` (2 subsequent siblings)
3 siblings, 2 replies; 9+ messages in thread
From: Eva Kurchatova @ 2026-11-19 1:52 UTC (permalink / raw)
To: vladimir.riabchun; +Cc: devel
From: Vlad Kulikov <vlad.kulikov.c@gmail.com>
If setup_mq_sysctls(ns) fails after mq_init_ns(ns) succeeds, the error
path skipped releasing the internal kernel mqueue mount kept in
ns->mq_mnt. That leaves the vfsmount/superblock referenced until final
namespace teardown, i.e. a resource leak on this rare failure edge.
Unwind it by calling mntput(ns->mq_mnt) before dropping user_ns and
freeing the IPC namespace. This mirrors the normal ordering used in
free_ipc_ns().
Link: https://lkml.kernel.org/r/20251021181341.670297-1-vlad_kulikov_c@pm.me
Signed-off-by: Vlad Kulikov <vlad_kulikov_c@pm.me>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Aleksa Sarai <cyphar@cyphar.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: Ma Wupeng <mawupeng1@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 7229d74e5e8c1f140529d405c88d4493e37ce4e3)
https://virtuozzo.atlassian.net/browse/VSTOR-155528
Feature: fix ms/ipc
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
ipc/namespace.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/ipc/namespace.c b/ipc/namespace.c
index 4df91ceeeafe..b93280de1dc5 100644
--- a/ipc/namespace.c
+++ b/ipc/namespace.c
@@ -76,10 +76,10 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns,
err = -ENOMEM;
if (!setup_mq_sysctls(ns))
- goto fail_put;
+ goto fail_mq_mount;
if (!setup_ipc_sysctls(ns))
- goto fail_mq;
+ goto fail_mq_sysctls;
err = msg_init_ns(ns);
if (err)
@@ -92,9 +92,10 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns,
fail_ipc:
retire_ipc_sysctls(ns);
-fail_mq:
+fail_mq_sysctls:
retire_mq_sysctls(ns);
-
+fail_mq_mount:
+ mntput(ns->mq_mnt);
fail_put:
put_user_ns(ns->user_ns);
ns_free_inum(&ns->ns);
--
2.56.1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Devel] [PATCH hci-8.2 2/2] ms/ipc: drop the mqueue mount with kern_unmount() on setup failure
2026-11-19 1:52 [Devel] [PATCH hci-8.2 0/2] ms/ipc: backport mqueue mount leak fix Eva Kurchatova
2026-11-19 1:52 ` [Devel] [PATCH hci-8.2 1/2] ms/ipc: create_ipc_ns: drop mqueue mount on sysctl setup failure Eva Kurchatova
@ 2026-11-19 1:52 ` Eva Kurchatova
2026-11-19 1:58 ` no-reply
2026-11-19 17:06 ` Konstantin Khorenko
2026-11-19 17:06 ` [Devel] [PATCH hci-8.2 0/2] ms/ipc: backport mqueue mount leak fix Konstantin Khorenko
2026-11-19 17:06 ` Konstantin Khorenko
3 siblings, 2 replies; 9+ messages in thread
From: Eva Kurchatova @ 2026-11-19 1:52 UTC (permalink / raw)
To: vladimir.riabchun; +Cc: devel
From: Christian Brauner <brauner@kernel.org>
mq_init_ns() creates the mqueue mount with fc_mount_longterm(), so its
->mnt_ns is MNT_NS_INTERNAL. When setting up the mqueue or ipc sysctls
or msg_init_ns() fails afterwards, create_ipc_ns() drops it with a plain
mntput(). With ->mnt_ns set that takes the fast path of
mntput_no_expire(). The count drops to zero and nothing ever kills the
mount, so the mount and the mqueue superblock are leaked.
Commit dc55e35f9e81 ("ipc: Store mqueue sysctls in the ipc namespace")
added the first failure path after mq_init_ns() and never dropped the
mount. Commit 7229d74e5e8c ("ipc: create_ipc_ns: drop mqueue mount on
sysctl setup failure") tried to fix that with a mntput() but that
doesn't help for a long-term mount.
Use kern_unmount(). free_ipc() open-codes the same thing for a namespace
that made it.
Fixes: dc55e35f9e81 ("ipc: Store mqueue sysctls in the ipc namespace")
Fixes: 7229d74e5e8c ("ipc: create_ipc_ns: drop mqueue mount on sysctl setup failure")
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261009-work-fixes-rcu-v1-5-7446d2d335e6@kernel.org
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
(cherry picked from commit f0e48172a59e517e613b73f73cc35f24fd123aeb)
https://virtuozzo.atlassian.net/browse/VSTOR-155528
Feature: fix ms/ipc
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
ipc/namespace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ipc/namespace.c b/ipc/namespace.c
index b93280de1dc5..e703b2312791 100644
--- a/ipc/namespace.c
+++ b/ipc/namespace.c
@@ -95,7 +95,7 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns,
fail_mq_sysctls:
retire_mq_sysctls(ns);
fail_mq_mount:
- mntput(ns->mq_mnt);
+ kern_unmount(ns->mq_mnt);
fail_put:
put_user_ns(ns->user_ns);
ns_free_inum(&ns->ns);
--
2.56.1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Devel] [PATCH hci-8.2 2/2] ms/ipc: drop the mqueue mount with kern_unmount() on setup failure
2026-11-19 1:52 ` [Devel] [PATCH hci-8.2 2/2] ms/ipc: drop the mqueue mount with kern_unmount() on " Eva Kurchatova
@ 2026-11-19 1:58 ` no-reply
2026-11-19 17:06 ` Konstantin Khorenko
1 sibling, 0 replies; 9+ messages in thread
From: no-reply @ 2026-11-19 1:58 UTC (permalink / raw)
To: Eva Kurchatova, vladimir.riabchun; +Cc: devel
> From: Christian Brauner <brauner@kernel.org>
>
> mq_init_ns() creates the mqueue mount with fc_mount_longterm(), so its
> ->mnt_ns is MNT_NS_INTERNAL. When setting up the mqueue or ipc sysctls
> or msg_init_ns() fails afterwards, create_ipc_ns() drops it with a plain
> mntput(). With ->mnt_ns set that takes the fast path of
> mntput_no_expire(). The count drops to zero and nothing ever kills the
> mount, so the mount and the mqueue superblock are leaked.
>
> Commit dc55e35f9e81 ("ipc: Store mqueue sysctls in the ipc namespace")
> added the first failure path after mq_init_ns() and never dropped the
> mount. Commit 7229d74e5e8c ("ipc: create_ipc_ns: drop mqueue mount on
> sysctl setup failure") tried to fix that with a mntput() but that
> doesn't help for a long-term mount.
>
> Use kern_unmount(). free_ipc() open-codes the same thing for a namespace
> that made it.
>
> Fixes: dc55e35f9e81 ("ipc: Store mqueue sysctls in the ipc namespace")
> Fixes: 7229d74e5e8c ("ipc: create_ipc_ns: drop mqueue mount on sysctl setup failure")
> Cc: stable@vger.kernel.org
> Link: https://patch.msgid.link/20261009-work-fixes-rcu-v1-5-7446d2d335e6@kernel.org
> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
> (cherry picked from commit f0e48172a59e517e613b73f73cc35f24fd123aeb)
>
> https://virtuozzo.atlassian.net/browse/VSTOR-155528
> Feature: fix ms/ipc
>
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Sashiko has reviewed this patch and found no issues.
Carry the trailer below into the next revision and Sashiko will not review this patch again.
Reviewed-by: Sashiko <no-reply@sashiko.virtuozzo.com>
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261119015346.1173347-1-eva.kurchatova@virtuozzo.com?part=2
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Devel] [PATCH hci-8.2 1/2] ms/ipc: create_ipc_ns: drop mqueue mount on sysctl setup failure
2026-11-19 1:52 ` [Devel] [PATCH hci-8.2 1/2] ms/ipc: create_ipc_ns: drop mqueue mount on sysctl setup failure Eva Kurchatova
@ 2026-11-19 2:00 ` no-reply
2026-11-19 17:06 ` Konstantin Khorenko
1 sibling, 0 replies; 9+ messages in thread
From: no-reply @ 2026-11-19 2:00 UTC (permalink / raw)
To: Eva Kurchatova, vladimir.riabchun; +Cc: devel
> From: Vlad Kulikov <vlad.kulikov.c@gmail.com>
>
> If setup_mq_sysctls(ns) fails after mq_init_ns(ns) succeeds, the error
> path skipped releasing the internal kernel mqueue mount kept in
> ns->mq_mnt. That leaves the vfsmount/superblock referenced until final
> namespace teardown, i.e. a resource leak on this rare failure edge.
>
> Unwind it by calling mntput(ns->mq_mnt) before dropping user_ns and
> freeing the IPC namespace. This mirrors the normal ordering used in
> free_ipc_ns().
>
> Link: https://lkml.kernel.org/r/20251021181341.670297-1-vlad_kulikov_c@pm.me
> Signed-off-by: Vlad Kulikov <vlad_kulikov_c@pm.me>
> Reviewed-by: Jan Kara <jack@suse.cz>
> Cc: Aleksa Sarai <cyphar@cyphar.com>
> Cc: Christian Brauner <brauner@kernel.org>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Ma Wupeng <mawupeng1@huawei.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> (cherry picked from commit 7229d74e5e8c1f140529d405c88d4493e37ce4e3)
>
> https://virtuozzo.atlassian.net/browse/VSTOR-155528
> Feature: fix ms/ipc
>
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Sashiko has reviewed this patch and found no issues.
Carry the trailer below into the next revision and Sashiko will not review this patch again.
Reviewed-by: Sashiko <no-reply@sashiko.virtuozzo.com>
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261119015346.1173347-1-eva.kurchatova@virtuozzo.com?part=1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Devel] [PATCH hci-8.2 0/2] ms/ipc: backport mqueue mount leak fix
2026-11-19 1:52 [Devel] [PATCH hci-8.2 0/2] ms/ipc: backport mqueue mount leak fix Eva Kurchatova
2026-11-19 1:52 ` [Devel] [PATCH hci-8.2 1/2] ms/ipc: create_ipc_ns: drop mqueue mount on sysctl setup failure Eva Kurchatova
2026-11-19 1:52 ` [Devel] [PATCH hci-8.2 2/2] ms/ipc: drop the mqueue mount with kern_unmount() on " Eva Kurchatova
@ 2026-11-19 17:06 ` Konstantin Khorenko
2026-11-19 17:06 ` Konstantin Khorenko
3 siblings, 0 replies; 9+ messages in thread
From: Konstantin Khorenko @ 2026-11-19 17:06 UTC (permalink / raw)
To: Eva Kurchatova; +Cc: devel
Applying as is.
On Thu, 19 Nov 2026 03:52:55 +0200, Eva Kurchatova wrote:
> Patchset for task https://virtuozzo.atlassian.net/browse/VSTOR-155528
Thanks.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Devel] [PATCH hci-8.2 1/2] ms/ipc: create_ipc_ns: drop mqueue mount on sysctl setup failure
2026-11-19 1:52 ` [Devel] [PATCH hci-8.2 1/2] ms/ipc: create_ipc_ns: drop mqueue mount on sysctl setup failure Eva Kurchatova
2026-11-19 2:00 ` no-reply
@ 2026-11-19 17:06 ` Konstantin Khorenko
1 sibling, 0 replies; 9+ messages in thread
From: Konstantin Khorenko @ 2026-11-19 17:06 UTC (permalink / raw)
To: Eva Kurchatova; +Cc: devel
Applying as is.
On Thu, 19 Nov 2026 03:52:56 +0200, Eva Kurchatova wrote:
> If setup_mq_sysctls(ns) fails after mq_init_ns(ns) succeeds, the error
Thanks.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Devel] [PATCH hci-8.2 2/2] ms/ipc: drop the mqueue mount with kern_unmount() on setup failure
2026-11-19 1:52 ` [Devel] [PATCH hci-8.2 2/2] ms/ipc: drop the mqueue mount with kern_unmount() on " Eva Kurchatova
2026-11-19 1:58 ` no-reply
@ 2026-11-19 17:06 ` Konstantin Khorenko
1 sibling, 0 replies; 9+ messages in thread
From: Konstantin Khorenko @ 2026-11-19 17:06 UTC (permalink / raw)
To: Eva Kurchatova; +Cc: devel
Applying as is.
On Thu, 19 Nov 2026 03:52:57 +0200, Eva Kurchatova wrote:
> Use kern_unmount(). free_ipc() open-codes the same thing for a namespace
Thanks.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Devel] [PATCH hci-8.2 0/2] ms/ipc: backport mqueue mount leak fix
2026-11-19 1:52 [Devel] [PATCH hci-8.2 0/2] ms/ipc: backport mqueue mount leak fix Eva Kurchatova
` (2 preceding siblings ...)
2026-11-19 17:06 ` [Devel] [PATCH hci-8.2 0/2] ms/ipc: backport mqueue mount leak fix Konstantin Khorenko
@ 2026-11-19 17:06 ` Konstantin Khorenko
3 siblings, 0 replies; 9+ messages in thread
From: Konstantin Khorenko @ 2026-11-19 17:06 UTC (permalink / raw)
To: vladimir.riabchun, Eva Kurchatova; +Cc: devel
On Thu, 19 Nov 2026 03:52:55 +0200, Eva Kurchatova wrote:
> ms/ipc: backport mqueue mount leak fix
>
> Patchset for task https://virtuozzo.atlassian.net/browse/VSTOR-155528
>
> Christian Brauner (1):
> ms/ipc: drop the mqueue mount with kern_unmount() on setup failure
>
> [...]
Applied to branch-rh10-6.12.0-211.75.1.26.x.vz10-ovz, will be released in rh10-6.12.0-211.75.1.26.4.vz10, thanks!
[1/2] ms/ipc: create_ipc_ns: drop mqueue mount on sysctl setup failure
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/371347f69a6e
[2/2] ms/ipc: drop the mqueue mount with kern_unmount() on setup failure
https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/e010f37f8376
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-11-19 17:08 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 1:52 [Devel] [PATCH hci-8.2 0/2] ms/ipc: backport mqueue mount leak fix Eva Kurchatova
2026-11-19 1:52 ` [Devel] [PATCH hci-8.2 1/2] ms/ipc: create_ipc_ns: drop mqueue mount on sysctl setup failure Eva Kurchatova
2026-11-19 2:00 ` no-reply
2026-11-19 17:06 ` Konstantin Khorenko
2026-11-19 1:52 ` [Devel] [PATCH hci-8.2 2/2] ms/ipc: drop the mqueue mount with kern_unmount() on " Eva Kurchatova
2026-11-19 1:58 ` no-reply
2026-11-19 17:06 ` Konstantin Khorenko
2026-11-19 17:06 ` [Devel] [PATCH hci-8.2 0/2] ms/ipc: backport mqueue mount leak fix Konstantin Khorenko
2026-11-19 17:06 ` Konstantin Khorenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.