05 Mar, 2011

2 commits


03 Mar, 2011

1 commit

  • If we enable trace events to trace block actions, We use
    blk_fill_rwbs_rq to analyze the corresponding actions
    in request's cmd_flags, but we only choose the minor 2 bits
    from it, so most of other flags(e.g, REQ_SYNC) are missing.
    For example, with a sync write we get:
    write_test-2409 [001] 160.013869: block_rq_insert: 3,64 W 0 () 258135 + =
    8 [write_test]

    Since now we have integrated the flags of both bio and request,
    it is safe to pass rq->cmd_flags directly to blk_fill_rwbs and
    blk_fill_rwbs_rq isn't needed any more.

    With this patch, after a sync write we get:
    write_test-2417 [000] 226.603878: block_rq_insert: 3,64 WS 0 () 258135 +=
    8 [write_test]

    Signed-off-by: Tao Ma
    Acked-by: Jeff Moyer
    Signed-off-by: Jens Axboe

    Tao Ma
     

26 Feb, 2011

1 commit

  • When the per cpu timer is marked CLOCK_EVT_FEAT_C3STOP, then we only
    can switch into oneshot mode, when the backup broadcast device
    supports oneshot mode as well. Otherwise we would try to switch the
    broadcast device into an unsupported mode unconditionally. This went
    unnoticed so far as the current available broadcast devices support
    oneshot mode. Seth unearthed this problem while debugging and working
    around an hpet related BIOS wreckage.

    Add the necessary check to tick_is_oneshot_available().

    Reported-and-tested-by: Seth Forshee
    Signed-off-by: Thomas Gleixner
    LKML-Reference:
    Cc: stable@kernel.org # .21 ->

    Thomas Gleixner
     

23 Feb, 2011

2 commits


19 Feb, 2011

3 commits

  • With CONFIG_SHIRQ_DEBUG=y we call a newly installed interrupt handler
    in request_threaded_irq().

    The original implementation (commit a304e1b8) called the handler
    _BEFORE_ it was installed, but that caused problems with handlers
    calling disable_irq_nosync(). See commit 377bf1e4.

    It's braindead in the first place to call disable_irq_nosync in shared
    handlers, but ....

    Moving this call after we installed the handler looks innocent, but it
    is very subtle broken on SMP.

    Interrupt handlers rely on the fact, that the irq core prevents
    reentrancy.

    Now this debug call violates that promise because we run the handler
    w/o the IRQ_INPROGRESS protection - which we cannot apply here because
    that would result in a possibly forever masked interrupt line.

    A concurrent real hardware interrupt on a different CPU results in
    handler reentrancy and can lead to complete wreckage, which was
    unfortunately observed in reality and took a fricking long time to
    debug.

    Leave the code here for now. We want this debug feature, but that's
    not easy to fix. We really should get rid of those
    disable_irq_nosync() abusers and remove that function completely.

    Signed-off-by: Thomas Gleixner
    Cc: Anton Vorontsov
    Cc: David Woodhouse
    Cc: Arjan van de Ven
    Cc: stable@kernel.org # .28 -> .37

    Thomas Gleixner
     
  • Lars-Peter Clausen pointed out:

    I stumbled upon this while looking through the existing archs using
    SPARSE_IRQ. Even with SPARSE_IRQ the NR_IRQS is still the upper
    limit for the number of IRQs.

    Both PXA and MMP set NR_IRQS to IRQ_BOARD_START, with
    IRQ_BOARD_START being the number of IRQs used by the core.

    In various machine files the nr_irqs field of the ARM machine
    defintion struct is then set to "IRQ_BOARD_START + NR_BOARD_IRQS".

    As a result "nr_irqs" will greater then NR_IRQS which then again
    causes the "allocated_irqs" bitmap in the core irq code to be
    accessed beyond its size overwriting unrelated data.

    The core code really misses a sanity check there.

    This went unnoticed so far as by chance the compiler/linker places
    data behind that bitmap which gets initialized later on those affected
    platforms.

    So the obvious fix would be to add a sanity check in early_irq_init()
    and break all affected platforms. Though that check wants to be
    backported to stable as well, which will require to fix all known
    problematic platforms and probably some more yet not known ones as
    well. Lots of churn.

    A way simpler solution is to allocate a slightly larger bitmap and
    avoid the whole churn w/o breaking anything. Add a few warnings when
    an arch returns utter crap.

    Reported-by: Lars-Peter Clausen
    Signed-off-by: Thomas Gleixner
    Cc: stable@kernel.org # .37
    Cc: Haojian Zhuang
    Cc: Eric Miao
    Cc: Peter Zijlstra

    Thomas Gleixner
     
  • * 'fixes-2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq:
    workqueue: make sure MAYDAY_INITIAL_TIMEOUT is at least 2 jiffies long
    workqueue, freezer: unify spelling of 'freeze' + 'able' to 'freezable'
    workqueue: wake up a worker when a rescuer is leaving a gcwq

    Linus Torvalds
     

