[Devel] [PATCH RH9 18/28] mempolicy: Prohibit VE processes numa binding syscalls

Andrey Zhadchenko andrey.zhadchenko at virtuozzo.com
Thu Oct 14 13:33:26 MSK 2021


From: Kirill Tkhai <ktkhai at virtuozzo.com>

NUMA mustn't not available in CT, so let's prohibit these
calls. For CT tasks this will look like kernel compiled
without NUMA support.

https://jira.sw.ru/browse/PSBM-92583

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>

(cherry-picked from vz7 commit 01720c50bea3 ("mempolicy: Prohibit VE processes
numa binding syscalls"))

https://jira.sw.ru/browse/PSBM-127854
Signed-off-by: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>

(cherry picked from vz8 commit 75e78183725620559575ddce45da666dd722077f)
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
 mm/mempolicy.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index e32360e..fb58cc4 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1491,6 +1491,9 @@ static long kernel_set_mempolicy(int mode, const unsigned long __user *nmask,
 	int lmode = mode;
 	int err;
 
+	if (!ve_is_super(get_exec_env()))
+		return -ENOSYS;
+
 	err = sanitize_mpol_flags(&lmode, &mode_flags);
 	if (err)
 		return err;
@@ -1653,6 +1656,9 @@ static int kernel_get_mempolicy(int __user *policy,
 	unsigned long nr_bits, alloc_size;
 	DECLARE_BITMAP(bm, MAX_NUMNODES);
 
+	if (!ve_is_super(get_exec_env()))
+		return -ENOSYS;
+
 	nr_bits = min_t(unsigned long, maxnode-1, nr_node_ids);
 	alloc_size = ALIGN(nr_bits, BITS_PER_LONG) / 8;
 
@@ -1702,6 +1708,9 @@ static int kernel_get_mempolicy(int __user *policy,
 	unsigned long nr_bits, alloc_size;
 	nodemask_t bm;
 
+	if (!ve_is_super(get_exec_env()))
+		return -ENOSYS;
+
 	nr_bits = min_t(unsigned long, maxnode-1, MAX_NUMNODES);
 	alloc_size = ALIGN(nr_bits, BITS_PER_LONG) / 8;
 
-- 
1.8.3.1



More information about the Devel mailing list