#
9eb47c26 |
| 22-Jan-2012 |
Eric W. Biederman <ebiederm@xmission.com> |
sysctl: Add a root pointer to ctl_table_set
Add a ctl_table_root pointer to ctl_table set so it is easy to go from a ctl_table_set to a ctl_table_root.
Signed-off-by: Eric W. Biederman <ebiederm@xm
sysctl: Add a root pointer to ctl_table_set
Add a ctl_table_root pointer to ctl_table set so it is easy to go from a ctl_table_set to a ctl_table_root.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
show more ...
|
#
6a75ce16 |
| 18-Jan-2012 |
Eric W. Biederman <ebiederm@xmission.com> |
sysctl: Rewrite proc_sys_readdir in terms of first_entry and next_entry
Replace sysctl_head_next with first_entry and next_entry. These new iterators operate at the level of sysctl table entries an
sysctl: Rewrite proc_sys_readdir in terms of first_entry and next_entry
Replace sysctl_head_next with first_entry and next_entry. These new iterators operate at the level of sysctl table entries and filter out any sysctl tables that should not be shown.
Utilizing two specialized functions instead of a single function removes conditionals for handling awkward special cases that only come up at the beginning of iteration, making the iterators easier to read and understand.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
show more ...
|
#
076c3eed |
| 09-Jan-2012 |
Eric W. Biederman <ebiederm@xmission.com> |
sysctl: Rewrite proc_sys_lookup introducing find_entry and lookup_entry.
Replace the helpers that proc_sys_lookup uses with helpers that work in terms of an entire sysctl directory. This is worse f
sysctl: Rewrite proc_sys_lookup introducing find_entry and lookup_entry.
Replace the helpers that proc_sys_lookup uses with helpers that work in terms of an entire sysctl directory. This is worse for sysctl_lock hold times but it is much better for code clarity and the code cleanups to come.
find_in_table is no longer needed so it is removed.
find_entry a general helper to find entries in a directory is added.
lookup_entry is a simple wrapper around find_entry that takes the sysctl_lock increases the use count if an entry is found and drops the sysctl_lock.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
show more ...
|
#
a194558e |
| 21-Jan-2012 |
Eric W. Biederman <ebiederm@xmission.com> |
sysctl: Normalize the root_table data structure.
Every other directory has a .child member and we look at the .child for our entries. Do the same for the root_table.
Signed-off-by: Eric W. Biederm
sysctl: Normalize the root_table data structure.
Every other directory has a .child member and we look at the .child for our entries. Do the same for the root_table.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
show more ...
|
#
8425d6aa |
| 09-Jan-2012 |
Eric W. Biederman <ebiederm@xmission.com> |
sysctl: Factor out insert_header and erase_header
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
|
#
e0d04529 |
| 10-Jan-2012 |
Eric W. Biederman <ebiederm@xmission.com> |
sysctl: Factor out init_header from __register_sysctl_paths
Factor out a routing to initialize the sysctl_table_header.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
|
#
938aaa4f |
| 09-Jan-2012 |
Eric W. Biederman <ebiederm@xmission.com> |
sysctl: Initial support for auto-unregistering sysctl tables.
Add nreg to ctl_table_header. When nreg drops to 0 the ctl_table_header will be unregistered.
Factor out drop_sysctl_table from unregi
sysctl: Initial support for auto-unregistering sysctl tables.
Add nreg to ctl_table_header. When nreg drops to 0 the ctl_table_header will be unregistered.
Factor out drop_sysctl_table from unregister_sysctl_table, and add the logic for decrementing nreg.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
show more ...
|
#
3cc3e046 |
| 07-Jan-2012 |
Eric W. Biederman <ebiederm@xmission.com> |
sysctl: A more obvious version of grab_header.
Instead of relying on sysct_head_next(NULL) to magically return the right header for the root directory instead explicitly transform NULL into the root
sysctl: A more obvious version of grab_header.
Instead of relying on sysct_head_next(NULL) to magically return the right header for the root directory instead explicitly transform NULL into the root directories header.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
show more ...
|
#
8d6ecfcc |
| 06-Jan-2012 |
Eric W. Biederman <ebiederm@xmission.com> |
sysctl: Remove the now unused ctl_table parent field.
While useful at one time for selinux and the sysctl sanity checks those users no longer use the parent field and we can safely remove it.
Inspi
sysctl: Remove the now unused ctl_table parent field.
While useful at one time for selinux and the sysctl sanity checks those users no longer use the parent field and we can safely remove it.
Inspired-by: Lucian Adrian Grijincu <lucian.grijincu@gmil.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
show more ...
|
#
7c60c48f |
| 21-Jan-2012 |
Eric W. Biederman <ebiederm@xmission.com> |
sysctl: Improve the sysctl sanity checks
- Stop validating subdirectories now that we only register leaf tables
- Cleanup and improve the duplicate filename check. * Run the duplicate filename ch
sysctl: Improve the sysctl sanity checks
- Stop validating subdirectories now that we only register leaf tables
- Cleanup and improve the duplicate filename check. * Run the duplicate filename check under the sysctl_lock to guarantee we never add duplicate names. * Reduce the duplicate filename check to nearly O(M*N) where M is the number of entries in tthe table we are registering and N is the number of entries in the directory before we got there.
- Move the duplicate filename check into it's own function and call it directtly from __register_sysctl_table
- Kill the config option as the sanity checks are now cheap enough the config option is unnecessary. The original reason for the config option was because we had a huge table used to verify the proc filename to binary sysctl mapping. That table has now evolved into the binary_sysctl translation layer and is no longer part of the sysctl_check code.
- Tighten up the permission checks. Guarnateeing that files only have read or write permissions.
- Removed redudant check for parents having a procname as now everything has a procname.
- Generalize the backtrace logic so that we print a backtrace from any failure of __register_sysctl_table that was not caused by a memmory allocation failure. The backtrace allows us to track down who erroneously registered a sysctl table.
Bechmark before (CONFIG_SYSCTL_CHECK=y): make-dummies 0 999 -> 12s rmmod dummy -> 0.08s
Bechmark before (CONFIG_SYSCTL_CHECK=n): make-dummies 0 999 -> 0.7s rmmod dummy -> 0.06s make-dummies 0 99999 -> 1m13s rmmod dummy -> 0.38s
Benchmark after: make-dummies 0 999 -> 0.65s rmmod dummy -> 0.055s make-dummies 0 9999 -> 1m10s rmmod dummy -> 0.39s
The sysctl sanity checks now impose no measurable cost.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
show more ...
|
#
f728019b |
| 22-Jan-2012 |
Eric W. Biederman <ebiederm@xmission.com> |
sysctl: register only tables of sysctl files
Split the registration of a complex ctl_table array which may have arbitrary numbers of directories (->child != NULL) and tables of files into a series o
sysctl: register only tables of sysctl files
Split the registration of a complex ctl_table array which may have arbitrary numbers of directories (->child != NULL) and tables of files into a series of simpler registrations that only register tables of files.
Graphically:
register('dir', { + file-a + file-b + subdir1 + file-c + subdir2 + file-d + file-e })
is transformed into: wrapper->subheaders[0] = register('dir', {file1-a, file1-b}) wrapper->subheaders[1] = register('dir/subdir1', {file-c}) wrapper->subheaders[2] = register('dir/subdir2', {file-d, file-e}) return wrapper
This guarantees that __register_sysctl_table will only see a simple ctl_table array with all entries having (->child == NULL).
Care was taken to pass the original simple ctl_table arrays to __register_sysctl_table whenever possible.
This change is derived from a similar patch written by Lucrian Grijincu.
Inspired-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
show more ...
|
#
ec6a5266 |
| 21-Jan-2012 |
Eric W. Biederman <ebiederm@xmission.com> |
sysctl: Add ctl_table chains into cstring paths
For any component of table passed to __register_sysctl_paths that actually serves as a path, add that to the cstring path that is passed to __register
sysctl: Add ctl_table chains into cstring paths
For any component of table passed to __register_sysctl_paths that actually serves as a path, add that to the cstring path that is passed to __register_sysctl_table.
The result is that for most calls to __register_sysctl_paths we only pass a table to __register_sysctl_table that contains no child directories.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
show more ...
|
#
6e9d5164 |
| 21-Jan-2012 |
Eric W. Biederman <ebiederm@xmission.com> |
sysctl: Add support for register sysctl tables with a normal cstring path.
Make __register_sysctl_table the core sysctl registration operation and make it take a char * string as path.
Now that bin
sysctl: Add support for register sysctl tables with a normal cstring path.
Make __register_sysctl_table the core sysctl registration operation and make it take a char * string as path.
Now that binary paths have been banished into the real of backwards compatibility in kernel/binary_sysctl.c where they can be safely ignored there is no longer a need to use struct ctl_path to represent path names when registering ctl_tables.
Start the transition to using normal char * strings to represent pathnames when registering sysctl tables. Normal strings are easier to deal with both in the internal sysctl implementation and for programmers registering sysctl tables.
__register_sysctl_paths is turned into a backwards compatibility wrapper that converts a ctl_path array into a normal char * string.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
show more ...
|
#
f05e53a7 |
| 21-Jan-2012 |
Eric W. Biederman <ebiederm@xmission.com> |
sysctl: Create local copies of directory names used in paths
Creating local copies of directory names is a good idea for two reasons. - The dynamic names used by callers must be copied into new st
sysctl: Create local copies of directory names used in paths
Creating local copies of directory names is a good idea for two reasons. - The dynamic names used by callers must be copied into new strings by the callers today to ensure the strings do not change between register and unregister of the sysctl table.
- Sysctl directories have a potentially different lifetime than the time between register and unregister of any particular sysctl table.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
show more ...
|
#
bd295b56 |
| 22-Jan-2012 |
Eric W. Biederman <ebiederm@xmission.com> |
sysctl: Remove the unnecessary sysctl_set parent concept.
In sysctl_net register the two networking roots in the proper order.
In register_sysctl walk the sysctl sets in the reverse order of the sy
sysctl: Remove the unnecessary sysctl_set parent concept.
In sysctl_net register the two networking roots in the proper order.
In register_sysctl walk the sysctl sets in the reverse order of the sysctl roots.
Remove parent from ctl_table_set and setup_sysctl_set as it is no longer needed.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
show more ...
|
#
97324cd8 |
| 10-Jan-2012 |
Eric W. Biederman <ebiederm@xmission.com> |
sysctl: Implement retire_sysctl_set
This adds a small helper retire_sysctl_set to remove the intimate knowledge about the how a sysctl_set is implemented from net/sysct_net.c
Signed-off-by: Eric W.
sysctl: Implement retire_sysctl_set
This adds a small helper retire_sysctl_set to remove the intimate knowledge about the how a sysctl_set is implemented from net/sysct_net.c
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
show more ...
|
#
a15e2098 |
| 08-Jan-2012 |
Eric W. Biederman <ebiederm@xmission.com> |
sysctl: Make the directories have nlink == 1
I goofed when I made sysctl directories have nlink == 0. nlink == 0 means the directory has been deleted. nlink == 1 meands a directory does not count su
sysctl: Make the directories have nlink == 1
I goofed when I made sysctl directories have nlink == 0. nlink == 0 means the directory has been deleted. nlink == 1 meands a directory does not count subdirectories.
Use the default nlink == 1 for sysctl directories.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
show more ...
|
#
1f87f0b5 |
| 06-Jan-2012 |
Eric W. Biederman <ebiederm@xmission.com> |
sysctl: Move the implementation into fs/proc/proc_sysctl.c
Move the core sysctl code from kernel/sysctl.c and kernel/sysctl_check.c into fs/proc/proc_sysctl.c.
Currently sysctl maintenance is hampe
sysctl: Move the implementation into fs/proc/proc_sysctl.c
Move the core sysctl code from kernel/sysctl.c and kernel/sysctl_check.c into fs/proc/proc_sysctl.c.
Currently sysctl maintenance is hampered by the sysctl implementation being split across 3 files with artificial layering between them. Consolidate the entire sysctl implementation into 1 file so that it is easier to see what is going on and hopefully allowing for simpler maintenance.
For functions that are now only used in fs/proc/proc_sysctl.c remove their declarations from sysctl.h and make them static in fs/proc/proc_sysctl.c
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
show more ...
|
#
de4e83bd |
| 06-Jan-2012 |
Eric W. Biederman <ebiederm@xmission.com> |
sysctl: Register the base sysctl table like any other sysctl table.
Simplify the code by treating the base sysctl table like any other sysctl table and register it with register_sysctl_table.
To en
sysctl: Register the base sysctl table like any other sysctl table.
Simplify the code by treating the base sysctl table like any other sysctl table and register it with register_sysctl_table.
To ensure this table is registered early enough to avoid problems call sysctl_init from proc_sys_init.
Rename sysctl_net.c:sysctl_init() to net_sysctl_init() to avoid name conflicts now that kernel/sysctl.c:sysctl_init() is no longer static.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
show more ...
|
Revision tags: v3.2-rc7, v3.2-rc6, v3.2-rc5, v3.2-rc4, v3.2-rc3, v3.2-rc2, v3.2-rc1, v3.1, v3.1-rc10, v3.1-rc9, v3.1-rc8, v3.1-rc7, v3.1-rc6, v3.1-rc5, v3.1-rc4, v3.1-rc3, v3.1-rc2, v3.1-rc1, v3.0, v3.0-rc7, v3.0-rc6, v3.0-rc5, v3.0-rc4, v3.0-rc3 |
|
#
36885d7b |
| 10-Jun-2011 |
Lucas De Marchi <lucas.demarchi@profusion.mobi> |
sysctl: remove impossible condition check
Remove checks for conditions that will never happen. If procname is NULL the loop would already had bailed out, so there's no need to check it again.
At th
sysctl: remove impossible condition check
Remove checks for conditions that will never happen. If procname is NULL the loop would already had bailed out, so there's no need to check it again.
At the same time this also compacts the function find_in_table() by refactoring it to be easier to read.
Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi> Reviewed-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
show more ...
|
#
f1ecf068 |
| 02-Nov-2011 |
Lucas De Marchi <lucas.demarchi@profusion.mobi> |
sysctl: add support for poll()
Adding support for poll() in sysctl fs allows userspace to receive notifications of changes in sysctl entries. This adds a infrastructure to allow files in sysctl fs
sysctl: add support for poll()
Adding support for poll() in sysctl fs allows userspace to receive notifications of changes in sysctl entries. This adds a infrastructure to allow files in sysctl fs to be pollable and implements it for hostname and domainname.
[akpm@linux-foundation.org: s/declare/define/ for definitions] Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi> Cc: Greg KH <gregkh@suse.de> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
show more ...
|
#
887df078 |
| 02-Nov-2011 |
Pavel Emelyanov <xemul@openvz.org> |
procfs: report EISDIR when reading sysctl dirs in proc
On reading sysctl dirs we should return -EISDIR instead of -EINVAL.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: Cyrill Go
procfs: report EISDIR when reading sysctl dirs in proc
On reading sysctl dirs we should return -EISDIR instead of -EINVAL.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: Al Viro <viro@ZenIV.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
show more ...
|
#
6d6b77f1 |
| 28-Oct-2011 |
Miklos Szeredi <mszeredi@suse.cz> |
filesystems: add missing nlink wrappers
Replace direct i_nlink updates with the respective updater function (inc_nlink, drop_nlink, clear_nlink, inode_dec_link_count).
Signed-off-by: Miklos Szeredi
filesystems: add missing nlink wrappers
Replace direct i_nlink updates with the respective updater function (inc_nlink, drop_nlink, clear_nlink, inode_dec_link_count).
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
show more ...
|
#
10556cb2 |
| 20-Jun-2011 |
Al Viro <viro@zeniv.linux.org.uk> |
->permission() sanitizing: don't pass flags to ->permission()
not used by the instances anymore.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
|
#
1fc0f78c |
| 20-Jun-2011 |
Al Viro <viro@zeniv.linux.org.uk> |
->permission() sanitizing: MAY_NOT_BLOCK
Duplicate the flags argument into mask bitmap.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
|