08 Oct, 2016

1 commit

  • Currently, when min/max are nested within themselves, sparse will warn:

    warning: symbol '_min1' shadows an earlier one
    originally declared here
    warning: symbol '_min1' shadows an earlier one
    originally declared here
    warning: symbol '_min2' shadows an earlier one
    originally declared here

    This also immediately happens when min3() or max3() are used.

    Since sparse implements __COUNTER__, we can use __UNIQUE_ID() to
    generate unique variable names, avoiding this.

    Link: http://lkml.kernel.org/r/1471519773-29882-1-git-send-email-johannes@sipsolutions.net
    Signed-off-by: Johannes Berg
    Cc: Jens Axboe
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Johannes Berg
     

22 Sep, 2016

1 commit

  • Oleg noted that by making do_exit() use __schedule() for the TASK_DEAD
    context switch, we can avoid the TASK_DEAD special case currently in
    __schedule() because that avoids the extra preempt_disable() from
    schedule().

    In order to facilitate this, create a do_task_dead() helper which we
    place in the scheduler code, such that it can access __schedule().

    Also add some __noreturn annotations to the functions, there's no
    coming back from do_exit().

    Suggested-by: Oleg Nesterov
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Cheng Chao
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: akpm@linux-foundation.org
    Cc: chris@chris-wilson.co.uk
    Cc: tj@kernel.org
    Link: http://lkml.kernel.org/r/20160913163729.GB5012@twins.programming.kicks-ass.net
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

03 Aug, 2016

1 commit

  • kernel.h header doesn't directly use dynamic debug, instead we can
    include it in module.c (which used it via kernel.h). printk.h only uses
    it if CONFIG_DYNAMIC_DEBUG is on, changing the inclusion to only happen
    in that case.

    Link: http://lkml.kernel.org/r/1468429793-16917-1-git-send-email-luisbg@osg.samsung.com
    [luisbg@osg.samsung.com: include dynamic_debug.h in drb_int.h]
    Link: http://lkml.kernel.org/r/1468447828-18558-2-git-send-email-luisbg@osg.samsung.com
    Signed-off-by: Luis de Bethencourt
    Cc: Rusty Russell
    Cc: Hidehiro Kawai
    Cc: Borislav Petkov
    Cc: Michal Nazarewicz
    Cc: Rasmus Villemoes
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Luis de Bethencourt
     

16 Jun, 2016

1 commit

  • It is not always easy to determine the cause of an RCU stall just by
    analysing the RCU stall messages, mainly when the problem is caused
    by the indirect starvation of rcu threads. For example, when preempt_rcu
    is not awakened due to the starvation of a timer softirq.

    We have been hard coding panic() in the RCU stall functions for
    some time while testing the kernel-rt. But this is not possible in
    some scenarios, like when supporting customers.

    This patch implements the sysctl kernel.panic_on_rcu_stall. If
    set to 1, the system will panic() when an RCU stall takes place,
    enabling the capture of a vmcore. The vmcore provides a way to analyze
    all kernel/tasks states, helping out to point to the culprit and the
    solution for the stall.

    The kernel.panic_on_rcu_stall sysctl is disabled by default.

    Changes from v1:
    - Fixed a typo in the git log
    - The if(sysctl_panic_on_rcu_stall) panic() is in a static function
    - Fixed the CONFIG_TINY_RCU compilation issue
    - The var sysctl_panic_on_rcu_stall is now __read_mostly

    Cc: Jonathan Corbet
    Cc: "Paul E. McKenney"
    Cc: Josh Triplett
    Cc: Steven Rostedt
    Cc: Mathieu Desnoyers
    Cc: Lai Jiangshan
    Acked-by: Christian Borntraeger
    Reviewed-by: Josh Triplett
    Reviewed-by: Arnaldo Carvalho de Melo
    Tested-by: "Luis Claudio R. Goncalves"
    Signed-off-by: Daniel Bristot de Oliveira
    Signed-off-by: Paul E. McKenney

    Daniel Bristot de Oliveira
     

21 May, 2016

1 commit

  • Pull staging and IIO driver updates from Greg KH:
    "Here's the big staging and iio driver update for 4.7-rc1.

    I think we almost broke even with this release, only adding a few more
    lines than we removed, which isn't bad overall given that there's a
    bunch of new iio drivers added.

    The Lustre developers seem to have woken up from their sleep and have
    been doing a great job in cleaning up the code and pruning unused or
    old cruft, the filesystem is almost readable :)

    Other than that, just a lot of basic coding style cleanups in the
    churn. All have been in linux-next for a while with no reported
    issues"

    * tag 'staging-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (938 commits)
    Staging: emxx_udc: emxx_udc: fixed coding style issue
    staging/gdm724x: fix "alignment should match open parenthesis" issues
    staging/gdm724x: Fix avoid CamelCase
    staging: unisys: rename misleading var ii with frag
    staging: unisys: visorhba: switch success handling to error handling
    staging: unisys: visorhba: main path needs to flow down the left margin
    staging: unisys: visorinput: handle_locking_key() simplifications
    staging: unisys: visorhba: fail gracefully for thread creation failures
    staging: unisys: visornic: comment restructuring and removing bad diction
    staging: unisys: fix format string %Lx to %llx for u64
    staging: unisys: remove unused struct members
    staging: unisys: visorchannel: correct variable misspelling
    staging: unisys: visorhba: replace functionlike macro with function
    staging: dgnc: Need to check for NULL of ch
    staging: dgnc: remove redundant condition check
    staging: dgnc: fix 'line over 80 characters'
    staging: dgnc: clean up the dgnc_get_modem_info()
    staging: lustre: lnet: enable configuration per NI interface
    staging: lustre: o2iblnd: properly set ibr_why
    staging: lustre: o2iblnd: remove last of kiblnd_tunables_fini
    ...

    Linus Torvalds
     

20 May, 2016

1 commit

  • Attach the malloc attribute to a few allocation functions. This helps
    gcc generate better code by telling it that the return value doesn't
    alias any existing pointers (which is even more valuable given the
    pessimizations implied by -fno-strict-aliasing).

    A simple example of what this allows gcc to do can be seen by looking at
    the last part of drm_atomic_helper_plane_reset:

    plane->state = kzalloc(sizeof(*plane->state), GFP_KERNEL);

    if (plane->state) {
    plane->state->plane = plane;
    plane->state->rotation = BIT(DRM_ROTATE_0);
    }

    which compiles to

    e8 99 bf d6 ff callq ffffffff8116d540
    48 85 c0 test %rax,%rax
    48 89 83 40 02 00 00 mov %rax,0x240(%rbx)
    74 11 je ffffffff814015c4
    48 89 18 mov %rbx,(%rax)
    48 8b 83 40 02 00 00 mov 0x240(%rbx),%rax [*]
    c7 40 40 01 00 00 00 movl $0x1,0x40(%rax)

    With this patch applied, the instruction at [*] is elided, since the
    store to plane->state->plane is known to not alter the value of
    plane->state.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Rasmus Villemoes
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: David Rientjes
    Cc: Joonsoo Kim
    Cc: Andi Kleen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     

30 Apr, 2016