17 Feb, 2011

3 commits

  • Currently we return 0 in swsusp_alloc() when alloc_image_page() fails.
    Fix that. Also remove unneeded "error" variable since the only
    useful value of error is -ENOMEM.

    [rjw: Fixed up the changelog and changed subject.]

    Signed-off-by: Stanislaw Gruszka
    Cc: stable@kernel.org
    Signed-off-by: Rafael J. Wysocki

    Stanislaw Gruszka
     
  • MAYDAY_INITIAL_TIMEOUT is defined as HZ / 100 and depending on
    configuration may end up 0 or 1. Even when it's 1, depending on when
    the mayday timer is added in the current jiffy interval, it may expire
    way before a jiffy has passed.

    Make sure MAYDAY_INITIAL_TIMEOUT is at least two to guarantee that at
    least a full jiffy has passed before calling rescuers.

    Signed-off-by: Tejun Heo
    Reported-by: Ray Jui
    Cc: stable@kernel.org

    Tejun Heo
     
  • There are two spellings in use for 'freeze' + 'able' - 'freezable' and
    'freezeable'. The former is the more prominent one. The latter is
    mostly used by workqueue and in a few other odd places. Unify the
    spelling to 'freezable'.

    Signed-off-by: Tejun Heo
    Reported-by: Alan Stern
    Acked-by: "Rafael J. Wysocki"
    Acked-by: Greg Kroah-Hartman
    Acked-by: Dmitry Torokhov
    Cc: David Woodhouse
    Cc: Alex Dubov
    Cc: "David S. Miller"
    Cc: Steven Whitehouse

    Tejun Heo
     

16 Feb, 2011

3 commits

  • It was possible to call pmu::start() on an already running event. In
    particular this lead so some wreckage as the hrtimer events would
    re-initialize active timers.

    This was due to throttled events being activated again by scheduling.
    Scheduling in a context would add and force start events, resulting in
    running events with a possible throttle status. The next tick to hit
    that task will then try to unthrottle the event and call ->start() on
    an already running event.

    Reported-by: Jeff Moyer
    Cc:
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • …kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

    * 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    Revert "lockdep, timer: Fix del_timer_sync() annotation"

    * 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    timer debug: Hide kernel addresses via %pK in /proc/timer_list

    Linus Torvalds
     
  • …/git/tip/linux-2.6-tip

    * 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
    x86: Fix text_poke_smp_batch() deadlock
    perf tools: Fix thread_map event synthesizing in top and record
    watchdog, nmi: Lower the severity of error messages
    ARM: oprofile: Fix backtraces in timer mode
    oprofile: Fix usage of CONFIG_HW_PERF_EVENTS for oprofile_perf_init and friends

    Linus Torvalds
     

14 Feb, 2011

1 commit

  • After executing the matching works, a rescuer leaves the gcwq whether
    there are more pending works or not. This may decrease the
    concurrency level to zero and stall execution until a new work item is
    queued on the gcwq.

    Make rescuer wake up a regular worker when it leaves a gcwq if there
    are more works to execute, so that execution isn't stalled.

    Signed-off-by: Tejun Heo
    Reported-by: Ray Jui
    Cc: stable@kernel.org

    Tejun Heo
     

12 Feb, 2011

3 commits

  • In the continuing effort to avoid kernel addresses leaking to
    unprivileged users, this patch switches to %pK for
    /proc/timer_list reporting.

    Signed-off-by: Kees Cook
    Cc: John Stultz
    Cc: Dan Rosenberg
    Cc: Eugene Teo
    Cc: Linus Torvalds
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Kees Cook
     
  • …s/security-testing-2.6

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6:
    pci: use security_capable() when checking capablities during config space read
    security: add cred argument to security_capable()
    tpm_tis: Use timeouts returned from TPM

    Linus Torvalds
     
  • The wake_up_process() call in ptrace_detach() is spurious and not
    interlocked with the tracee state. IOW, the tracee could be running or
    sleeping in any place in the kernel by the time wake_up_process() is
    called. This can lead to the tracee waking up unexpectedly which can be
    dangerous.

    The wake_up is spurious and should be removed but for now reduce its
    toxicity by only waking up if the tracee is in TRACED or STOPPED state.

    This bug can possibly be used as an attack vector. I don't think it
    will take too much effort to come up with an attack which triggers oops
    somewhere. Most sleeps are wrapped in condition test loops and should
    be safe but we have quite a number of places where sleep and wakeup
    conditions are expected to be interlocked. Although the window of
    opportunity is tiny, ptrace can be used by non-privileged users and with
    some loading the window can definitely be extended and exploited.

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

    Tejun Heo
     

