13 Jan, 2012

2 commits


07 Jan, 2012

1 commit


20 Dec, 2011

1 commit


09 Dec, 2011

1 commit

  • Commit 4f2a8d3cf5e ("printk: Fix console_sem vs logbuf_lock unlock race")
    introduced another silly bug where we would want to acquire an already
    held lock. Avoid this.

    Reported-by: Andrea Arcangeli
    Signed-off-by: Peter Zijlstra
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Zijlstra
     

29 Nov, 2011

1 commit

  • Conflicts & resolutions:

    * arch/x86/xen/setup.c

    dc91c728fd "xen: allow extra memory to be in multiple regions"
    24aa07882b "memblock, x86: Replace memblock_x86_reserve/free..."

    conflicted on xen_add_extra_mem() updates. The resolution is
    trivial as the latter just want to replace
    memblock_x86_reserve_range() with memblock_reserve().

    * drivers/pci/intel-iommu.c

    166e9278a3f "x86/ia64: intel-iommu: move to drivers/iommu/"
    5dfe8660a3d "bootmem: Replace work_with_active_regions() with..."

    conflicted as the former moved the file under drivers/iommu/.
    Resolved by applying the chnages from the latter on the moved
    file.

    * mm/Kconfig

    6661672053a "memblock: add NO_BOOTMEM config symbol"
    c378ddd53f9 "memblock, x86: Make ARCH_DISCARD_MEMBLOCK a config option"

    conflicted trivially. Both added config options. Just
    letting both add their own options resolves the conflict.

    * mm/memblock.c

    d1f0ece6cdc "mm/memblock.c: small function definition fixes"
    ed7b56a799c "memblock: Remove memblock_memory_can_coalesce()"

    confliected. The former updates function removed by the
    latter. Resolution is trivial.

    Signed-off-by: Tejun Heo

    Tejun Heo
     

14 Nov, 2011

3 commits


01 Nov, 2011

4 commits

  • Currently log_prefix is testing that the first character of the log level
    and facility is less than '0' and greater than '9' (which is always
    false).

    Since the code being updated works because strtoul bombs out (endp isn't
    updated) and 0 is returned anyway just remove the check and don't change
    the behavior of the function.

    Signed-off-by: William Douglas
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    William Douglas
     
  • Currently log_prefix is testing that the first character of the log level
    and facility is less than '0' and greater than '9' (which is always
    false). It should be testing to see if the character less than '0' or
    greater than '9' instead. This patch makes that change.

    The code being changed worked because strtoul bombs out (endp isn't
    updated) and 0 is returned anyway.

    Signed-off-by: William Douglas
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    William Douglas
     
  • We are enabling some power features on medfield. To test suspend-2-RAM
    conveniently, we need turn on/off console_suspend_enabled frequently.

    Add a module parameter, so users could change it by:
    /sys/module/printk/parameters/console_suspend

    Signed-off-by: Yanmin Zhang
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Yanmin Zhang
     
  • We are enabling some power features on medfield. To test suspend-2-RAM
    conveniently, we need turn on/off ignore_loglevel frequently without
    rebooting.

    Add a module parameter, so users can change it by:
    /sys/module/printk/parameters/ignore_loglevel

    Signed-off-by: Yanmin Zhang
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Yanmin Zhang
     

13 Sep, 2011

1 commit

  • The logbuf_lock lock can be taken in atomic context and therefore
    cannot be preempted on -rt - annotate it.

    In mainline this change documents the low level nature of
    the lock - otherwise there's no functional difference. Lockdep
    and Sparse checking will work as usual.

    Signed-off-by: Thomas Gleixner
    [ merged and fixed it ]
    Signed-off-by: Ingo Molnar

    Thomas Gleixner
     

26 Aug, 2011