1 commit

  • This function had copies in 3 different files. Unify them in kernel.h.

    Cc: Joe Perches
    Cc: Andrew Morton
    Cc: David Airlie
    Cc: Daniel Vetter
    Cc: Rob Clark
    Signed-off-by: Gustavo Padovan
    Acked-by: Daniel Vetter [drm/i915/]
    Acked-by: Rob Clark [drm/msm/]
    Acked-by: Lucas Stach [drm/etinav/]
    Acked-by: Maarten Lankhorst
    Signed-off-by: Greg Kroah-Hartman

    Gustavo Padovan
     

25 Mar, 2016

1 commit

  • Pull tracing updates from Steven Rostedt:
    "Nothing major this round. Mostly small clean ups and fixes.

    Some visible changes:

    - A new flag was added to distinguish traces done in NMI context.

    - Preempt tracer now shows functions where preemption is disabled but
    interrupts are still enabled.

    Other notes:

    - Updates were done to function tracing to allow better performance
    with perf.

    - Infrastructure code has been added to allow for a new histogram
    feature for recording live trace event histograms that can be
    configured by simple user commands. The feature itself was just
    finished, but needs a round in linux-next before being pulled.

    This only includes some infrastructure changes that will be needed"

    * tag 'trace-v4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (22 commits)
    tracing: Record and show NMI state
    tracing: Fix trace_printk() to print when not using bprintk()
    tracing: Remove redundant reset per-CPU buff in irqsoff tracer
    x86: ftrace: Fix the misleading comment for arch/x86/kernel/ftrace.c
    tracing: Fix crash from reading trace_pipe with sendfile
    tracing: Have preempt(irqs)off trace preempt disabled functions
    tracing: Fix return while holding a lock in register_tracer()
    ftrace: Use kasprintf() in ftrace_profile_tracefs()
    ftrace: Update dynamic ftrace calls only if necessary
    ftrace: Make ftrace_hash_rec_enable return update bool
    tracing: Fix typoes in code comment and printk in trace_nop.c
    tracing, writeback: Replace cgroup path to cgroup ino
    tracing: Use flags instead of bool in trigger structure
    tracing: Add an unreg_all() callback to trigger commands
    tracing: Add needs_rec flag to event triggers
    tracing: Add a per-event-trigger 'paused' field
    tracing: Add get_syscall_name()
    tracing: Add event record param to trigger_ops.func()
    tracing: Make event trigger functions available
    tracing: Make ftrace_event_field checking functions available
    ...

    Linus Torvalds
     

23 Mar, 2016

2 commits

  • Commit 1717f2096b54 ("panic, x86: Fix re-entrance problem due to panic
    on NMI") and commit 58c5661f2144 ("panic, x86: Allow CPUs to save
    registers even if looping in NMI context") introduced nmi_panic() which
    prevents concurrent/recursive execution of panic(). It also saves
    registers for the crash dump on x86.

    However, there are some cases where NMI handlers still use panic().
    This patch set partially replaces them with nmi_panic() in those cases.

    Even this patchset is applied, some NMI or similar handlers (e.g. MCE
    handler) continue to use panic(). This is because I can't test them
    well and actual problems won't happen. For example, the possibility
    that normal panic and panic on MCE happen simultaneously is very low.

    This patch (of 3):

    Convert nmi_panic() to a proper function and export it instead of
    exporting internal implementation details to modules, for obvious
    reasons.

    Signed-off-by: Hidehiro Kawai
    Acked-by: Borislav Petkov
    Acked-by: Michal Nazarewicz
    Cc: Michal Hocko
    Cc: Rasmus Villemoes
    Cc: Nicolas Iooss
    Cc: Javi Merino
    Cc: Gobinda Charan Maji
    Cc: "Steven Rostedt (Red Hat)"
    Cc: Thomas Gleixner
    Cc: Vitaly Kuznetsov
    Cc: HATAYAMA Daisuke
    Cc: Tejun Heo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hidehiro Kawai
     
  • The trace_printk() code will allocate extra buffers if the compile detects
    that a trace_printk() is used. To do this, the format of the trace_printk()
    is saved to the __trace_printk_fmt section, and if that section is bigger
    than zero, the buffers are allocated (along with a message that this has
    happened).

    If trace_printk() uses a format that is not a constant, and thus something
    not guaranteed to be around when the print happens, the compiler optimizes
    the fmt out, as it is not used, and the __trace_printk_fmt section is not
    filled. This means the kernel will not allocate the special buffers needed
    for the trace_printk() and the trace_printk() will not write anything to the
    tracing buffer.

    Adding a "__used" to the variable in the __trace_printk_fmt section will
    keep it around, even though it is set to NULL. This will keep the string
    from being printed in the debugfs/tracing/printk_formats section as it is
    not needed.

    Reported-by: Vlastimil Babka
    Fixes: 07d777fe8c398 "tracing: Add percpu buffers for trace_printk()"
    Cc: stable@vger.kernel.org # v3.5+
    Signed-off-by: Steven Rostedt

    Steven Rostedt (Red Hat)
     

20 Mar, 2016

1 commit

  • Pull networking updates from David Miller:
    "Highlights:

    1) Support more Realtek wireless chips, from Jes Sorenson.

    2) New BPF types for per-cpu hash and arrap maps, from Alexei
    Starovoitov.

    3) Make several TCP sysctls per-namespace, from Nikolay Borisov.

    4) Allow the use of SO_REUSEPORT in order to do per-thread processing
    of incoming TCP/UDP connections. The muxing can be done using a
    BPF program which hashes the incoming packet. From Craig Gallek.

    5) Add a multiplexer for TCP streams, to provide a messaged based
    interface. BPF programs can be used to determine the message
    boundaries. From Tom Herbert.

    6) Add 802.1AE MACSEC support, from Sabrina Dubroca.

    7) Avoid factorial complexity when taking down an inetdev interface
    with lots of configured addresses. We were doing things like
    traversing the entire address less for each address removed, and
    flushing the entire netfilter conntrack table for every address as
    well.

    8) Add and use SKB bulk free infrastructure, from Jesper Brouer.

    9) Allow offloading u32 classifiers to hardware, and implement for
    ixgbe, from John Fastabend.

    10) Allow configuring IRQ coalescing parameters on a per-queue basis,
    from Kan Liang.

    11) Extend ethtool so that larger link mode masks can be supported.
    From David Decotigny.

    12) Introduce devlink, which can be used to configure port link types
    (ethernet vs Infiniband, etc.), port splitting, and switch device
    level attributes as a whole. From Jiri Pirko.

    13) Hardware offload support for flower classifiers, from Amir Vadai.

    14) Add "Local Checksum Offload". Basically, for a tunneled packet
    the checksum of the outer header is 'constant' (because with the
    checksum field filled into the inner protocol header, the payload
    of the outer frame checksums to 'zero'), and we can take advantage
    of that in various ways. From Edward Cree"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1548 commits)
    bonding: fix bond_get_stats()
    net: bcmgenet: fix dma api length mismatch
    net/mlx4_core: Fix backward compatibility on VFs
    phy: mdio-thunder: Fix some Kconfig typos
    lan78xx: add ndo_get_stats64
    lan78xx: handle statistics counter rollover
    RDS: TCP: Remove unused constant
    RDS: TCP: Add sysctl tunables for sndbuf/rcvbuf on rds-tcp socket
    net: smc911x: convert pxa dma to dmaengine
    team: remove duplicate set of flag IFF_MULTICAST
    bonding: remove duplicate set of flag IFF_MULTICAST
    net: fix a comment typo
    ethernet: micrel: fix some error codes
    ip_tunnels, bpf: define IP_TUNNEL_OPTS_MAX and use it
    bpf, dst: add and use dst_tclassid helper
    bpf: make skb->tc_classid also readable
    net: mvneta: bm: clarify dependencies
    cls_bpf: reset class and reuse major in da
    ldmvsw: Checkpatch sunvnet.c and sunvnet_common.c
    ldmvsw: Add ldmvsw.c driver code
    ...

    Linus Torvalds
     

