[Devel] [PATCH rh7 1/2] sysctl: Introduce proc_doulongvec_minmax_virtual()

Andrey Ryabinin aryabinin at odin.com
Tue Aug 18 06:44:46 PDT 2015


proc_doulongvec_minmax_virtual() - analogous of proc_doulongvec_minmax()
for per CT sysctls. Will be used for virtualizing aio_nr, aio_max_nr

Signed-off-by: Andrey Ryabinin <aryabinin at odin.com>
---
 include/linux/sysctl.h |  2 ++
 kernel/sysctl.c        | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index bdcf06d..af467dc 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -60,6 +60,8 @@ extern int proc_do_large_bitmap(struct ctl_table *, int,
 
 extern int proc_dointvec_virtual(struct ctl_table *table, int write,
 		void __user *buffer, size_t *lenp, loff_t *ppos);
+extern int proc_doulongvec_minmax_virtual(struct ctl_table *table, int write,
+		void __user *buffer, size_t *lenp, loff_t *ppos);
 extern int proc_dointvec_immutable(struct ctl_table *table, int write,
 		void __user *buffer, size_t *lenp, loff_t *ppos);
 extern int proc_dostring_immutable(struct ctl_table *table, int write,
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 8478a1e..1a568e7 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2727,6 +2727,17 @@ int proc_dointvec_virtual(struct ctl_table *table, int write,
 	return -EINVAL;
 }
 
+int proc_doulongvec_minmax_virtual(struct ctl_table *table, int write,
+				void __user *buffer, size_t *lenp,
+				loff_t *ppos)
+{
+	struct ctl_table tmp = *table;
+
+	if (virtual_ptr(&tmp.data, &ve0, sizeof(ve0), get_exec_env()))
+		return proc_doulongvec_minmax(&tmp, write, buffer, lenp, ppos);
+	return -EINVAL;
+}
+
 static inline bool sysctl_in_container(void)
 {
 	return !ve_is_super(get_exec_env());
-- 
2.4.6




More information about the Devel mailing list