All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: Konstantin Khorenko <khorenko@virtuozzo.com>
To: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>,
	Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 1/2] mempolicy: prohibit mbind and set_mempolicy_home_node in VE
Date: Thu, 05 Nov 2026 19:48:44 +0100	[thread overview]
Message-ID: <20261105-b4-prep-khorenko-vstor-153679-mbind-ve-v1-1-b4fcd27c8001@virtuozzo.com> (raw)
In-Reply-To: <20261105-b4-prep-khorenko-vstor-153679-mbind-ve-v1-0-b4fcd27c8001@virtuozzo.com>

A CT is meant to see a kernel without NUMA support: in a non-super VE
the NUMA API syscalls return -ENOSYS, as they do in a kernel built
without CONFIG_NUMA.

Return -ENOSYS from mbind(2) and set_mempolicy_home_node(2) at the
start of the handler, before any argument check, as the other NUMA API
syscalls do.

Fixes: a803a5b2ea97 ("mempolicy: prohibit all NUMA API syscalls in VE")
https://virtuozzo.atlassian.net/browse/VSTOR-153679

Feature: mm: prohibit NUMA API inside CT
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 mm/mempolicy.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 3255d3e987180..9b2a32ef92949 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1584,6 +1584,9 @@ SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, le
 	int err = -ENOENT;
 	VMA_ITERATOR(vmi, mm, start);
 
+	if (!ve_is_super(get_exec_env()))
+		return -ENOSYS;
+
 	start = untagged_addr(start);
 	if (start & ~PAGE_MASK)
 		return -EINVAL;
@@ -1645,6 +1648,9 @@ SYSCALL_DEFINE6(mbind, unsigned long, start, unsigned long, len,
 		unsigned long, mode, const unsigned long __user *, nmask,
 		unsigned long, maxnode, unsigned int, flags)
 {
+	if (!ve_is_super(get_exec_env()))
+		return -ENOSYS;
+
 	return kernel_mbind(start, len, mode, nmask, maxnode, flags);
 }
 

-- 
2.43.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  reply	other threads:[~2026-11-05 18:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 18:48 [Devel] [PATCH hci-8.1 0/2] " Konstantin Khorenko
2026-11-05 18:48 ` Konstantin Khorenko [this message]
2026-11-05 18:52   ` [Devel] [PATCH hci-8.1 1/2] " no-reply
2026-11-05 18:48 ` [Devel] [PATCH hci-8.1 2/2] selftests/ve: check that the NUMA API syscalls return ENOSYS in a VE Konstantin Khorenko
2026-11-05 18:54   ` no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261105-b4-prep-khorenko-vstor-153679-mbind-ve-v1-1-b4fcd27c8001@virtuozzo.com \
    --to=khorenko@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=ptikhomirov@virtuozzo.com \
    --cc=vasileios.almpanis@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.