1 commit

  • It seems that 7bf693951a8e ("console: allow to retain boot console via
    boot option keep_bootcon") doesn't always achieve what it aims, as when
    printk_late_init() runs it unconditionally turns off all boot consoles.
    With this patch, I am able to see more messages on the boot console in
    KVM guests than I can without, when keep_bootcon is specified.

    I think it is appropriate for the relevant -stable trees. However, it's
    more of an annoyance than a serious bug (ideally you don't need to keep
    the boot console around as console handover should be working -- I was
    encountering a situation where the console handover wasn't working and
    not having the boot console available meant I couldn't see why).

    Signed-off-by: Nishanth Aravamudan
    Cc: David S. Miller
    Cc: Alan Cox
    Cc: Greg KH
    Acked-by: Fabio M. Di Nitto
    Cc: [2.6.39.x, 3.0.x]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nishanth Aravamudan
     

10 Aug, 2011

1 commit

  • syslog-ng versions before 3.3.0beta1 (2011-05-12) assume that
    CAP_SYS_ADMIN is sufficient to access syslog, so ever since CAP_SYSLOG
    was introduced (2010-11-25) they have triggered a warning.

    Commit ee24aebffb75 ("cap_syslog: accept CAP_SYS_ADMIN for now")
    improved matters a little by making syslog-ng work again, just keeping
    the WARN_ONCE(). But still, this is a warning that writes a stack trace
    we don't care about to syslog, sets a taint flag, and alarms sysadmins
    when nothing worse has happened than use of an old userspace with a
    recent kernel.

    Convert the WARN_ONCE to a printk_once to avoid that while continuing to
    give userspace developers a hint that this is an unwanted
    backward-compatibility feature and won't be around forever.

    Reported-by: Ralf Hildebrandt
    Reported-by: Niels
    Reported-by: Paweł Sikora
    Signed-off-by: Jonathan Nieder
    Liked-by: Gergely Nagy
    Acked-by: Serge Hallyn
    Acked-by: James Morris
    Signed-off-by: Linus Torvalds

    Jonathan Nieder
     

14 Jul, 2011

1 commit

  • 25818f0f28 (memblock: Make MEMBLOCK_ERROR be 0) thankfully made
    MEMBLOCK_ERROR 0 and there already are codes which expect error return
    to be 0. There's no point in keeping MEMBLOCK_ERROR around. End its
    misery.

    Signed-off-by: Tejun Heo
    Link: http://lkml.kernel.org/r/1310457490-3356-6-git-send-email-tj@kernel.org
    Cc: Yinghai Lu
    Cc: Benjamin Herrenschmidt
    Signed-off-by: H. Peter Anvin

    Tejun Heo
     

22 Jun, 2011

1 commit

  • Fix up the fallout from commit 0b5e1c5255 ("printk: Release
    console_sem after logbuf_lock").

    The reason for unlocking the console_sem under the logbuf_lock
    is that a concurrent printk() might fill up the buffer but fail
    to acquire the console sem, resulting in a missed write to the
    console until a subsequent console_sem acquire/release cycle.

    Signed-off-by: Peter Zijlstra
    Cc: efault@gmx.de
    Cc: Linus Torvalds
    Cc: Andrew Morton
    Link: http://lkml.kernel.org/r/1308734409.1022.14.camel@twins
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

07 Jun, 2011

1 commit

  • Release console_sem after unlocking the logbuf_lock so that we don't
    generate wakeups while holding logbuf_lock. This avoids some lock
    inversion troubles once we remove the lockdep_off bits between
    logbuf_lock and rq->lock (prints while holding rq->lock vs doing
    wakeups while holding logbuf_lock).

    There's of course still an actual deadlock where the printk()s under
    rq->lock will issue a wakeup from the up() call, but lockdep won't
    warn about that since semaphores are not tracked.

    Signed-off-by: Peter Zijlstra
    Cc: Linus Torvalds
    Cc: Andrew Morton
    Link: http://lkml.kernel.org/n/tip-j8swthl12u73h4znbvitljzd@git.kernel.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

25 May, 2011

1 commit

  • On larger systems, because of the numerous ACPI, Bootmem and EFI messages,
    the static log buffer overflows before the larger one specified by the
    log_buf_len param is allocated. Minimize the overflow by allocating the
    new log buffer as soon as possible.

    On kernels without memblock, a later call to setup_log_buf from
    kernel/init.c is the fallback.

    [akpm@linux-foundation.org: coding-style fixes]
    [akpm@linux-foundation.org: fix CONFIG_PRINTK=n build]
    Signed-off-by: Mike Travis
    Cc: Yinghai Lu
    Cc: "H. Peter Anvin"
    Cc: Jack Steiner
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Travis
     

23 Mar, 2011

3 commits

  • We've been burned by regressions/bugs which we later realized could have
    been triaged quicker if only we'd paid closer attention to dmesg. To make
    it easier to audit dmesg, we'd like to make DEFAULT_MESSAGE_LEVEL
    Kconfig-settable. That way we can set it to KERN_NOTICE and audit any
    messages
    Cc: Ingo Molnar
    Cc: Joe Perches
    Cc: Olof Johansson
    Cc: Randy Dunlap
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mandeep Singh Baines
     
  • For a platform with many consoles like:
    "console=tty1 console=ttyMFD2 console=ttyS0 earlyprintk=mrst"

    Each time when the non "selected_console" (tty1 and ttyMFD2 here) get
    registered, the existing kernel message will be printed out on registered
    consoles again, the "mrst" early console will get some same message for 3
    times, and "tty1" will get some for twice.

    As suggested by Andrew Morton, every time a new console is registered, it
    will be set as the "exclusive" console which will dump the already
    existing kernel messages.

    Signed-off-by: Feng Tang
    Cc: Greg KH
    Cc: Alan Cox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Feng Tang
     
  • On some architectures, the boot process involves de-registering the boot
    console (early boot), initialize drivers and then re-register the console.

    This mechanism introduces a window in which no printk can happen on the
    console and messages are buffered and then printed once the new console is
    available.

    If a kernel crashes during this window, all it's left on the boot console
    is "console [foo] enabled, bootconsole disabled" making debug of the crash
    rather 'interesting'.

    By adding "keep_bootcon" option, do not unregister the boot console, that
    will allow to printk everything that is happening up to the crash.

    The option is clearly meant only for debugging purposes as it introduces
    lots of duplicated info printed on console, but will make bug report from
    users easier as it doesn't require a kernel build just to figure out where
    we crash.

    Signed-off-by: Fabio M. Di Nitto
    Acked-by: David S. Miller
    Cc: Alan Cox
    Cc: Greg KH
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fabio M. Di Nitto
     

17 Mar, 2011

1 commit

  • …/gregkh/driver-core-2.6

    * 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (50 commits)
    printk: do not mangle valid userspace syslog prefixes
    efivars: Add Documentation
    efivars: Expose efivars functionality to external drivers.
    efivars: Parameterize operations.
    efivars: Split out variable registration
    efivars: parameterize efivars
    efivars: Make efivars bin_attributes dynamic
    efivars: move efivars globals into struct efivars
    drivers:misc: ti-st: fix debugging code
    kref: Fix typo in kref documentation
    UIO: add PRUSS UIO driver support
    Fix spelling mistakes in Documentation/zh_CN/SubmittingPatches
    firmware: Fix unaligned memory accesses in dmi-sysfs
    firmware: Add documentation for /sys/firmware/dmi
    firmware: Expose DMI type 15 System Event Log
    firmware: Break out system_event_log in dmi-sysfs
    firmware: Basic dmi-sysfs support
    firmware: Add DMI entry types to the headers
    Driver core: convert platform_{get,set}_drvdata to static inline functions
    Translate linux-2.6/Documentation/magic-number.txt into Chinese
    ...

    Linus Torvalds
     

14 Mar, 2011

1 commit

  • printk: do not mangle valid userspace syslog prefixes with /dev/kmsg

    Log messages passed to the kernel log by using /dev/kmsg or /dev/ttyprintk
    might contain a syslog prefix including the syslog facility value.

    This makes printk to recognize these headers properly, extract the real log
    level from it to use, and add the prefix as a proper prefix to the
    log buffer, instead of wrongly printing it as the log message text.

    Before:
    $ echo 'text' > /dev/kmsg
    $ dmesg -r
    [135159.594810] text

    After:
    $ echo 'text' > /dev/kmsg
    $ dmesg -r
    [ 50.750654] text

    Cc: Lennart Poettering
    Signed-off-by: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     

11 Feb, 2011

1 commit

  • 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
     

26 Jan, 2011

1 commit

  • The -rt patches change the console_semaphore to console_mutex. As a
    result, a quite large chunk of the patches changes all
    acquire/release_console_sem() to acquire/release_console_mutex()

    This commit makes things use more neutral function names which dont make
    implications about the underlying lock.

    The only real change is the return value of console_trylock which is
    inverted from try_acquire_console_sem()

    This patch also paves the way to switching console_sem from a semaphore to
    a mutex.

    [akpm@linux-foundation.org: coding-style fixes]
    [akpm@linux-foundation.org: make console_trylock return 1 on success, per Geert]
    Signed-off-by: Torben Hohn
    Cc: Thomas Gleixner
    Cc: Greg KH
    Cc: Ingo Molnar
    Cc: Geert Uytterhoeven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Torben Hohn
     

14 Jan, 2011

2 commits

  • dump_list_lock is used to protect dump_list in kmsg_dumper implementation,
    kmsg_dump() uses it to traverse dump_list too. But if there is contention
    on the lock, kmsg_dump() will fail, and the valuable kernel message may be
    lost.

    This patch solves this issue with RCU. Because kmsg_dump() only read the
    list, no lock is needed in kmsg_dump(). So that kmsg_dump() will never
    fail because of lock contention.

    Signed-off-by: Huang Ying
    Cc: "Paul E. McKenney"
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Huang Ying
     
  • We need to know the reason why system rebooted in support service.
    However, we can't inform our customers of the reason because final
    messages are lost on current Linux kernel.

    This patch improves the situation above because the final messages are
    saved by adding kmsg_dump() to reboot, halt, poweroff and
    emergency_restart path.

    Signed-off-by: Seiji Aguchi
    Cc: David Woodhouse
    Cc: Marco Stornelli
    Reviewed-by: Artem Bityutskiy
    Reviewed-by: KOSAKI Motohiro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Seiji Aguchi
     

10 Jan, 2011

1 commit


08 Jan, 2011

1 commit

  • * 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6: (36 commits)
    serial: apbuart: Fixup apbuart_console_init()
    TTY: Add tty ioctl to figure device node of the system console.
    tty: add 'active' sysfs attribute to tty0 and console device
    drivers: serial: apbuart: Handle OF failures gracefully
    Serial: Avoid unbalanced IRQ wake disable during resume
    tty: fix typos/errors in tty_driver.h comments
    pch_uart : fix warnings for 64bit compile
    8250: fix uninitialized FIFOs
    ip2: fix compiler warning on ip2main_pci_tbl
    specialix: fix compiler warning on specialix_pci_tbl
    rocket: fix compiler warning on rocket_pci_ids
    8250: add a UPIO_DWAPB32 for 32 bit accesses
    8250: use container_of() instead of casting
    serial: omap-serial: Add support for kernel debugger
    serial: fix pch_uart kconfig & build
    drivers: char: hvc: add arm JTAG DCC console support
    RS485 documentation: add 16C950 UART description
    serial: ifx6x60: fix memory leak
    serial: ifx6x60: free IRQ on error
    Serial: EG20T: add PCH_UART driver
    ...

    Fixed up conflicts in drivers/serial/apbuart.c with evil merge that
    makes the code look fairly sane (unlike either side).

    Linus Torvalds
     

17 Dec, 2010

1 commit

  • tty: add 'active' sysfs attribute to tty0 and console device

    Userspace can query the actual virtual console, and the configured
    console devices behind /dev/tt0 and /dev/console.

    The last entry in the list of devices is the active device, analog
    to the console= kernel command line option.

    The attribute supports poll(), which is raised when the virtual
    console is changed or /dev/console is reconfigured.

    Signed-off-by: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    index 0000000..b138b66

    Kay Sievers
     

09 Dec, 2010

2 commits

  • Eric Paris pointed out that it doesn't make sense to require
    both CAP_SYS_ADMIN and CAP_SYSLOG for certain syslog actions.
    So require CAP_SYSLOG, not CAP_SYS_ADMIN, when dmesg_restrict
    is set.

    (I'm also consolidating the now common error path)

    Signed-off-by: Serge E. Hallyn
    Acked-by: Eric Paris
    Acked-by: Kees Cook
    Signed-off-by: James Morris

    Serge E. Hallyn
     
  • __get_cpu_var() is a bit inefficient, lets use __this_cpu_read() and
    __this_cpu_write() to manipulate printk_pending.

    printk_needs_cpu(cpu) is called only for the current cpu :
    Use faster __this_cpu_read().

    Remove the redundant unlikely on (cpu_is_offline(cpu)) test:

    # size kernel/printk.o*
    text data bss dec hex filename
    9942 756 263488 274186 42f0a kernel/printk.o.new
    9990 756 263488 274234 42f3a kernel/printk.o.old

    Signed-off-by: Eric Dumazet
    Cc: Heiko Carstens
    Cc: H. Peter Anvin
    Cc: Christoph Lameter
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Eric Dumazet
     

29 Nov, 2010

1 commit

  • Privileged syslog operations currently require CAP_SYS_ADMIN. Split
    this off into a new CAP_SYSLOG privilege which we can sanely take away
    from a container through the capability bounding set.

    With this patch, an lxc container can be prevented from messing with
    the host's syslog (i.e. dmesg -c).

    Changelog: mar 12 2010: add selinux capability2:cap_syslog perm
    Changelog: nov 22 2010:
    . port to new kernel
    . add a WARN_ONCE if userspace isn't using CAP_SYSLOG

    Signed-off-by: Serge Hallyn
    Acked-by: Andrew G. Morgan
    Acked-By: Kees Cook
    Cc: James Morris
    Cc: Michael Kerrisk
    Cc: Stephen Smalley
    Cc: "Christopher J. PeBenito"
    Cc: Eric Paris
    Signed-off-by: James Morris

    Serge E. Hallyn
     

26 Nov, 2010

2 commits

  • This patch fixes a hang observed with 2.6.32 kernels where timers got enqueued
    on offline cpus.

    printk_needs_cpu() may return 1 if called on offline cpus. When a cpu gets
    offlined it schedules the idle process which, before killing its own cpu, will
    call tick_nohz_stop_sched_tick(). That function in turn will call
    printk_needs_cpu() in order to check if the local tick can be disabled. On
    offline cpus this function should naturally return 0 since regardless if the
    tick gets disabled or not the cpu will be dead short after. That is besides the
    fact that __cpu_disable() should already have made sure that no interrupts on
    the offlined cpu will be delivered anyway.

    In this case it prevents tick_nohz_stop_sched_tick() to call
    select_nohz_load_balancer(). No idea if that really is a problem. However what
    made me debug this is that on 2.6.32 the function get_nohz_load_balancer() is
    used within __mod_timer() to select a cpu on which a timer gets enqueued. If
    printk_needs_cpu() returns 1 then the nohz_load_balancer cpu doesn't get
    updated when a cpu gets offlined. It may contain the cpu number of an offline
    cpu. In turn timers get enqueued on an offline cpu and not very surprisingly
    they never expire and cause system hangs.

    This has been observed 2.6.32 kernels. On current kernels __mod_timer() uses
    get_nohz_timer_target() which doesn't have that problem. However there might be
    other problems because of the too early exit tick_nohz_stop_sched_tick() in
    case a cpu goes offline.

    Easiest way to fix this is just to test if the current cpu is offline and call
    printk_tick() directly which clears the condition.

    Alternatively I tried a cpu hotplug notifier which would clear the condition,
    however between calling the notifier function and printk_needs_cpu() something
    could have called printk() again and the problem is back again. This seems to
    be the safest fix.

    Signed-off-by: Heiko Carstens
    Signed-off-by: Peter Zijlstra
    Cc: stable@kernel.org
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Heiko Carstens
     
  • wake_up_klogd() may get called from preemptible context but uses
    __raw_get_cpu_var() to write to a per cpu variable. If it gets preempted
    between getting the address and writing to it, the cpu in question could be
    offline if the process gets scheduled back and hence writes to the per cpu data
    of an offline cpu.

    This buggy behaviour was introduced with fa33507a "printk: robustify
    printk, fix #2" which was supposed to fix a "using smp_processor_id() in
    preemptible" warning.

    Let's use this_cpu_write() instead which disables preemption and makes sure
    that the outlined scenario cannot happen.

    Signed-off-by: Heiko Carstens
    Acked-by: Eric Dumazet
    Signed-off-by: Peter Zijlstra
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Heiko Carstens
     

17 Nov, 2010

1 commit


16 Nov, 2010

1 commit

  • The addition of CONFIG_SECURITY_DMESG_RESTRICT resulted in a build
    failure when CONFIG_PRINTK=n. This is because the capabilities code
    which used the new option was built even though the variable in question
    didn't exist.

    The patch here fixes this by moving the capabilities checks out of the
    LSM and into the caller. All (known) LSMs should have been calling the
    capabilities hook already so it actually makes the code organization
    better to eliminate the hook altogether.

    Signed-off-by: Eric Paris
    Acked-by: James Morris
    Signed-off-by: Linus Torvalds

    Eric Paris
     

12 Nov, 2010

1 commit

  • The kernel syslog contains debugging information that is often useful
    during exploitation of other vulnerabilities, such as kernel heap
    addresses. Rather than futilely attempt to sanitize hundreds (or
    thousands) of printk statements and simultaneously cripple useful
    debugging functionality, it is far simpler to create an option that
    prevents unprivileged users from reading the syslog.

    This patch, loosely based on grsecurity's GRKERNSEC_DMESG, creates the
    dmesg_restrict sysctl. When set to "0", the default, no restrictions are
    enforced. When set to "1", only users with CAP_SYS_ADMIN can read the
    kernel syslog via dmesg(8) or other mechanisms.

    [akpm@linux-foundation.org: explain the config option in kernel.txt]
    Signed-off-by: Dan Rosenberg
    Acked-by: Ingo Molnar
    Acked-by: Eugene Teo
    Acked-by: Kees Cook
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dan Rosenberg