18 Mar, 2016

1 commit

  • Create the kstrtobool_from_user() helper and move strtobool() logic into
    the new kstrtobool() (matching all the other kstrto* functions).
    Provides an inline wrapper for existing strtobool() callers.

    Signed-off-by: Kees Cook
    Cc: Joe Perches
    Cc: Andy Shevchenko
    Cc: Rasmus Villemoes
    Cc: Daniel Borkmann
    Cc: Amitkumar Karwar
    Cc: Nishant Sarmukadam
    Cc: Kalle Valo
    Cc: Steve French
    Cc: Michael Ellerman
    Cc: Heiko Carstens
    Cc: Martin Schwidefsky
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kees Cook
     

05 Mar, 2016

1 commit

  • DIV_ROUND_UP is defined in linux/kernel.h only for the kernel.
    When ethtool.h is included by a userland app, we got the following error:

    include/linux/ethtool.h:1218:8: error: variably modified 'queue_mask' at file scope
    __u32 queue_mask[DIV_ROUND_UP(MAX_NUM_QUEUE, 32)];
    ^

    Let's add a common definition in uapi and use it everywhere.

    Fixes: ac2c7ad0e5d6 ("net/ethtool: introduce a new ioctl for per queue setting")
    CC: Kan Liang
    Suggested-by: Ben Hutchings
    Signed-off-by: Nicolas Dichtel
    Signed-off-by: David S. Miller

    Nicolas Dichtel
     

17 Jan, 2016

1 commit

  • Rewrite abs() so that its return type does not depend on the
    architecture and no unexpected type conversion happen inside of it. The
    only conversion is from unsigned to signed type. char is left as a
    return type but treated as a signed type regradless of it's actual
    signedness.

    With the old version, int arguments were promoted to long and depending
    on architecture a long argument might result in s64 or long return type
    (which may or may not be the same).

    This came after some back and forth with Nicolas. The current macro has
    different return type (for the same input type) depending on
    architecture which might be midly iritating.

    An alternative version would promote to int like so:

    #define abs(x) __abs_choose_expr(x, long long, \
    __abs_choose_expr(x, long, \
    __builtin_choose_expr( \
    sizeof(x)
    Reviewed-by: Nicolas Pitre
    Cc: Srinivas Pandruvada
    Cc: Wey-Yi Guy
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michal Nazarewicz
     

19 Dec, 2015

2 commits

  • Currently, kdump_nmi_shootdown_cpus(), a subroutine of crash_kexec(),
    sends an NMI IPI to CPUs which haven't called panic() to stop them,
    save their register information and do some cleanups for crash dumping.
    However, if such a CPU is infinitely looping in NMI context, we fail to
    save its register information into the crash dump.

    For example, this can happen when unknown NMIs are broadcast to all
    CPUs as follows:

    CPU 0 CPU 1
    =========================== ==========================
    receive an unknown NMI
    unknown_nmi_error()
    panic() receive an unknown NMI
    spin_trylock(&panic_lock) unknown_nmi_error()
    crash_kexec() panic()
    spin_trylock(&panic_lock)
    panic_smp_self_stop()
    infinite loop
    kdump_nmi_shootdown_cpus()
    issue NMI IPI -----------> blocked until IRET
    infinite loop...

    Here, since CPU 1 is in NMI context, the second NMI from CPU 0 is
    blocked until CPU 1 executes IRET. However, CPU 1 never executes IRET,
    so the NMI is not handled and the callback function to save registers is
    never called.

    In practice, this can happen on some servers which broadcast NMIs to all
    CPUs when the NMI button is pushed.

    To save registers in this case, we need to:

    a) Return from NMI handler instead of looping infinitely
    or
    b) Call the callback function directly from the infinite loop

    Inherently, a) is risky because NMI is also used to prevent corrupted
    data from being propagated to devices. So, we chose b).

    This patch does the following:

    1. Move the infinite looping of CPUs which haven't called panic() in NMI
    context (actually done by panic_smp_self_stop()) outside of panic() to
    enable us to refer pt_regs. Please note that panic_smp_self_stop() is
    still used for normal context.

    2. Call a callback of kdump_nmi_shootdown_cpus() directly to save
    registers and do some cleanups after setting waiting_for_crash_ipi which
    is used for counting down the number of CPUs which handled the callback

    Signed-off-by: Hidehiro Kawai
    Acked-by: Michal Hocko
    Cc: Aaron Tomlin
    Cc: Andrew Morton
    Cc: Andy Lutomirski
    Cc: Baoquan He
    Cc: Chris Metcalf
    Cc: Dave Young
    Cc: David Hildenbrand
    Cc: Don Zickus
    Cc: Eric Biederman
    Cc: Frederic Weisbecker
    Cc: Gobinda Charan Maji
    Cc: HATAYAMA Daisuke
    Cc: Hidehiro Kawai
    Cc: "H. Peter Anvin"
    Cc: Ingo Molnar
    Cc: Javi Merino
    Cc: Jiang Liu
    Cc: Jonathan Corbet
    Cc: kexec@lists.infradead.org
    Cc: linux-doc@vger.kernel.org
    Cc: lkml
    Cc: Masami Hiramatsu
    Cc: Michal Nazarewicz
    Cc: Nicolas Iooss
    Cc: Oleg Nesterov
    Cc: Peter Zijlstra
    Cc: Prarit Bhargava
    Cc: Rasmus Villemoes
    Cc: Seth Jennings
    Cc: Stefan Lippers-Hollmann
    Cc: Steven Rostedt
    Cc: Thomas Gleixner
    Cc: Ulrich Obergfell
    Cc: Vitaly Kuznetsov
    Cc: Vivek Goyal
    Cc: Yasuaki Ishimatsu
    Link: http://lkml.kernel.org/r/20151210014628.25437.75256.stgit@softrs
    [ Cleanup comments, fixup formatting. ]
    Signed-off-by: Borislav Petkov
    Signed-off-by: Thomas Gleixner

    Hidehiro Kawai
     
  • If panic on NMI happens just after panic() on the same CPU, panic() is
    recursively called. Kernel stalls, as a result, after failing to acquire
    panic_lock.

    To avoid this problem, don't call panic() in NMI context if we've
    already entered panic().

    For that, introduce nmi_panic() macro to reduce code duplication. In
    the case of panic on NMI, don't return from NMI handlers if another CPU
    already panicked.

    Signed-off-by: Hidehiro Kawai
    Acked-by: Michal Hocko
    Cc: Aaron Tomlin
    Cc: Andrew Morton
    Cc: Andy Lutomirski
    Cc: Baoquan He
    Cc: Chris Metcalf
    Cc: David Hildenbrand
    Cc: Don Zickus
    Cc: "Eric W. Biederman"
    Cc: Frederic Weisbecker
    Cc: Gobinda Charan Maji
    Cc: HATAYAMA Daisuke
    Cc: "H. Peter Anvin"
    Cc: Ingo Molnar
    Cc: Javi Merino
    Cc: Jonathan Corbet
    Cc: kexec@lists.infradead.org
    Cc: linux-doc@vger.kernel.org
    Cc: lkml
    Cc: Masami Hiramatsu
    Cc: Michal Nazarewicz
    Cc: Nicolas Iooss
    Cc: Peter Zijlstra
    Cc: Prarit Bhargava
    Cc: Rasmus Villemoes
    Cc: Rusty Russell
    Cc: Seth Jennings
    Cc: Steven Rostedt
    Cc: Thomas Gleixner
    Cc: Ulrich Obergfell
    Cc: Vitaly Kuznetsov
    Cc: Vivek Goyal
    Link: http://lkml.kernel.org/r/20151210014626.25437.13302.stgit@softrs
    [ Cleanup comments, fixup formatting. ]
    Signed-off-by: Borislav Petkov
    Signed-off-by: Thomas Gleixner

    Hidehiro Kawai
     