11 Feb, 2011

2 commits

  • Expand security_capable() to include cred, so that it can be usable in a
    wider range of call sites.

    Signed-off-by: Chris Wright
    Acked-by: Serge Hallyn
    Signed-off-by: James Morris

    Chris Wright
     
  • In commit ce6ada35bdf7 ("security: Define CAP_SYSLOG") Serge Hallyn
    introduced CAP_SYSLOG, but broke backwards compatibility by no longer
    accepting CAP_SYS_ADMIN as an override (it would cause a warning and
    then reject the operation).

    Re-instate CAP_SYS_ADMIN - but keeping the warning - as an acceptable
    capability until any legacy applications have been updated. There are
    apparently applications out there that drop all capabilities except for
    CAP_SYS_ADMIN in order to access the syslog.

    (This is a re-implementation of a patch by Serge, cleaning the logic up
    and making the code more readable)

    Acked-by: Serge Hallyn
    Reviewed-by: James Morris
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

10 Feb, 2011

2 commits

  • During boot if the hardlockup detector fails to initialize, it
    complains very loudly. Some failures should be expected under
    certain situations, ie no lapics, or resource in-use. Tone
    those error messages down a bit. Keep the rest at a high level.

    Reported-by: Paul Bolle
    Tested-by: Paul Bolle
    Signed-off-by: Don Zickus
    Cc: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Don Zickus
     
  • * 'for-linus' of git://git.kernel.dk/linux-2.6-block:
    cdrom: support devices that have check_events but not media_changed
    cfq-iosched: Don't wait if queue already has requests.
    blkio-throttle: Avoid calling blkiocg_lookup_group() for root group
    cfq: rename a function to give it more appropriate name
    cciss: make cciss_revalidate not loop through CISS_MAX_LUNS volumes unnecessarily.
    drivers/block/aoe/Makefile: replace the use of -objs with -y
    loop: queue_lock NULL pointer derefence in blk_throtl_exit
    drivers/block/Makefile: replace the use of -objs with -y
    blktrace: Don't output messages if NOTIFY isn't set.

    Linus Torvalds
     

08 Feb, 2011

3 commits

  • Both attempts at trying to allow softirq usage for
    del_timer_sync() failed (produced bogus warnings),
    so revert the commit for this release:

    f266a5110d45: lockdep, timer: Fix del_timer_sync() annotation

    and try again later.

    Reported-by: Borislav Petkov
    Signed-off-by: Peter Zijlstra
    Cc: Linus Torvalds
    Cc: Yong Zhang
    Cc: Thomas Gleixner
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • In prepare_kernel_cred() since 2.6.29, put_cred(new) is called without
    assigning new->usage when security_prepare_creds() returned an error. As a
    result, memory for new and refcount for new->{user,group_info,tgcred} are
    leaked because put_cred(new) won't call __put_cred() unless old->usage == 1.

    Fix these leaks by assigning new->usage (and new->subscribers which was added
    in 2.6.32) before calling security_prepare_creds().

    Signed-off-by: Tetsuo Handa
    Signed-off-by: David Howells
    Signed-off-by: Linus Torvalds

    Tetsuo Handa
     
  • In cred_alloc_blank() since 2.6.32, abort_creds(new) is called with
    new->security == NULL and new->magic == 0 when security_cred_alloc_blank()
    returns an error. As a result, BUG() will be triggered if SELinux is enabled
    or CONFIG_DEBUG_CREDENTIALS=y.

    If CONFIG_DEBUG_CREDENTIALS=y, BUG() is called from __invalid_creds() because
    cred->magic == 0. Failing that, BUG() is called from selinux_cred_free()
    because selinux_cred_free() is not expecting cred->security == NULL. This does
    not affect smack_cred_free(), tomoyo_cred_free() or apparmor_cred_free().

    Fix these bugs by

    (1) Set new->magic before calling security_cred_alloc_blank().

    (2) Handle null cred->security in creds_are_invalid() and selinux_cred_free().

    Signed-off-by: Tetsuo Handa
    Signed-off-by: David Howells
    Signed-off-by: Linus Torvalds

    Tetsuo Handa
     

07 Feb, 2011

1 commit


05 Feb, 2011

1 commit


04 Feb, 2011

4 commits


03 Feb, 2011

