14 Apr, 2012

11 commits

  • commit 79549c6dfda0603dba9a70a53467ce62d9335c33 upstream.

    keyctl_session_to_parent(task) sets ->replacement_session_keyring,
    it should be processed and cleared by key_replace_session_keyring().

    However, this task can fork before it notices TIF_NOTIFY_RESUME and
    the new child gets the bogus ->replacement_session_keyring copied by
    dup_task_struct(). This is obviously wrong and, if nothing else, this
    leads to put_cred(already_freed_cred).

    change copy_creds() to clear this member. If copy_process() fails
    before this point the wrong ->replacement_session_keyring doesn't
    matter, exit_creds() won't be called.

    Signed-off-by: Oleg Nesterov
    Acked-by: David Howells
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Oleg Nesterov
     
  • commit 620f6e8e855d6d447688a5f67a4e176944a084e8 upstream.

    Commit bfdc0b4 adds code to restrict access to dmesg_restrict,
    however, it incorrectly alters kptr_restrict rather than
    dmesg_restrict.

    The original patch from Richard Weinberger
    (https://lkml.org/lkml/2011/3/14/362) alters dmesg_restrict as
    expected, and so the patch seems to have been misapplied.

    This adds the CAP_SYS_ADMIN check to both dmesg_restrict and
    kptr_restrict, since both are sensitive.

    Reported-by: Phillip Lougher
    Signed-off-by: Kees Cook
    Acked-by: Serge Hallyn
    Acked-by: Richard Weinberger
    Signed-off-by: James Morris
    Signed-off-by: Greg Kroah-Hartman

    Kees Cook
     
  • commit 98b54aa1a2241b59372468bd1e9c2d207bdba54b upstream.

    There is extra state information that needs to be exposed in the
    kgdb_bpt structure for tracking how a breakpoint was installed. The
    debug_core only uses the the probe_kernel_write() to install
    breakpoints, but this is not enough for all the archs. Some arch such
    as x86 need to use text_poke() in order to install a breakpoint into a
    read only page.

    Passing the kgdb_bpt structure to kgdb_arch_set_breakpoint() and
    kgdb_arch_remove_breakpoint() allows other archs to set the type
    variable which indicates how the breakpoint was installed.

    Signed-off-by: Jason Wessel
    Signed-off-by: Greg Kroah-Hartman

    Jason Wessel
     
  • commit 247bc03742545fec2f79939a3b9f738392a0f7b4 upstream.

    There is a race condition between the freezer and request_firmware()
    such that if request_firmware() is run on one CPU and
    freeze_processes() is run on another CPU and usermodehelper_disable()
    called by it succeeds to grab umhelper_sem for writing before
    usermodehelper_read_trylock() called from request_firmware()
    acquires it for reading, the request_firmware() will fail and
    trigger a WARN_ON() complaining that it was called at a wrong time.
    However, in fact, it wasn't called at a wrong time and
    freeze_processes() simply happened to be executed simultaneously.

    To avoid this race, at least in some cases, modify
    usermodehelper_read_trylock() so that it doesn't fail if the
    freezing of tasks has just started and hasn't been completed yet.
    Instead, during the freezing of tasks, it will try to freeze the
    task that has called it so that it can wait until user space is
    thawed without triggering the scary warning.

    For this purpose, change usermodehelper_disabled so that it can
    take three different values, UMH_ENABLED (0), UMH_FREEZING and
    UMH_DISABLED. The first one means that usermode helpers are
    enabled, the last one means "hard disable" (i.e. the system is not
    ready for usermode helpers to be used) and the second one
    is reserved for the freezer. Namely, when freeze_processes() is
    started, it sets usermodehelper_disabled to UMH_FREEZING which
    tells usermodehelper_read_trylock() that it shouldn't fail just
    yet and should call try_to_freeze() if woken up and cannot
    return immediately. This way all freezable tasks that happen
    to call request_firmware() right before freeze_processes() is
    started and lose the race for umhelper_sem with it will be
    frozen and will sleep until thaw_processes() unsets
    usermodehelper_disabled. [For the non-freezable callers of
    request_firmware() the race for umhelper_sem against
    freeze_processes() is unfortunately unavoidable.]

    Reported-by: Stephen Boyd
    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     
  • commit 1e73203cd1157a03facc41ffb54050f5b28e55bd upstream.

    The core suspend/hibernation code calls usermodehelper_disable() to
    avoid race conditions between the freezer and the starting of
    usermode helpers and each code path has to do that on its own.
    However, it is always called right before freeze_processes()
    and usermodehelper_enable() is always called right after
    thaw_processes(). For this reason, to avoid code duplication and
    to make the connection between usermodehelper_disable() and the
    freezer more visible, make freeze_processes() call it and remove the
    direct usermodehelper_disable() and usermodehelper_enable() calls
    from all suspend/hibernation code paths.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     
  • commit 7b5179ac14dbad945647ac9e76bbbf14ed9e0dbe upstream.

    There is no reason to call usermodehelper_disable() before creating
    memory bitmaps in hibernate() and software_resume(), so call it right
    before freeze_processes(), in accordance with the other suspend and
    hibernation code. Consequently, call usermodehelper_enable() right
    after the thawing of tasks rather than after freeing the memory
    bitmaps.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     
  • commit 9b78c1da60b3c62ccdd1509f0902ad19ceaf776b upstream.

    If firmware is requested asynchronously, by calling
    request_firmware_nowait(), there is no reason to fail the request
    (and warn the user) when the system is (presumably temporarily)
    unready to handle it (because user space is not available yet or
    frozen). For this reason, introduce an alternative routine for
    read-locking umhelper_sem, usermodehelper_read_lock_wait(), that
    will wait for usermodehelper_disabled to be unset (possibly with
    a timeout) and make request_firmware_work_func() use it instead of
    usermodehelper_read_trylock().

    Accordingly, modify request_firmware() so that it uses
    usermodehelper_read_trylock() to acquire umhelper_sem and remove
    the code related to that lock from _request_firmware().

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     
  • commit fe2e39d8782d885755139304d8dba0b3e5bfa878 upstream.

    Instead of two functions, read_lock_usermodehelper() and
    usermodehelper_is_disabled(), used in combination, introduce
    usermodehelper_read_trylock() that will only return with umhelper_sem
    held if usermodehelper_disabled is unset (and will return -EAGAIN
    otherwise) and make _request_firmware() use it.

    Rename read_unlock_usermodehelper() to
    usermodehelper_read_unlock() to follow the naming convention of the
    new function.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     
  • commit 12b5da349a8b94c9dbc3430a6bc42eabd9eaf50b upstream.

    When reading the trace file, the records of each of the per_cpu buffers
    are examined to find the next event to print out. At the point of looking
    at the event, the size of the event is recorded. But if the first event is
    chosen, the other events in the other CPU buffers will reset the event size
    that is stored in the iterator descriptor, causing the event size passed to
    the output functions to be incorrect.

    In most cases this is not a problem, but for the case of stack traces, it
    is. With the change to the stack tracing to record a dynamic number of
    back traces, the output depends on the size of the entry instead of the
    fixed 8 back traces. When the entry size is not correct, the back traces
    would not be fully printed.

    Note, reading from the per-cpu trace files were not affected.

    Reported-by: Thomas Gleixner
    Tested-by: Thomas Gleixner
    Signed-off-by: Steven Rostedt
    Signed-off-by: Greg Kroah-Hartman

    Steven Rostedt
     
  • commit 01de982abf8c9e10fc3089e10585cd2cc914bdab upstream.

    8 hex characters tell only half the tale for 64 bit CPUs,
    so use the appropriate length.

    Link: http://lkml.kernel.org/r/1332411501-8059-2-git-send-email-wolfgang.mauerer@siemens.com

    Signed-off-by: Wolfgang Mauerer
    Signed-off-by: Steven Rostedt
    Signed-off-by: Greg Kroah-Hartman

    Wolfgang Mauerer
     
  • commit f5cb92ac82d06cb583c1f66666314c5c0a4d7913 upstream.

    irq_move_masked_irq() checks the return code of
    chip->irq_set_affinity() only for 0, but IRQ_SET_MASK_OK_NOCOPY is
    also a valid return code, which is there to avoid a redundant copy of
    the cpumask. But in case of IRQ_SET_MASK_OK_NOCOPY we not only avoid
    the redundant copy, we also fail to adjust the thread affinity of an
    eventually threaded interrupt handler.

    Handle IRQ_SET_MASK_OK (==0) and IRQ_SET_MASK_OK_NOCOPY(==1) return
    values correctly by checking the valid return values seperately.

    Signed-off-by: Jiang Liu
    Cc: Jiang Liu
    Cc: Keping Chen
    Link: http://lkml.kernel.org/r/1333120296-13563-2-git-send-email-jiang.liu@huawei.com
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Jiang Liu
     

03 Apr, 2012

6 commits

  • commit f946eeb9313ff1470758e171a60fe7438a2ded3f upstream.

    Module size was limited to 64MB, this was legacy limitation due to vmalloc()
    which was removed a while ago.

    Limiting module size to 64MB is both pointless and affects real world use
    cases.

    Cc: Tim Abbott
    Signed-off-by: Sasha Levin
    Signed-off-by: Rusty Russell
    Signed-off-by: Greg Kroah-Hartman

    Sasha Levin
     
  • commit 05b4877f6a4f1ba4952d1222213d262bf8c132b7 upstream.

    If create_basic_memory_bitmaps() fails, usermodehelpers are not re-enabled
    before returning. Fix this. And while at it, reword the goto labels so that
    they look more meaningful.

    Signed-off-by: Srivatsa S. Bhat
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Srivatsa S. Bhat
     
  • commit 540b60e24f3f4781d80e47122f0c4486a03375b8 upstream.

    We do not want a bitwise AND between boolean operands

    Signed-off-by: Alexander Gordeev
    Cc: Oleg Nesterov
    Link: http://lkml.kernel.org/r/20120309135912.GA2114@dhcp-26-207.brq.redhat.com
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Alexander Gordeev
     
  • commit a09b659cd68c10ec6a30cb91ebd2c327fcd5bfe5 upstream.

    In 2008, commit 0c5d1eb77a8be ("genirq: record trigger type") modified the
    way set_irq_type() handles the 'no trigger' condition. However, this has
    an adverse effect on PCMCIA support on Intel StrongARM and probably PXA
    platforms.

    PCMCIA has several status signals on the socket which can trigger
    interrupts; some of these status signals depend on the card's mode
    (whether it is configured in memory or IO mode). For example, cards have
    a 'Ready/IRQ' signal: in memory mode, this provides an indication to
    PCMCIA that the card has finished its power up initialization. In IO
    mode, it provides the device interrupt signal. Other status signals
    switch between on-board battery status and loud speaker output.

    In classical PCMCIA implementations, where you have a specific socket
    controller, the controller provides a method to mask interrupts from the
    socket, and importantly ignore any state transitions on the pins which
    correspond with interrupts once masked. This masking prevents unwanted
    events caused by the removal and application of socket power being
    forwarded.

    However, on platforms where there is no socket controller, the PCMCIA
    status and interrupt signals are routed to standard edge-triggered GPIOs.
    These GPIOs can be configured to interrupt on rising edge, falling edge,
    or never. This is where the problems start.

    Edge triggered interrupts are required to record events while disabled via
    the usual methods of {free,request,disable,enable}_irq() to prevent
    problems with dropped interrupts (eg, the 8390 driver uses disable_irq()
    to defer the delivery of interrupts). As a result, these interfaces can
    not be used to implement the desired behaviour.

    The side effect of this is that if the 'Ready/IRQ' GPIO is disabled via
    disable_irq() on suspend, and enabled via enable_irq() after resume, we
    will record the state transitions caused by powering events as valid
    interrupts, and foward them to the card driver, which may attempt to
    access a card which is not powered up.

    This leads delays resume while drivers spin in their interrupt handlers,
    and complaints from drivers before they realize what's happened.

    Moreover, in the case of the 'Ready/IRQ' signal, this is requested and
    freed by the card driver itself; the PCMCIA core has no idea whether the
    interrupt is requested, and, therefore, whether a call to disable_irq()
    would be valid. (We tried this around 2.4.17 / 2.5.1 kernel era, and
    ended up throwing it out because of this problem.)

    Therefore, it was decided back in around 2002 to disable the edge
    triggering instead, resulting in all state transitions on the GPIO being
    ignored. That's what we actually need the hardware to do.

    The commit above changes this behaviour; it explicitly prevents the 'no
    trigger' state being selected.

    The reason that request_irq() does not accept the 'no trigger' state is
    for compatibility with existing drivers which do not provide their desired
    triggering configuration. The set_irq_type() function is 'new' and not
    used by non-trigger aware drivers.

    Therefore, revert this change, and restore previously working platforms
    back to their former state.

    Signed-off-by: Russell King
    Cc: linux@arm.linux.org.uk
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Russell King
     
  • commit a078c6d0e6288fad6d83fb6d5edd91ddb7b6ab33 upstream.

    'long secs' is passed as divisor to div_s64, which accepts a 32bit
    divisor. On 64bit machines that value is trimmed back from 8 bytes
    back to 4, causing a divide by zero when the number is bigger than
    (1 << 32) - 1 and all 32 lower bits are 0.

    Use div64_long() instead.

    Signed-off-by: Sasha Levin
    Cc: johnstul@us.ibm.com
    Link: http://lkml.kernel.org/r/1331829374-31543-2-git-send-email-levinsasha928@gmail.com
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Sasha Levin
     
  • commit 59263b513c11398cd66a52d4c5b2b118ce1e0359 upstream.

    Some of the newer futex PI opcodes do not check the cmpxchg enabled
    variable and call unconditionally into the handling functions. Cover
    all PI opcodes in a separate check.

    Signed-off-by: Thomas Gleixner
    Cc: Peter Zijlstra
    Cc: Darren Hart
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

16 Mar, 2012

1 commit

  • CAP_SYS_ADMIN is already overloaded left and right, so to have more
    fine-grained access control use CAP_SYS_RESOURCE here.

    The CAP_SYS_RESOUCE is chosen because this prctl option allows a current
    process to adjust some fields of memory map descriptor which rather
    represents what the process owns: pointers to code, data, stack
    segments, command line, auxiliary vector data and etc.

    Suggested-by: Michael Kerrisk
    Acked-by: Kees Cook
    Acked-by: Michael Kerrisk
    Cc: Pavel Emelyanov
    Cc: Tejun Heo
    Cc: Oleg Nesterov
    Cc: Paul Bolle
    Cc: KOSAKI Motohiro
    Signed-off-by: Cyrill Gorcunov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Cyrill Gorcunov
     

15 Mar, 2012

1 commit

  • Pull block fixes from Jens Axboe:
    "Been sitting on this for a while, but lets get this out the door.
    This fixes various important bugs for 3.3 final, along with a few more
    trivial ones. Please pull!"

    * 'for-linus' of git://git.kernel.dk/linux-block:
    block: fix ioc leak in put_io_context
    block, sx8: fix pointer math issue getting fw version
    Block: use a freezable workqueue for disk-event polling
    drivers/block/DAC960: fix -Wuninitialized warning
    drivers/block/DAC960: fix DAC960_V2_IOCTL_Opcode_T -Wenum-compare warning
    block: fix __blkdev_get and add_disk race condition
    block: Fix setting bio flags in drivers (sd_dif/floppy)
    block: Fix NULL pointer dereference in sd_revalidate_disk
    block: exit_io_context() should call elevator_exit_icq_fn()
    block: simplify ioc_release_fn()
    block: replace icq->changed with icq->flags

    Linus Torvalds
     

08 Mar, 2012

1 commit

  • This reverts commit 8f2f748b0656257153bcf0941df8d6060acc5ca6.

    It causes some odd regression that we have not figured out, and it's too
    late in the -rc series to try to figure it out now.

    As reported by Konstantin Khlebnikov, it causes consistent hangs on his
    laptop (Thinkpad x220: 2x cores + HT). They can be avoided by adding
    calls to "rebuild_sched_domains();" in cpuset_cpu_[in]active() for the
    CPU_{ONLINE/DOWN_FAILED/DOWN_PREPARE}_FROZEN cases, but it's not at all
    clear why, and it makes no sense.

    Konstantin's config doesn't even have CONFIG_CPUSETS enabled, just to
    make things even more interesting. So it's not the cpusets, it's just
    the scheduling domains.

    So until this is understood, revert.

    Bisected-reported-and-tested-by: Konstantin Khlebnikov
    Acked-by: Peter Zijlstra
    Acked-by: Ingo Molnar
    Acked-by: Srivatsa S. Bhat
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

07 Mar, 2012

1 commit

  • Xommit ac5637611(genirq: Unmask oneshot irqs when thread was not woken)
    fails to unmask when a !IRQ_ONESHOT threaded handler is handled by
    handle_level_irq.

    This happens because thread_mask is or'ed unconditionally in
    irq_wake_thread(), but for !IRQ_ONESHOT interrupts never cleared. So
    the check for !desc->thread_active fails and keeps the interrupt
    disabled.

    Keep the thread_mask zero for !IRQ_ONESHOT interrupts.

    Document the thread_mask magic while at it.

    Reported-and-tested-by: Sven Joachim
    Reported-and-tested-by: Stefan Lippers-Hollmann
    Cc: stable@vger.kernel.org
    Signed-off-by: Thomas Gleixner
    Signed-off-by: Linus Torvalds

    Thomas Gleixner
     

06 Mar, 2012

7 commits

  • check_hung_uninterruptible_tasks()->rcu_lock_break() introduced by
    "softlockup: check all tasks in hung_task" commit ce9dbe24 looks
    absolutely wrong.

    - rcu_lock_break() does put_task_struct(). If the task has exited
    it is not safe to even read its ->state, nothing protects this
    task_struct.

    - The TASK_DEAD checks are wrong too. Contrary to the comment, we
    can't use it to check if the task was unhashed. It can be unhashed
    without TASK_DEAD, or it can be valid with TASK_DEAD.

    For example, an autoreaping task can do release_task(current)
    long before it sets TASK_DEAD in do_exit().

    Or, a zombie task can have ->state == TASK_DEAD but release_task()
    was not called, and in this case we must not break the loop.

    Change this code to check pid_alive() instead, and do this before we drop
    the reference to the task_struct.

    Note: while_each_thread() under rcu_read_lock() is not really safe, it can
    livelock. This will be fixed later, but fortunately in this case the
    "max_count" logic saves us anyway.

    Signed-off-by: Oleg Nesterov
    Acked-by: Frederic Weisbecker
    Acked-by: Mandeep Singh Baines
    Acked-by: Paul E. McKenney
    Cc: Tetsuo Handa
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • Previously it was (ab)used by utrace. Then it was wrongly used by the
    scheduler code.

    Currently it is not used, kill it before it finds the new erroneous user.

    Signed-off-by: Oleg Nesterov
    Acked-by: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • Now that CLONE_VFORK is killable, coredump_wait() no longer needs
    complete_vfork_done(). zap_threads() should find and kill all tasks with
    the same ->mm, this includes our parent if ->vfork_done is set.

    mm_release() becomes the only caller, unexport complete_vfork_done().

    Signed-off-by: Oleg Nesterov
    Acked-by: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • Make vfork() killable.

    Change do_fork(CLONE_VFORK) to do wait_for_completion_killable(). If it
    fails we do not return to the user-mode and never touch the memory shared
    with our child.

    However, in this case we should clear child->vfork_done before return, we
    use task_lock() in do_fork()->wait_for_vfork_done() and
    complete_vfork_done() to serialize with each other.

    Note: now that we use task_lock() we don't really need completion, we
    could turn task->vfork_done into "task_struct *wake_up_me" but this needs
    some complications.

    NOTE: this and the next patches do not affect in-kernel users of
    CLONE_VFORK, kernel threads run with all signals ignored including
    SIGKILL/SIGSTOP.

    However this is obviously the user-visible change. Not only a fatal
    signal can kill the vforking parent, a sub-thread can do execve or
    exit_group() and kill the thread sleeping in vfork().

    Signed-off-by: Oleg Nesterov
    Acked-by: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • No functional changes.

    Move the clear-and-complete-vfork_done code into the new trivial helper,
    complete_vfork_done().

    Signed-off-by: Oleg Nesterov
    Acked-by: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • register_kprobe() aborts if the address of the new request falls in a
    prohibited area (such as ftrace pouch, __kprobes annotated functions,
    non-kernel text addresses, jump label text). We however don't return the
    right error on this abort, resulting in a silent failure - incorrect
    adding/reporting of kprobes ('perf probe do_fork+18' or 'perf probe
    mcount' for instance).

    In V2 we are incorporating Masami Hiramatsu's feedback.

    This patch fixes it by returning -EINVAL upon failure.

    While we are here, rename the label used for exit to be more appropriate.

    Signed-off-by: Ananth N Mavinakayanahalli
    Signed-off-by: Prashanth K Nageshappa
    Acked-by: Masami Hiramatsu
    Cc: Jason Baron
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Prashanth Nageshappa
     
  • Since commit 04c6862c055f ("kmsg_dump: add kmsg_dump() calls to the
    reboot, halt, poweroff and emergency_restart paths"), kmsg_dump() gets
    run on normal paths including poweroff and reboot.

    This is less than ideal given pstore implementations that can only
    represent single backtraces, since a reboot may overwrite a stored oops
    before it's been picked up by userspace. In addition, some pstore
    backends may have low performance and provide a significant delay in
    reboot as a result.

    This patch adds a printk.always_kmsg_dump kernel parameter (which can also
    be changed from userspace). Without it, the code will only be run on
    failure paths rather than on normal paths. The option can be enabled in
    environments where there's a desire to attempt to audit whether or not a
    reboot was cleanly requested or not.

    Signed-off-by: Matthew Garrett
    Acked-by: Seiji Aguchi
    Cc: Seiji Aguchi
    Cc: David Woodhouse
    Cc: Marco Stornelli
    Cc: Artem Bityutskiy
    Cc: KOSAKI Motohiro
    Cc: Vivek Goyal
    Cc: Don Zickus
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matthew Garrett
     

03 Mar, 2012

1 commit

  • …t-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

    Pulling latest branches from Ingo:

    * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    memblock: Fix size aligning of memblock_alloc_base_nid()

    * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    perf probe: Ensure offset provided is not greater than function length without DWARF info too
    perf tools: Ensure comm string is properly terminated
    perf probe: Ensure offset provided is not greater than function length
    perf evlist: Return first evsel for non-sample event on old kernel
    perf/hwbp: Fix a possible memory leak

    * 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    CPU hotplug, cpusets, suspend: Don't touch cpusets during suspend/resume

    Linus Torvalds
     

02 Mar, 2012

1 commit

  • This patch (as1519) fixes a bug in the block layer's disk-events
    polling. The polling is done by a work routine queued on the
    system_nrt_wq workqueue. Since that workqueue isn't freezable, the
    polling continues even in the middle of a system sleep transition.

    Obviously, polling a suspended drive for media changes and such isn't
    a good thing to do; in the case of USB mass-storage devices it can
    lead to real problems requiring device resets and even re-enumeration.

    The patch fixes things by creating a new system-wide, non-reentrant,
    freezable workqueue and using it for disk-events polling.

    Signed-off-by: Alan Stern
    CC:
    Acked-by: Tejun Heo
    Acked-by: Rafael J. Wysocki
    Signed-off-by: Jens Axboe

    Alan Stern
     

28 Feb, 2012

1 commit

  • If kzalloc() for TYPE_DATA failed on a given cpu, previous chunk
    of TYPE_INST will be leaked. Fix it.

    Thanks to Peter Zijlstra for suggesting this better solution. It
    should work as long as the initial value of the region is all
    0's and that's the case of static (per-cpu) memory allocation.

    Signed-off-by: Namhyung Kim
    Acked-by: Frederic Weisbecker
    Acked-by: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Arnaldo Carvalho de Melo
    Link: http://lkml.kernel.org/r/1330391978-28070-1-git-send-email-namhyung.kim@lge.com
    Signed-off-by: Ingo Molnar

    Namhyung Kim
     

27 Feb, 2012

3 commits

  • * 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    sched/events: Revert trace_sched_stat_sleeptime()

    Linus Torvalds
     
  • * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    genirq: Handle pending irqs in irq_startup()
    genirq: Unmask oneshot irqs when thread was not woken

    Linus Torvalds
     
  • Currently, during CPU hotplug, the cpuset callbacks modify the cpusets
    to reflect the state of the system, and this handling is asymmetric.
    That is, upon CPU offline, that CPU is removed from all cpusets. However
    when it comes back online, it is put back only to the root cpuset.

    This gives rise to a significant problem during suspend/resume. During
    suspend, we offline all non-boot cpus and during resume we online them back.
    Which means, after a resume, all cpusets (except the root cpuset) will be
    restricted to just one single CPU (the boot cpu). But the whole point of
    suspend/resume is to restore the system to a state which is as close as
    possible to how it was before suspend.

    So to fix this, don't touch cpusets during suspend/resume. That is, modify
    the cpuset-related CPU hotplug callback to just ignore CPU hotplug when it
    is initiated as part of the suspend/resume sequence.

    Reported-by: Prashanth Nageshappa
    Signed-off-by: Srivatsa S. Bhat
    Cc: Linus Torvalds
    Cc: Andrew Morton
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/4F460D7B.1020703@linux.vnet.ibm.com
    Signed-off-by: Peter Zijlstra
    Signed-off-by: Ingo Molnar

    Srivatsa S. Bhat
     

25 Feb, 2012

1 commit

  • This patch is intentionally incomplete to simplify the review.
    It ignores ep_unregister_pollwait() which plays with the same wqh.
    See the next change.

    epoll assumes that the EPOLL_CTL_ADD'ed file controls everything
    f_op->poll() needs. In particular it assumes that the wait queue
    can't go away until eventpoll_release(). This is not true in case
    of signalfd, the task which does EPOLL_CTL_ADD uses its ->sighand
    which is not connected to the file.

    This patch adds the special event, POLLFREE, currently only for
    epoll. It expects that init_poll_funcptr()'ed hook should do the
    necessary cleanup. Perhaps it should be defined as EPOLLFREE in
    eventpoll.

    __cleanup_sighand() is changed to do wake_up_poll(POLLFREE) if
    ->signalfd_wqh is not empty, we add the new signalfd_cleanup()
    helper.

    ep_poll_callback(POLLFREE) simply does list_del_init(task_list).
    This make this poll entry inconsistent, but we don't care. If you
    share epoll fd which contains our sigfd with another process you
    should blame yourself. signalfd is "really special". I simply do
    not know how we can define the "right" semantics if it used with
    epoll.

    The main problem is, epoll calls signalfd_poll() once to establish
    the connection with the wait queue, after that signalfd_poll(NULL)
    returns the different/inconsistent results depending on who does
    EPOLL_CTL_MOD/signalfd_read/etc. IOW: apart from sigmask, signalfd
    has nothing to do with the file, it works with the current thread.

    In short: this patch is the hack which tries to fix the symptoms.
    It also assumes that nobody can take tasklist_lock under epoll
    locks, this seems to be true.

    Note:

    - we do not have wake_up_all_poll() but wake_up_poll()
    is fine, poll/epoll doesn't use WQ_FLAG_EXCLUSIVE.

    - signalfd_cleanup() uses POLLHUP along with POLLFREE,
    we need a couple of simple changes in eventpoll.c to
    make sure it can't be "lost".

    Reported-by: Maxime Bizon
    Cc:
    Signed-off-by: Oleg Nesterov
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     

22 Feb, 2012

1 commit

  • Commit 1ac9bc69 ("sched/tracing: Add a new tracepoint for sleeptime")
    added a new sched:sched_stat_sleeptime tracepoint.

    It's broken: the first sample we get on a task might be bad because
    of a stale sleep_start value that wasn't reset at the last task switch
    because the tracepoint was not active.

    It also breaks the existing schedstat samples due to the side
    effects of:

    - se->statistics.sleep_start = 0;
    ...
    - se->statistics.block_start = 0;

    Nor do I see means to fix it without adding overhead to the scheduler
    fast path, which I'm not willing to for the sake of redundant
    instrumentation.

    Most importantly, sleep time information can already be constructed
    by tracing context switches and wakeups, and taking the timestamp
    difference between the schedule-out, the wakeup and the schedule-in.

    Signed-off-by: Peter Zijlstra
    Cc: Andrew Vagin
    Cc: Arnaldo Carvalho de Melo
    Cc: Frederic Weisbecker
    Link: http://lkml.kernel.org/n/tip-pc4c9qhl8q6vg3bs4j6k0rbd@git.kernel.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

21 Feb, 2012

1 commit

  • Assorted fixes, sat in -next for a week or so...

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    ocfs2: deal with wraparounds of i_nlink in ocfs2_rename()
    vfs: fix compat_sys_stat() handling of overflows in st_nlink
    quota: Fix deadlock with suspend and quotas
    vfs: Provide function to get superblock and wait for it to thaw
    vfs: fix panic in __d_lookup() with high dentry hashtable counts
    autofs4 - fix lockdep splat in autofs
    vfs: fix d_inode_lookup() dentry ref leak

    Linus Torvalds
     

15 Feb, 2012

2 commits

  • An interrupt might be pending when irq_startup() is called, but the
    startup code does not invoke the resend logic. In some cases this
    prevents the device from issuing another interrupt which renders the
    device non functional.

    Call the resend function in irq_startup() to keep things going.

    Reported-and-tested-by: Russell King
    Cc: stable@vger.kernel.org
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     
  • When the primary handler of an interrupt which is marked IRQ_ONESHOT
    returns IRQ_HANDLED or IRQ_NONE, then the interrupt thread is not
    woken and the unmask logic of the interrupt line is never
    invoked. This keeps the interrupt masked forever.

    This was not noticed as most IRQ_ONESHOT users wake the thread
    unconditionally (usually because they cannot access the underlying
    device from hard interrupt context). Though this behaviour was nowhere
    documented and not necessarily intentional. Some drivers can avoid the
    thread wakeup in certain cases and run into the situation where the
    interrupt line s kept masked.

    Handle it gracefully.

    Reported-and-tested-by: Lothar Wassmann
    Cc: stable@vger.kernel.org
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     

14 Feb, 2012

1 commit

  • When the number of dentry cache hash table entries gets too high
    (2147483648 entries), as happens by default on a 16TB system, use of a
    signed integer in the dcache_init() initialization loop prevents the
    dentry_hashtable from getting initialized, causing a panic in
    __d_lookup(). Fix this in dcache_init() and similar areas.

    Signed-off-by: Dimitri Sivanich
    Acked-by: David S. Miller
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Al Viro

    Dimitri Sivanich