10 Nov, 2015

2 commits

  • Switch everything to the new and more capable implementation of abs().
    Mainly to give the new abs() a bit of a workout.

    Cc: Michal Nazarewicz
    Cc: John Stultz
    Cc: Ingo Molnar
    Cc: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: Masami Hiramatsu
    Cc: Peter Zijlstra
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • For 64-bit arguments, the abs macro casts it to an int which leads to
    lost precision and may cause incorrect results. To deal with 64-bit
    types abs64 macro has been introduced but still there are places where
    abs macro is used incorrectly.

    To deal with the problem, expand abs macro such that it operates on s64
    type when dealing with 64-bit types while still returning long when
    dealing with smaller types.

    This fixes one known bug (per John):

    The internal clocksteering done for fine-grained error correction uses a
    : logarithmic approximation, so any time adjtimex() adjusts the clock
    : steering, timekeeping_freqadjust() quickly approximates the correct clock
    : frequency over a series of ticks.
    :
    : Unfortunately, the logic in timekeeping_freqadjust(), introduced in commit
    : dc491596f639438 (Rework frequency adjustments to work better w/ nohz),
    : used the abs() function with a s64 error value to calculate the size of
    : the approximated adjustment to be made.
    :
    : Per include/linux/kernel.h: "abs() should not be used for 64-bit types
    : (s64, u64, long long) - use abs64()".
    :
    : Thus on 32-bit platforms, this resulted in the clocksteering to take a
    : quite dampended random walk trying to converge on the proper frequency,
    : which caused the adjustments to be made much slower then intended (most
    : easily observed when large adjustments are made).

    Signed-off-by: Michal Nazarewicz
    Reported-by: John Stultz
    Tested-by: John Stultz
    Cc: Ingo Molnar
    Cc: Steven Rostedt
    Cc: Peter Zijlstra
    Cc: Masami Hiramatsu
    Cc: Peter Zijlstra
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michal Nazarewicz
     

07 Nov, 2015

1 commit

  • This adds kvasprintf_const which tries to use kstrdup_const if possible:
    If the format string contains no % characters, or if the format string is
    exactly "%s", we delegate to kstrdup_const. Otherwise, we fall back to
    kvasprintf.

    Just as for kstrdup_const, the main motivation is to save memory by
    reusing .rodata when possible.

    The return value should be freed by kfree_const, just like for
    kstrdup_const.

    There is deliberately no kasprintf_const: In the vast majority of cases,
    the format string argument is a literal, so one can determine statically
    whether one could instead use kstrdup_const directly (which would also
    require one to change all corresponding kfree calls to kfree_const).

    Signed-off-by: Rasmus Villemoes
    Cc: Greg KH
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     

18 Jul, 2015

