[Devel] [PATCH RHEL7 COMMIT] ve/fs: limit "fs.ve-mount-nr" sysctl with INT_MAX

Konstantin Khorenko khorenko at virtuozzo.com
Fri Aug 11 17:50:11 MSK 2017


The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.35.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.26.1.vz7.35.3
------>
commit 22157fffc0aa97358cdaba5b309a700037af2a65
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Fri Aug 11 18:50:11 2017 +0400

    ve/fs: limit "fs.ve-mount-nr" sysctl with INT_MAX
    
    sysctl "fs.ve-mount-nr" is unsigned int and is casted to "int" while
    comparing values => if we set it to a value > INT_MAX, VE won't be able to
    mount anything after that.
    => set a max value for sysctl == INT_MAX
    
    https://jira.sw.ru/browse/PSBM-69880
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
    Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 kernel/ve/veowner.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kernel/ve/veowner.c b/kernel/ve/veowner.c
index 8df6390..a7fe9cc 100644
--- a/kernel/ve/veowner.c
+++ b/kernel/ve/veowner.c
@@ -83,6 +83,8 @@ static void prepare_proc(void)
  * points for a VE.
  */
 unsigned int sysctl_ve_mount_nr = 4096;
+static int ve_mount_nr_min = 0;
+static int ve_mount_nr_max = INT_MAX;
 
 static struct ctl_table vz_fs_table[] = {
 	{
@@ -97,7 +99,9 @@ static struct ctl_table vz_fs_table[] = {
 		.data           = &sysctl_ve_mount_nr,
 		.maxlen         = sizeof(sysctl_ve_mount_nr),
 		.mode           = 0644,
-		.proc_handler   = proc_dointvec,
+		.proc_handler   = proc_dointvec_minmax,
+		.extra1		= &ve_mount_nr_min,
+		.extra2		= &ve_mount_nr_max,
 	},
 	{ 0 }
 };


More information about the Devel mailing list