SYSCTL: export root handling routines
cover SYSCTL: export root handling routines
These rouitines are required to make SUNRPC sysctl's network-namespace-aware.
The following series consists of:
---
Stanislav Kinsbursky (2):
SYSCTL: root unregister routine introduced
SYSCTL: export root register and unregister routines
kernel/sysctl.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
PATCH 1/2 SYSCTL: root unregister routine introduced
This routine is required for SUNRPC sysctl's, which are going to be allocated, processed and destroyed per network namespace context.
IOW, new sysctl root will be registered on network namespace creation and thus have to unregistered before network namespace destruction.
--- kernel/sysctl.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
kernel/sysctl.c +7 -0
@@ -1701,6 +1701,13 @@ void register_sysctl_root(struct ctl_table_root *root)spin_unlock (&sysctl_lock); } +void unregister_sysctl_root (struct ctl_table_root *root) +{ +spin_lock (&sysctl_lock); +list_del (&root->root_list); +spin_unlock (&sysctl_lock); +} +/* * sysctl_perm does NOT grant the superuser all rights automatically, because * some sysctl variables are readonly even to root.
Re: [PATCH 1/2] SYSCTL: root unregister routine introduced
Quoted 5 lines · On Mon, 12 Dec 2011 21:50:00 +0300 Stanislav Kinsbursky…
This routine is required for SUNRPC sysctl's, which are going to be allocated, processed and destroyed per network namespace context.
IOW, new sysctl root will be registered on network namespace creation and thus have to unregistered before network namespace destruction.
It's a bit suspicious that such a mature subsystem as sysctl newly needs its internals exported like this. Either a) the net namespaces work is doing something which hasn't been done before or b) it is doing something wrong.
So, please explain further so we can confirm that it is a) and not b).
kernel/sysctl.c void register_sysctl_root(struct ctl_table_root *root) · line 1710
Quoted 13 lines
kernel/sysctl.c +7
-0@@ -1701,6 +1701,13 @@ void register_sysctl_root(struct ctl_table_root *root)spin_unlock (&sysctl_lock); } +void unregister_sysctl_root (struct ctl_table_root *root) +{ +spin_lock (&sysctl_lock); +list_del (&root->root_list); +spin_unlock (&sysctl_lock); +} +
This requires the addition of a declaration to include/linux/sysctl.h.
Once that is done and review is complete, I'd suggest that these two patches be joined into a single patch, and that patch become part of whatever patch series it is which needs them.
Re: [PATCH 1/2] SYSCTL: root unregister routine introduced
13.12.2011 02:52, Andrew Morton пишет:
Quoted 9 lines
Quoted 5 lines · On Mon, 12 Dec 2011 21:50:00 +0300 Stanislav…
This routine is required for SUNRPC sysctl's, which are going to be allocated, processed and destroyed per network namespace context.
IOW, new sysctl root will be registered on network namespace creation and thus have to unregistered before network namespace destruction.
Quoted 7 lines
It's a bit suspicious that such a mature subsystem as sysctl newly needs its internals exported like this. Either a) the net namespaces work is doing something which hasn't been done before or b) it is doing something wrong.
So, please explain further so we can confirm that it is a) and not b).
Hello, Andrew.
The goal is to provide an ability to control and modify data by sysctl's in network namespace context. This is done by "net" sysctl's. But there are two more issues to solve:
1) Sysctl's have to be in /proc/sys/sunrpc
2) Sysctl's content should be accessible from creator's network context (not current user ones's).
Quoted 16 lines
kernel/sysctl.c void register_sysctl_root(struct ctl_table_root *root) · line 1710
Quoted 13 lines
kernel/sysctl.c +7
-0@@ -1701,6 +1701,13 @@ void register_sysctl_root(struct ctl_table_root *root)spin_unlock (&sysctl_lock); } +void unregister_sysctl_root (struct ctl_table_root *root) +{ +spin_lock (&sysctl_lock); +list_del (&root->root_list); +spin_unlock (&sysctl_lock); +} +This requires the addition of a declaration to
include/linux/sysctl.h.
Quoted 4 lines
Once that is done and review is complete, I'd suggest that these two patches be joined into a single patch, and that patch become part of whatever patch series it is which needs them.
Ok, I'll do so.
Signature · 2 lines
Best regards, Stanislav Kinsbursky
Re: [PATCH 1/2] SYSCTL: root unregister routine introduced
Quoted 15 lines · Stanislav Kinsbursky
13.12.2011 02:52, Andrew Morton пишет:
Quoted 14 lines
Quoted 5 lines · On Mon, 12 Dec 2011 21:50:00 +0300 Stanislav…
This routine is required for SUNRPC sysctl's, which are going to be allocated, processed and destroyed per network namespace context.
IOW, new sysctl root will be registered on network namespace creation and thus have to unregistered before network namespace destruction.It's a bit suspicious that such a mature subsystem as sysctl newly needs its internals exported like this. Either a) the net namespaces work is doing something which hasn't been done before or b) it is doing something wrong.
Quoted 8 lines
Quoted 2 lines
So, please explain further so we can confirm that it is a) and not b).
Hello, Andrew.
The goal is to provide an ability to control and modify data by sysctl's in network namespace context. This is done by "net" sysctl's.
But there are two more issues to solve:
1) Sysctl's have to be in/proc/sys/sunrpc
The sysctl root has nothing to with what directory the files show up in, so this should not be an issue.
Quoted 2 lines
2) Sysctl's content should be accessible from creator's network context (not current user ones's).
Making the sunrpc sysctls per network namespace would seem to address
this. I don't see why you would need a new root to handle this case.
Eric
PATCH 2/2 SYSCTL: export root register and unregister routines
In reply to Stanislav KinsburskyThese routines will be used in SUNPRC module and thus have to be exported.
--- kernel/sysctl.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
kernel/sysctl.c +2 -0
@@ -1700,6 +1700,7 @@ void register_sysctl_root(struct ctl_table_root *root)list_add_tail (&root->root_list, &sysctl_table_root.root_list);spin_unlock (&sysctl_lock); } +EXPORT_SYMBOL_GPL (register_sysctl_root);void unregister_sysctl_root (struct ctl_table_root *root) {
@@ -1707,6 +1708,7 @@ void unregister_sysctl_root(struct ctl_table_root *root)list_del (&root->root_list);spin_unlock (&sysctl_lock); } +EXPORT_SYMBOL_GPL (unregister_sysctl_root);/* * sysctl_perm does NOT grant the superuser all rights automatically, because