1 commit

  • Using __printf attributes helps to detect several format string issues
    at compile time (even though -Wformat-security is currently disabled in
    Makefile). For example it can detect when formatting a pointer as a
    number, like the issue fixed in commit a3fa71c40f18 ("wl18xx: show
    rx_frames_per_rates as an array as it really is"), or when the arguments
    do not match the format string, c.f. for example commit 5ce1aca81435
    ("reiserfs: fix __RASSERT format string").

    To prevent similar bugs in the future, add a __printf attribute to every
    function prototype which needs one in include/linux/ and lib/. These
    functions were mostly found by using gcc's -Wsuggest-attribute=format
    flag.

    Signed-off-by: Nicolas Iooss
    Cc: Greg Kroah-Hartman
    Cc: Felipe Balbi
    Cc: Joel Becker
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nicolas Iooss
     

02 Jul, 2015

2 commits

  • Merge third patchbomb from Andrew Morton:

    - the rest of MM

    - scripts/gdb updates

    - ipc/ updates

    - lib/ updates

    - MAINTAINERS updates

    - various other misc things

    * emailed patches from Andrew Morton : (67 commits)
    genalloc: rename of_get_named_gen_pool() to of_gen_pool_get()
    genalloc: rename dev_get_gen_pool() to gen_pool_get()
    x86: opt into HAVE_COPY_THREAD_TLS, for both 32-bit and 64-bit
    MAINTAINERS: add zpool
    MAINTAINERS: BCACHE: Kent Overstreet has changed email address
    MAINTAINERS: move Jens Osterkamp to CREDITS
    MAINTAINERS: remove unused nbd.h pattern
    MAINTAINERS: update brcm gpio filename pattern
    MAINTAINERS: update brcm dts pattern
    MAINTAINERS: update sound soc intel patterns
    MAINTAINERS: remove website for paride
    MAINTAINERS: update Emulex ocrdma email addresses
    bcache: use kvfree() in various places
    libcxgbi: use kvfree() in cxgbi_free_big_mem()
    target: use kvfree() in session alloc and free
    IB/ehca: use kvfree() in ipz_queue_{cd}tor()
    drm/nouveau/gem: use kvfree() in u_free()
    drm: use kvfree() in drm_free_large()
    cxgb4: use kvfree() in t4_free_mem()
    cxgb3: use kvfree() in cxgb_free_mem()
    ...

    Linus Torvalds
     
  • Pull module updates from Rusty Russell:
    "Main excitement here is Peter Zijlstra's lockless rbtree optimization
    to speed module address lookup. He found some abusers of the module
    lock doing that too.

    A little bit of parameter work here too; including Dan Streetman's
    breaking up the big param mutex so writing a parameter can load
    another module (yeah, really). Unfortunately that broke the usual
    suspects, !CONFIG_MODULES and !CONFIG_SYSFS, so those fixes were
    appended too"

    * tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: (26 commits)
    modules: only use mod->param_lock if CONFIG_MODULES
    param: fix module param locks when !CONFIG_SYSFS.
    rcu: merge fix for Convert ACCESS_ONCE() to READ_ONCE() and WRITE_ONCE()
    module: add per-module param_lock
    module: make perm const
    params: suppress unused variable error, warn once just in case code changes.
    modules: clarify CONFIG_MODULE_COMPRESS help, suggest 'N'.
    kernel/module.c: avoid ifdefs for sig_enforce declaration
    kernel/workqueue.c: remove ifdefs over wq_power_efficient
    kernel/params.c: export param_ops_bool_enable_only
    kernel/params.c: generalize bool_enable_only
    kernel/module.c: use generic module param operaters for sig_enforce
    kernel/params: constify struct kernel_param_ops uses
    sysfs: tightened sysfs permission checks
    module: Rework module_addr_{min,max}
    module: Use __module_address() for module_address_lookup()
    module: Make the mod_tree stuff conditional on PERF_EVENTS || TRACING
    module: Optimize __module_address() using a latched RB-tree
    rbtree: Implement generic latch_tree
    seqlock: Introduce raw_read_seqcount_latch()
    ...

    Linus Torvalds
     

01 Jul, 2015

1 commit

  • Commit f06e5153f4ae2e ("kernel/panic.c: add "crash_kexec_post_notifiers"
    option for kdump after panic_notifers") introduced
    "crash_kexec_post_notifiers" kernel boot option, which toggles wheather
    panic() calls crash_kexec() before panic_notifiers and dump kmsg or after.

    The problem is that the commit overlooks panic_on_oops kernel boot option.
    If it is enabled, crash_kexec() is called directly without going through
    panic() in oops path.

    To fix this issue, this patch adds a check to "crash_kexec_post_notifiers"
    in the condition of kexec_should_crash().

    Also, put a comment in kexec_should_crash() to explain not obvious things
    on this patch.

    Signed-off-by: HATAYAMA Daisuke
    Acked-by: Baoquan He
    Tested-by: Hidehiro Kawai
    Reviewed-by: Masami Hiramatsu
    Cc: Vivek Goyal
    Cc: Ingo Molnar
    Cc: Hidehiro Kawai
    Cc: Baoquan He
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    HATAYAMA Daisuke
     

27 Jun, 2015

1 commit

  • Pull tracing updates from Steven Rostedt:
    "This patch series contains several clean ups and even a new trace
    clock "monitonic raw". Also some enhancements to make the ring buffer
    even faster. But the biggest and most noticeable change is the
    renaming of the ftrace* files, structures and variables that have to
    deal with trace events.

    Over the years I've had several developers tell me about their
    confusion with what ftrace is compared to events. Technically,
    "ftrace" is the infrastructure to do the function hooks, which include
    tracing and also helps with live kernel patching. But the trace
    events are a separate entity altogether, and the files that affect the
    trace events should not be named "ftrace". These include:

    include/trace/ftrace.h -> include/trace/trace_events.h
    include/linux/ftrace_event.h -> include/linux/trace_events.h

    Also, functions that are specific for trace events have also been renamed:

    ftrace_print_*() -> trace_print_*()
    (un)register_ftrace_event() -> (un)register_trace_event()
    ftrace_event_name() -> trace_event_name()
    ftrace_trigger_soft_disabled() -> trace_trigger_soft_disabled()
    ftrace_define_fields_##call() -> trace_define_fields_##call()
    ftrace_get_offsets_##call() -> trace_get_offsets_##call()

    Structures have been renamed:

    ftrace_event_file -> trace_event_file
    ftrace_event_{call,class} -> trace_event_{call,class}
    ftrace_event_buffer -> trace_event_buffer
    ftrace_subsystem_dir -> trace_subsystem_dir
    ftrace_event_raw_##call -> trace_event_raw_##call
    ftrace_event_data_offset_##call-> trace_event_data_offset_##call
    ftrace_event_type_funcs_##call -> trace_event_type_funcs_##call

    And a few various variables and flags have also been updated.

    This has been sitting in linux-next for some time, and I have not
    heard a single complaint about this rename breaking anything. Mostly
    because these functions, variables and structures are mostly internal
    to the tracing system and are seldom (if ever) used by anything
    external to that"

    * tag 'trace-v4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (33 commits)
    ring_buffer: Allow to exit the ring buffer benchmark immediately
    ring-buffer-benchmark: Fix the wrong type
    ring-buffer-benchmark: Fix the wrong param in module_param
    ring-buffer: Add enum names for the context levels
    ring-buffer: Remove useless unused tracing_off_permanent()
    ring-buffer: Give NMIs a chance to lock the reader_lock
    ring-buffer: Add trace_recursive checks to ring_buffer_write()
    ring-buffer: Allways do the trace_recursive checks
    ring-buffer: Move recursive check to per_cpu descriptor
    ring-buffer: Add unlikelys to make fast path the default
    tracing: Rename ftrace_get_offsets_##call() to trace_event_get_offsets_##call()
    tracing: Rename ftrace_define_fields_##call() to trace_event_define_fields_##call()
    tracing: Rename ftrace_event_type_funcs_##call to trace_event_type_funcs_##call
    tracing: Rename ftrace_data_offset_##call to trace_event_data_offset_##call
    tracing: Rename ftrace_raw_##call event structures to trace_event_raw_##call
    tracing: Rename ftrace_trigger_soft_disabled() to trace_trigger_soft_disabled()
    tracing: Rename FTRACE_EVENT_FL_* flags to EVENT_FILE_FL_*
    tracing: Rename struct ftrace_subsystem_dir to trace_subsystem_dir
    tracing: Rename ftrace_event_name() to trace_event_name()
    tracing: Rename FTRACE_MAX_EVENT to TRACE_EVENT_TYPE_MAX
    ...

    Linus Torvalds
     

29 May, 2015

1 commit

  • The tracing_off_permanent() call is a way to disable all ring_buffers.
    Nothing uses it and nothing should use it, as tracing_off() and
    friends are better, as they disable the ring buffers related to
    tracing. The tracing_off_permanent() even disabled non tracing
    ring buffers. This is a bit drastic, and was added to handle NMIs
    doing outputs that could corrupt the ring buffer when only tracing
    used them. It is now obsolete and adds a little overhead, it should
    be removed.

    Signed-off-by: Steven Rostedt

    Steven Rostedt (Red Hat)
     

28 May, 2015

1 commit

  • There were some inconsistency in restriction to VERIFY_OCTAL_PERMISSIONS().
    Previously the test was "User perms >= group perms >= other perms". The
    permission field of User, Group or Other consists of three bits. LSB is
    EXECUTE permission, MSB is READ permission and the middle bit is WRITE
    permission. But logically WRITE is "more privileged" than READ.

    Say for example, permission value is "0430". Here User has only READ
    permission whereas Group has both WRITE and EXECUTE permission.

    So, the checks could be tightened and the tests are separated to
    USER_READABLE >= GROUP_READABLE >= OTHER_READABLE,
    USER_WRITABLE >= GROUP_WRITABLE and OTHER_WRITABLE is not permitted.

    Signed-off-by: Gobinda Charan Maji
    Signed-off-by: Rusty Russell

    Gobinda Charan Maji
     

19 May, 2015

1 commit

  • Commit 662bbcb2747c ("mm, sched: Allow uaccess in atomic with
    pagefault_disable()") removed might_sleep() checks for all user access
    code (that uses might_fault()).

    The reason was to disable wrong "sleep in atomic" warnings in the
    following scenario:

    pagefault_disable()
    rc = copy_to_user(...)
    pagefault_enable()

    Which is valid, as pagefault_disable() increments the preempt counter
    and therefore disables the pagefault handler. copy_to_user() will not
    sleep and return an error code if a page is not available.

    However, as all might_sleep() checks are removed,
    CONFIG_DEBUG_ATOMIC_SLEEP would no longer detect the following scenario:

    spin_lock(&lock);
    rc = copy_to_user(...)
    spin_unlock(&lock)

    If the kernel is compiled with preemption turned on, preempt_disable()
    will make in_atomic() detect disabled preemption. The fault handler would
    correctly never sleep on user access.
    However, with preemption turned off, preempt_disable() is usually a NOP
    (with !CONFIG_PREEMPT_COUNT), therefore in_atomic() will not be able to
    detect disabled preemption nor disabled pagefaults. The fault handler
    could sleep.
    We really want to enable CONFIG_DEBUG_ATOMIC_SLEEP checks for user access
    functions again, otherwise we can end up with horrible deadlocks.

    Root of all evil is that pagefault_disable() acts almost as
    preempt_disable(), depending on preemption being turned on/off.

    As we now have pagefault_disabled(), we can use it to distinguish
    whether user acces functions might sleep.

    Convert might_fault() into a makro that calls __might_fault(), to
    allow proper file + line messages in case of a might_sleep() warning.

    Reviewed-and-tested-by: Thomas Gleixner
    Signed-off-by: David Hildenbrand
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: David.Laight@ACULAB.COM
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: airlied@linux.ie
    Cc: akpm@linux-foundation.org
    Cc: benh@kernel.crashing.org
    Cc: bigeasy@linutronix.de
    Cc: borntraeger@de.ibm.com
    Cc: daniel.vetter@intel.com
    Cc: heiko.carstens@de.ibm.com
    Cc: herbert@gondor.apana.org.au
    Cc: hocko@suse.cz
    Cc: hughd@google.com
    Cc: mst@redhat.com
    Cc: paulus@samba.org
    Cc: ralf@linux-mips.org
    Cc: schwidefsky@de.ibm.com
    Cc: yang.shi@windriver.com
    Link: http://lkml.kernel.org/r/1431359540-32227-3-git-send-email-dahi@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    David Hildenbrand
     

17 Apr, 2015

1 commit

  • We have grown a number of different implementations of
    DIV_ROUND_CLOSEST_ULL throughout the kernel. Move the i915 one to
    kernel.h so that it can be reused.

    Signed-off-by: Javi Merino
    Reviewed-by: Jeff Epler
    Cc: Jani Nikula
    Cc: David Airlie
    Cc: Guenter Roeck
    Acked-by: Daniel Vetter
    Cc: "Rafael J. Wysocki"
    Cc: Alex Elder
    Cc: Antti Palosaari
    Cc: Javi Merino
    Cc: Mauro Carvalho Chehab
    Cc: Mel Gorman
    Cc: Mike Turquette
    Cc: Stephen Boyd
    Cc: Stephen Hemminger
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Javi Merino
     

13 Feb, 2015

1 commit

  • __FUNCTION__ hasn't been treated as a string literal since gcc 3.4, so
    this only helps people who only test-compile using 3.3 (compiler-gcc3.h
    barks at anything older than that). Besides, there are almost no
    occurrences of __FUNCTION__ left in the tree.

    [akpm@linux-foundation.org: convert remaining __FUNCTION__ references]
    Signed-off-by: Rasmus Villemoes
    Cc: Michal Nazarewicz
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     

11 Feb, 2015

1 commit

  • Pull live patching infrastructure from Jiri Kosina:
    "Let me provide a bit of history first, before describing what is in
    this pile.

    Originally, there was kSplice as a standalone project that implemented
    stop_machine()-based patching for the linux kernel. This project got
    later acquired, and the current owner is providing live patching as a
    proprietary service, without any intentions to have their
    implementation merged.

    Then, due to rising user/customer demand, both Red Hat and SUSE
    started working on their own implementation (not knowing about each
    other), and announced first versions roughly at the same time [1] [2].

    The principle difference between the two solutions is how they are
    making sure that the patching is performed in a consistent way when it
    comes to different execution threads with respect to the semantic
    nature of the change that is being introduced.

    In a nutshell, kPatch is issuing stop_machine(), then looking at
    stacks of all existing processess, and if it decides that the system
    is in a state that can be patched safely, it proceeds insterting code
    redirection machinery to the patched functions.

    On the other hand, kGraft provides a per-thread consistency during one
    single pass of a process through the kernel and performs a lazy
    contignuous migration of threads from "unpatched" universe to the
    "patched" one at safe checkpoints.

    If interested in a more detailed discussion about the consistency
    models and its possible combinations, please see the thread that
    evolved around [3].

    It pretty quickly became obvious to the interested parties that it's
    absolutely impractical in this case to have several isolated solutions
    for one task to co-exist in the kernel. During a dedicated Live
    Kernel Patching track at LPC in Dusseldorf, all the interested parties
    sat together and came up with a joint aproach that would work for both
    distro vendors. Steven Rostedt took notes [4] from this meeting.

    And the foundation for that aproach is what's present in this pull
    request.

    It provides a basic infrastructure for function "live patching" (i.e.
    code redirection), including API for kernel modules containing the
    actual patches, and API/ABI for userspace to be able to operate on the
    patches (look up what patches are applied, enable/disable them, etc).

    It's relatively simple and minimalistic, as it's making use of
    existing kernel infrastructure (namely ftrace) as much as possible.
    It's also self-contained, in a sense that it doesn't hook itself in
    any other kernel subsystem (it doesn't even touch any other code).
    It's now implemented for x86 only as a reference architecture, but
    support for powerpc, s390 and arm is already in the works (adding
    arch-specific support basically boils down to teaching ftrace about
    regs-saving).

    Once this common infrastructure gets merged, both Red Hat and SUSE
    have agreed to immediately start porting their current solutions on
    top of this, abandoning their out-of-tree code. The plan basically is
    that each patch will be marked by flag(s) that would indicate which
    consistency model it is willing to use (again, the details have been
    sketched out already in the thread at [3]).

    Before this happens, the current codebase can be used to patch a large
    group of secruity/stability problems the patches for which are not too
    complex (in a sense that they don't introduce non-trivial change of
    function's return value semantics, they don't change layout of data
    structures, etc) -- this corresponds to LEAVE_FUNCTION &&
    SWITCH_FUNCTION semantics described at [3].

    This tree has been in linux-next since December.

    [1] https://lkml.org/lkml/2014/4/30/477
    [2] https://lkml.org/lkml/2014/7/14/857
    [3] https://lkml.org/lkml/2014/11/7/354
    [4] http://linuxplumbersconf.org/2014/wp-content/uploads/2014/10/LPC2014_LivePatching.txt

    [ The core code is introduced by the three commits authored by Seth
    Jennings, which got a lot of changes incorporated during numerous
    respins and reviews of the initial implementation. All the followup
    commits have materialized only after public tree has been created,
    so they were not folded into initial three commits so that the
    public tree doesn't get rebased ]"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching:
    livepatch: add missing newline to error message
    livepatch: rename config to CONFIG_LIVEPATCH
    livepatch: fix uninitialized return value
    livepatch: support for repatching a function
    livepatch: enforce patch stacking semantics
    livepatch: change ARCH_HAVE_LIVE_PATCHING to HAVE_LIVE_PATCHING
    livepatch: fix deferred module patching order
    livepatch: handle ancient compilers with more grace
    livepatch: kconfig: use bool instead of boolean
    livepatch: samples: fix usage example comments
    livepatch: MAINTAINERS: add git tree location
    livepatch: use FTRACE_OPS_FL_IPMODIFY
    livepatch: move x86 specific ftrace handler code to arch/x86
    livepatch: samples: add sample live patching module
    livepatch: kernel: add support for live patching
    livepatch: kernel: add TAINT_LIVEPATCH

    Linus Torvalds
     

02 Feb, 2015

1 commit

  • Commit 8eb23b9f35aa ("sched: Debug nested sleeps") added code to report
    on nested sleep conditions, which we generally want to avoid because the
    inner sleeping operation can re-set the thread state to TASK_RUNNING,
    but that will then cause the outer sleep loop not actually sleep when it
    calls schedule.

    However, that's actually valid traditional behavior, with the inner
    sleep being some fairly rare case (like taking a sleeping lock that
    normally doesn't actually need to sleep).

    And the debug code would actually change the state of the task to
    TASK_RUNNING internally, which makes that kind of traditional and
    working code not work at all, because now the nested sleep doesn't just
    sometimes cause the outer one to not block, but will cause it to happen
    every time.

    In particular, it will cause the cardbus kernel daemon (pccardd) to
    basically busy-loop doing scheduling, converting a laptop into a heater,
    as reported by Bruno Prémont. But there may be other legacy uses of
    that nested sleep model in other drivers that are also likely to never
    get converted to the new model.

    This fixes both cases:

    - don't set TASK_RUNNING when the nested condition happens (note: even
    if WARN_ONCE() only _warns_ once, the return value isn't whether the
    warning happened, but whether the condition for the warning was true.
    So despite the warning only happening once, the "if (WARN_ON(..))"
    would trigger for every nested sleep.

    - in the cases where we knowingly disable the warning by using
    "sched_annotate_sleep()", don't change the task state (that is used
    for all core scheduling decisions), instead use '->task_state_change'
    that is used for the debugging decision itself.

    (Credit for the second part of the fix goes to Oleg Nesterov: "Can't we
    avoid this subtle change in behaviour DEBUG_ATOMIC_SLEEP adds?" with the
    suggested change to use 'task_state_change' as part of the test)

    Reported-and-bisected-by: Bruno Prémont
    Tested-by: Rafael J Wysocki
    Acked-by: Oleg Nesterov
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner ,
    Cc: Ilya Dryomov ,
    Cc: Mike Galbraith
    Cc: Ingo Molnar
    Cc: Peter Hurley ,
    Cc: Davidlohr Bueso ,
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

22 Dec, 2014

1 commit

  • This adds a new taint flag to indicate when the kernel or a kernel
    module has been live patched. This will provide a clean indication in
    bug reports that live patching was used.

    Additionally, if the crash occurs in a live patched function, the live
    patch module will appear beside the patched function in the backtrace.

    Signed-off-by: Seth Jennings
    Acked-by: Josh Poimboeuf
    Reviewed-by: Miroslav Benes
    Reviewed-by: Petr Mladek
    Reviewed-by: Masami Hiramatsu
    Signed-off-by: Jiri Kosina

    Seth Jennings
     

15 Dec, 2014

1 commit

  • Pull tty/serial driver updates from Greg KH:
    "Here's the big tty/serial driver update for 3.19-rc1.

    There are a number of TTY core changes/fixes in here from Peter Hurley
    that have all been teted in linux-next for a long time now. There are
    also the normal serial driver updates as well, full details in the
    changelog below"

    * tag 'tty-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (219 commits)
    serial: pxa: hold port.lock when reporting modem line changes
    tty-hvsi_lib: Deletion of an unnecessary check before the function call "tty_kref_put"
    tty: Deletion of unnecessary checks before two function calls
    n_tty: Fix read_buf race condition, increment read_head after pushing data
    serial: of-serial: add PM suspend/resume support
    Revert "serial: of-serial: add PM suspend/resume support"
    Revert "serial: of-serial: fix up PM ops on no_console_suspend and port type"
    serial: 8250: don't attempt a trylock if in sysrq
    serial: core: Add big-endian iotype
    serial: samsung: use port->fifosize instead of hardcoded values
    serial: samsung: prefer to use fifosize from driver data
    serial: samsung: fix style problems
    serial: samsung: wait for transfer completion before clock disable
    serial: icom: fix error return code
    serial: tegra: clean up tty-flag assignments
    serial: Fix io address assign flow with Fintek PCI-to-UART Product
    serial: mxs-auart: fix tx_empty against shift register
    serial: mxs-auart: fix gpio change detection on interrupt
    serial: mxs-auart: Fix mxs_auart_set_ldisc()
    serial: 8250_dw: Use 64-bit access for OCTEON.
    ...

    Linus Torvalds
     

11 Dec, 2014

1 commit

  • There have been several times where I have had to rebuild a kernel to
    cause a panic when hitting a WARN() in the code in order to get a crash
    dump from a system. Sometimes this is easy to do, other times (such as
    in the case of a remote admin) it is not trivial to send new images to
    the user.

    A much easier method would be a switch to change the WARN() over to a
    panic. This makes debugging easier in that I can now test the actual
    image the WARN() was seen on and I do not have to engage in remote
    debugging.

    This patch adds a panic_on_warn kernel parameter and
    /proc/sys/kernel/panic_on_warn calls panic() in the
    warn_slowpath_common() path. The function will still print out the
    location of the warning.

    An example of the panic_on_warn output:

    The first line below is from the WARN_ON() to output the WARN_ON()'s
    location. After that the panic() output is displayed.

    WARNING: CPU: 30 PID: 11698 at /home/prarit/dummy_module/dummy-module.c:25 init_dummy+0x1f/0x30 [dummy_module]()
    Kernel panic - not syncing: panic_on_warn set ...

    CPU: 30 PID: 11698 Comm: insmod Tainted: G W OE 3.17.0+ #57
    Hardware name: Intel Corporation S2600CP/S2600CP, BIOS RMLSDP.86I.00.29.D696.1311111329 11/11/2013
    0000000000000000 000000008e3f87df ffff88080f093c38 ffffffff81665190
    0000000000000000 ffffffff818aea3d ffff88080f093cb8 ffffffff8165e2ec
    ffffffff00000008 ffff88080f093cc8 ffff88080f093c68 000000008e3f87df
    Call Trace:
    [] dump_stack+0x46/0x58
    [] panic+0xd0/0x204
    [] ? init_dummy+0x1f/0x30 [dummy_module]
    [] warn_slowpath_common+0xd0/0xd0
    [] ? dummy_greetings+0x40/0x40 [dummy_module]
    [] warn_slowpath_null+0x1a/0x20
    [] init_dummy+0x1f/0x30 [dummy_module]
    [] do_one_initcall+0xd4/0x210
    [] ? __vunmap+0xc2/0x110
    [] load_module+0x16a9/0x1b30
    [] ? store_uevent+0x70/0x70
    [] ? copy_module_from_fd.isra.44+0x129/0x180
    [] SyS_finit_module+0xa6/0xd0
    [] system_call_fastpath+0x12/0x17

    Successfully tested by me.

    hpa said: There is another very valid use for this: many operators would
    rather a machine shuts down than being potentially compromised either
    functionally or security-wise.

    Signed-off-by: Prarit Bhargava
    Cc: Jonathan Corbet
    Cc: Rusty Russell
    Cc: "H. Peter Anvin"
    Cc: Andi Kleen
    Cc: Masami Hiramatsu
    Acked-by: Yasuaki Ishimatsu
    Cc: Fabian Frederick
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Prarit Bhargava
     

06 Nov, 2014

1 commit


28 Oct, 2014

2 commits

  • cond_resched() is a preemption point, not strictly a blocking
    primitive, so exclude it from the ->state test.

    In particular, preemption preserves task_struct::state.

    Signed-off-by: Peter Zijlstra (Intel)
    Cc: tglx@linutronix.de
    Cc: ilya.dryomov@inktank.com
    Cc: umgwanakikbuti@gmail.com
    Cc: oleg@redhat.com
    Cc: Alex Elder
    Cc: Andrew Morton
    Cc: Axel Lin
    Cc: Daniel Borkmann
    Cc: Dave Jones
    Cc: Jason Baron
    Cc: Linus Torvalds
    Cc: Rusty Russell
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/20140924082242.656559952@infradead.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     
  • do_wait() is a big wait loop, but we set TASK_RUNNING too late; we end
    up calling potential sleeps before we reset it.

    Not strictly a bug since we're guaranteed to exit the loop and not
    call schedule(); put in annotations to quiet might_sleep().

    WARNING: CPU: 0 PID: 1 at ../kernel/sched/core.c:7123 __might_sleep+0x7e/0x90()
    do not call blocking ops when !TASK_RUNNING; state=1 set at [] do_wait+0x88/0x270

    Call Trace:
    [] dump_stack+0x4e/0x7a
    [] warn_slowpath_common+0x8c/0xc0
    [] warn_slowpath_fmt+0x4c/0x50
    [] __might_sleep+0x7e/0x90
    [] might_fault+0x55/0xb0
    [] wait_consider_task+0x90b/0xc10
    [] do_wait+0x104/0x270
    [] SyS_wait4+0x77/0x100
    [] system_call_fastpath+0x16/0x1b

    Signed-off-by: Peter Zijlstra (Intel)
    Cc: tglx@linutronix.de
    Cc: umgwanakikbuti@gmail.com
    Cc: ilya.dryomov@inktank.com
    Cc: Alex Elder
    Cc: Andrew Morton
    Cc: Axel Lin
    Cc: Daniel Borkmann
    Cc: Dave Jones
    Cc: Guillaume Morin
    Cc: Ionut Alexa
    Cc: Jason Baron
    Cc: Linus Torvalds
    Cc: Michal Hocko
    Cc: Michal Schmidt
    Cc: Oleg Nesterov
    Cc: Paul E. McKenney
    Cc: Rik van Riel
    Cc: Rusty Russell
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/20140924082242.186408915@infradead.org
    Signed-off-by: Ingo Molnar

    Peter Zijlstra
     

24 Oct, 2014

1 commit

  • Pull x86 EFI updates from Peter Anvin:
    "This patchset falls under the "maintainers that grovel" clause in the
    v3.18-rc1 announcement. We had intended to push it late in the merge
    window since we got it into the -tip tree relatively late.

    Many of these are relatively simple things, but there are a couple of
    key bits, especially Ard's and Matt's patches"

    * 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (24 commits)
    rtc: Disable EFI rtc for x86
    efi: rtc-efi: Export platform:rtc-efi as module alias
    efi: Delete the in_nmi() conditional runtime locking
    efi: Provide a non-blocking SetVariable() operation
    x86/efi: Adding efi_printks on memory allocationa and pci.reads
    x86/efi: Mark initialization code as such
    x86/efi: Update comment regarding required phys mapped EFI services
    x86/efi: Unexport add_efi_memmap variable
    x86/efi: Remove unused efi_call* macros
    efi: Resolve some shadow warnings
    arm64: efi: Format EFI memory type & attrs with efi_md_typeattr_format()
    ia64: efi: Format EFI memory type & attrs with efi_md_typeattr_format()
    x86: efi: Format EFI memory type & attrs with efi_md_typeattr_format()
    efi: Introduce efi_md_typeattr_format()
    efi: Add macro for EFI_MEMORY_UCE memory attribute
    x86/efi: Clear EFI_RUNTIME_SERVICES if failing to enter virtual mode
    arm64/efi: Do not enter virtual mode if booting with efi=noruntime or noefi
    arm64/efi: uefi_init error handling fix
    efi: Add kernel param efi=noruntime
    lib: Add a generic cmdline parse function parse_option_str
    ...

    Linus Torvalds
     

14 Oct, 2014

1 commit


12 Oct, 2014

1 commit

  • Pull security subsystem updates from James Morris.

    Mostly ima, selinux, smack and key handling updates.

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (65 commits)
    integrity: do zero padding of the key id
    KEYS: output last portion of fingerprint in /proc/keys
    KEYS: strip 'id:' from ca_keyid
    KEYS: use swapped SKID for performing partial matching
    KEYS: Restore partial ID matching functionality for asymmetric keys
    X.509: If available, use the raw subjKeyId to form the key description
    KEYS: handle error code encoded in pointer
    selinux: normalize audit log formatting
    selinux: cleanup error reporting in selinux_nlmsg_perm()
    KEYS: Check hex2bin()'s return when generating an asymmetric key ID
    ima: detect violations for mmaped files
    ima: fix race condition on ima_rdwr_violation_check and process_measurement
    ima: added ima_policy_flag variable
    ima: return an error code from ima_add_boot_aggregate()
    ima: provide 'ima_appraise=log' kernel option
    ima: move keyring initialization to ima_init()
    PKCS#7: Handle PKCS#7 messages that contain no X.509 certs
    PKCS#7: Better handling of unsupported crypto
    KEYS: Overhaul key identification when searching for asymmetric keys
    KEYS: Implement binary asymmetric key ID handling
    ...

    Linus Torvalds