21 Dec, 2011

1 commit

  • binary_sysctl() calls sysctl_getname() which allocates from names_cache
    slab usin __getname()

    The matching function to free the name is __putname(), and not putname()
    which should be used only to match getname() allocations.

    This is because when auditing is enabled, putname() calls audit_putname
    *instead* (not in addition) to __putname(). Then, if a syscall is in
    progress, audit_putname does not release the name - instead, it expects
    the name to get released when the syscall completes, but that will happen
    only if audit_getname() was called previously, i.e. if the name was
    allocated with getname() rather than the naked __getname(). So,
    __getname() followed by putname() ends up leaking memory.

    Signed-off-by: Michel Lespinasse
    Acked-by: Al Viro
    Cc: Christoph Hellwig
    Cc: Eric Paris
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michel Lespinasse
     

04 Oct, 2011

1 commit


13 Aug, 2011

1 commit

  • Use the move from Linux 2.6 to Linux 3.x as an excuse to kill the
    annoying subdirectories in the XFS source code. Besides the large
    amount of file rename the only changes are to the Makefile, a few
    files including headers with the subdirectory prefix, and the binary
    sysctl compat code that includes a header under fs/xfs/ from
    kernel/.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Alex Elder

    Christoph Hellwig
     

14 Mar, 2011

1 commit

  • new function: file_open_root(dentry, mnt, name, flags) opens the file
    vfs_path_lookup would arrive to.

    Note that name can be empty; in that case the usual requirement that
    dentry should be a directory is lifted.

    open-coded equivalents switched to it, may_open() got down exactly
    one caller and became static.

    Signed-off-by: Al Viro

    Al Viro
     

14 Jan, 2011

1 commit

  • * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (43 commits)
    Documentation/trace/events.txt: Remove obsolete sched_signal_send.
    writeback: fix global_dirty_limits comment runtime -> real-time
    ppc: fix comment typo singal -> signal
    drivers: fix comment typo diable -> disable.
    m68k: fix comment typo diable -> disable.
    wireless: comment typo fix diable -> disable.
    media: comment typo fix diable -> disable.
    remove doc for obsolete dynamic-printk kernel-parameter
    remove extraneous 'is' from Documentation/iostats.txt
    Fix spelling milisec -> ms in snd_ps3 module parameter description
    Fix spelling mistakes in comments
    Revert conflicting V4L changes
    i7core_edac: fix typos in comments
    mm/rmap.c: fix comment
    sound, ca0106: Fix assignment to 'channel'.
    hrtimer: fix a typo in comment
    init/Kconfig: fix typo
    anon_inodes: fix wrong function name in comment
    fix comment typos concerning "consistent"
    poll: fix a typo in comment
    ...

    Fix up trivial conflicts in:
    - drivers/net/wireless/iwlwifi/iwl-core.c (moved to iwl-legacy.c)
    - fs/ext4/ext4.h

    Also fix missed 'diabled' typo in drivers/net/bnx2x/bnx2x.h while at it.

    Linus Torvalds
     

10 Dec, 2010

1 commit

  • Originally adapted from Huang Ying's patch which moved the
    unknown_nmi_panic to the traps.c file. Because the old nmi
    watchdog was deleted before this change happened, the
    unknown_nmi_panic sysctl was lost. This re-adds it.

    Also, the nmi_watchdog sysctl was re-implemented and its
    documentation updated accordingly.

    Patch-inspired-by: Huang Ying
    Signed-off-by: Don Zickus
    Reviewed-by: Cyrill Gorcunov
    Acked-by: Yinghai Lu
    Cc: fweisbec@gmail.com
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Don Zickus
     

02 Nov, 2010

1 commit

  • "gadget", "through", "command", "maintain", "maintain", "controller", "address",
    "between", "initiali[zs]e", "instead", "function", "select", "already",
    "equal", "access", "management", "hierarchy", "registration", "interest",
    "relative", "memory", "offset", "already",

    Signed-off-by: Uwe Kleine-König
    Signed-off-by: Jiri Kosina

    Uwe Kleine-König
     

25 May, 2010

1 commit


08 May, 2010

1 commit

  • A while back there was a discussion regarding the rt_secret_interval timer.
    Given that we've had the ability to do emergency route cache rebuilds for awhile
    now, based on a statistical analysis of the various hash chain lengths in the
    cache, the use of the flush timer is somewhat redundant. This patch removes the
    rt_secret_interval sysctl, allowing us to rely solely on the statistical
    analysis mechanism to determine the need for route cache flushes.

    Signed-off-by: Neil Horman
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Neil Horman
     

30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

04 Mar, 2010

1 commit


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