24 Dec, 2009

1 commit

  • When printing legacy sysctls print the warning message
    for each of them only once. This way there is a guarantee
    the syslog won't be flooded for any sane program.

    The original attempt at this made the tables non const and stored
    the flag inline.

    Linus suggested using a separate hash table for this, this is based on a
    code snippet from him.

    The hash implies this is not exact and can sometimes not print a
    new sysctl due to a hash collision, but in practice this should not
    be a problem

    I used a FNV32 hash over the binary string with a 32byte bitmap. This
    gives relatively little collisions when all the predefined binary sysctls
    are hashed:

    size 256
    bucket
    length number
    0: [25]
    1: [67]
    2: [88]
    3: [47]
    4: [22]
    5: [6]
    6: [1]

    The worst case is a single collision of 6 hash values.

    Signed-off-by: Andi Kleen

    Andi Kleen
     

17 Dec, 2009

1 commit

  • As predicted during code review, the sysctl(2) changes made systems with
    old glibc nearly unusable. About every command gives a:

    warning: process `ls' used the deprecated sysctl system call with 1.4

    warning in the log.

    I see this on a SUSE 10.0 system with glibc 2.3.5.

    Don't warn for this common case.

    Signed-off-by: Andi Kleen
    Signed-off-by: Linus Torvalds

    Andi Kleen
     

12 Nov, 2009

3 commits


11 Nov, 2009

1 commit

  • To simply maintenance and to be able to remove all of the binary
    sysctl support from various subsystems I have rewritten the binary
    sysctl code as a compatibility wrapper around proc/sys.

    The code is built around a hard coded table based on the table
    in sysctl_check.c that lists all of our current binary sysctls
    and provides enough information to convert from the sysctl
    binary input into into ascii and back again. New in this
    patch is the realization that the only dynamic entries
    that need to be handled have ifname as the asscii string
    and ifindex as their ctl_name.

    When a sys_sysctl is called the code now looks in the
    translation table converting the binary name to the
    path under /proc where the value is to be found. Opens
    that file, and calls into a format conversion wrapper
    that calls fop->read and then fop->write as appropriate.

    Since in practice the practically no one uses or tests
    sys_sysctl rewritting the code to be beautiful is a little
    silly. The redeeming merit of this work is it allows us to
    rip out all of the binary sysctl syscall support from
    everywhere else in the tree. Allowing us to remove
    a lot of dead (after this patch) and barely maintained code.

    In addition it becomes much easier to optimize the sysctl
    implementation for being the backing store of /proc/sys,
    without having to worry about sys_sysctl.

    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     

06 Nov, 2009

4 commits

  • Now that all of the architectures use compat_sys_sysctl do_sysctl
    can become static.

    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • This uses compat_alloc_userspace to remove the various
    hacks to allow do_sysctl to write to throuh oldlenp.

    The rest of our mature compat syscall helper facitilies
    are used as well to ensure we have a nice clean maintainable
    compat syscall that can be used on all architectures.

    The motiviation for a generic compat sysctl (besides the
    obvious hack removal) is to reduce the number of compat
    sysctl defintions out there so I can refactor the
    binary sysctl implementation.

    ppc already used the name compat_sys_sysctl so I remove the
    ppcs version here.

    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Acked-by: Arnd Bergmann
    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • Read in the binary sysctl path once, instead of reread it
    from user space each time the code needs to access a path
    element.

    The deprecated sysctl warning is moved to do_sysctl so
    that the compat_sysctl entries syscalls will also warn.

    The return of -ENOSYS when !CONFIG_SYSCTL_SYSCALL is moved
    to binary_sysctl. Always leaving a do_sysctl available
    that handles !CONFIG_SYSCTL_SYSCALL and printing the
    deprecated sysctl warning allows for a single defitition
    of the sysctl syscall.

    Signed-off-by: Eric W. Biederman

    Eric W. Biederman
     
  • In preparation for more invasive cleanups separate the core
    binary sysctl logic into it's own file.

    Signed-off-by: Eric W. Biederman

    Eric W. Biederman