[Devel] [PATCH RHEL9 COMMIT] mempolicy: Prohibit VE processes numa binding syscalls
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Oct 20 11:40:44 MSK 2021
The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-4.vz9.10.12
------>
commit 81f313c7272c6d97b4907972c028c8cd0384e3e6
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Wed Oct 20 11:40:44 2021 +0300
mempolicy: Prohibit VE processes numa binding syscalls
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 e32360e90274..fb58cc4cf81b 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 @@ COMPAT_SYSCALL_DEFINE5(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 @@ COMPAT_SYSCALL_DEFINE6(mbind, compat_ulong_t, start, compat_ulong_t, len,
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;
More information about the Devel
mailing list