[Devel] [PATCH RHEL8 COMMIT] mempolicy: Prohibit VE processes numa binding syscalls

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jun 16 13:57:45 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.43
------>
commit 987be0b9979fd813baf6e5be609c22a76641c3c4
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Wed Jun 16 13:57:45 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>
---
 mm/mempolicy.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 3990baab535b..791546fe18e7 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1388,6 +1388,9 @@ static long kernel_set_mempolicy(int mode, const unsigned long __user *nmask,
 	nodemask_t nodes;
 	unsigned short flags;
 
+	if (!ve_is_super(get_exec_env()))
+		return -ENOSYS;
+
 	flags = mode & MPOL_MODE_FLAGS;
 	mode &= ~MPOL_MODE_FLAGS;
 	if ((unsigned int)mode >= MPOL_MAX)
@@ -1553,6 +1556,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, MAX_NUMNODES);
 	alloc_size = ALIGN(nr_bits, BITS_PER_LONG) / 8;
 
@@ -1602,6 +1608,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