6 commits

  • Currently the syscall_meta structures for the syscall tracepoints are
    placed in the __syscall_metadata section, and at link time, the linker
    makes one large array of all these syscall metadata structures. On boot
    up, this array is read (much like the initcall sections) and the syscall
    data is processed.

    The problem is that there is no guarantee that gcc will place complex
    structures nicely together in an array format. Two structures in the
    same file may be placed awkwardly, because gcc has no clue that they
    are suppose to be in an array.

    A hack was used previous to force the alignment to 4, to pack the
    structures together. But this caused alignment issues with other
    architectures (sparc).

    Instead of packing the structures into an array, the structures' addresses
    are now put into the __syscall_metadata section. As pointers are always the
    natural alignment, gcc should always pack them tightly together
    (otherwise initcall, extable, etc would also fail).

    By having the pointers to the structures in the section, we can still
    iterate the trace_events without causing unnecessary alignment problems
    with other architectures, or depending on the current behaviour of
    gcc that will likely change in the future just to tick us kernel developers
    off a little more.

    The __syscall_metadata section is also moved into the .init.data section
    as it is now only needed at boot up.

    Suggested-by: David Miller
    Acked-by: David S. Miller
    Cc: Mathieu Desnoyers
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     
  • Make the tracepoints more robust, making them solid enough to handle compiler
    changes by not relying on anything based on compiler-specific behavior with
    respect to structure alignment. Implement an approach proposed by David Miller:
    use an array of const pointers to refer to the individual structures, and export
    this pointer array through the linker script rather than the structures per se.
    It will consume 32 extra bytes per tracepoint (24 for structure padding and 8
    for the pointers), but are less likely to break due to compiler changes.

    History:

    commit 7e066fb8 tracepoints: add DECLARE_TRACE() and DEFINE_TRACE()
    added the aligned(32) type and variable attribute to the tracepoint structures
    to deal with gcc happily aligning statically defined structures on 32-byte
    multiples.

    One attempt was to use a 8-byte alignment for tracepoint structures by applying
    both the variable and type attribute to tracepoint structures definitions and
    declarations. It worked fine with gcc 4.5.1, but broke with gcc 4.4.4 and 4.4.5.

    The reason is that the "aligned" attribute only specify the _minimum_ alignment
    for a structure, leaving both the compiler and the linker free to align on
    larger multiples. Because tracepoint.c expects the structures to be placed as an
    array within each section, up-alignment cause NULL-pointer exceptions due to the
    extra unexpected padding.

    (this patch applies on top of -tip)

    Signed-off-by: Mathieu Desnoyers
    Acked-by: David S. Miller
    LKML-Reference:
    CC: Frederic Weisbecker
    CC: Ingo Molnar
    CC: Thomas Gleixner
    CC: Andrew Morton
    CC: Peter Zijlstra
    CC: Rusty Russell
    Signed-off-by: Steven Rostedt

    Mathieu Desnoyers
     
  • cpu_stopper_thread()
    migration_cpu_stop()
    __migrate_task()
    deactivate_task()
    dequeue_task()
    dequeue_task_rq()
    update_curr_rt()

    Will call update_curr_rt() on rq->curr, which at that time is
    rq->stop. The problem is that rq->stop.prio matches an RT prio and
    thus falsely assumes its a rt_sched_class task.

    Reported-Debuged-Tested-Acked-by: Thomas Gleixner
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Cc: stable@kernel.org # .37
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • It is quite possible for the event to have been disabled between
    perf_event_read() sending the IPI and the CPU servicing the IPI and
    calling __perf_event_read(), hence revalidate the state.

    Reported-by: Stephane Eranian
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • Currently the trace_event structures are placed in the _ftrace_events
    section, and at link time, the linker makes one large array of all
    the trace_event structures. On boot up, this array is read (much like
    the initcall sections) and the events are processed.

    The problem is that there is no guarantee that gcc will place complex
    structures nicely together in an array format. Two structures in the
    same file may be placed awkwardly, because gcc has no clue that they
    are suppose to be in an array.

    A hack was used previous to force the alignment to 4, to pack the
    structures together. But this caused alignment issues with other
    architectures (sparc).

    Instead of packing the structures into an array, the structures' addresses
    are now put into the _ftrace_event section. As pointers are always the
    natural alignment, gcc should always pack them tightly together
    (otherwise initcall, extable, etc would also fail).

    By having the pointers to the structures in the section, we can still
    iterate the trace_events without causing unnecessary alignment problems
    with other architectures, or depending on the current behaviour of
    gcc that will likely change in the future just to tick us kernel developers
    off a little more.

    The _ftrace_event section is also moved into the .init.data section
    as it is now only needed at boot up.

    Suggested-by: David Miller
    Cc: Mathieu Desnoyers
    Acked-by: David S. Miller
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     
  • move_native_irq() masks and unmasks the interrupt line
    unconditionally, but the interrupt line might be masked due to a
    threaded oneshot handler in progress. Unmasking the line in that case
    can lead to interrupt storms. Observed on PREEMPT_RT.

    Originally-from: Ingo Molnar
    Signed-off-by: Thomas Gleixner
    Cc: stable@kernel.org

    Thomas Gleixner
     

31 Jan, 2011

2 commits