1. 05 9月, 2019 1 次提交
  2. 13 8月, 2019 2 次提交
  3. 03 8月, 2019 4 次提交
  4. 02 8月, 2019 2 次提交
    • M
      arm64: Make debug exception handlers visible from RCU · d8bb6718
      Masami Hiramatsu 提交于
      Make debug exceptions visible from RCU so that synchronize_rcu()
      correctly track the debug exception handler.
      
      This also introduces sanity checks for user-mode exceptions as same
      as x86's ist_enter()/ist_exit().
      
      The debug exception can interrupt in idle task. For example, it warns
      if we put a kprobe on a function called from idle task as below.
      The warning message showed that the rcu_read_lock() caused this
      problem. But actually, this means the RCU is lost the context which
      is already in NMI/IRQ.
      
        /sys/kernel/debug/tracing # echo p default_idle_call >> kprobe_events
        /sys/kernel/debug/tracing # echo 1 > events/kprobes/enable
        /sys/kernel/debug/tracing # [  135.122237]
        [  135.125035] =============================
        [  135.125310] WARNING: suspicious RCU usage
        [  135.125581] 5.2.0-08445-g9187c508bdc7 #20 Not tainted
        [  135.125904] -----------------------------
        [  135.126205] include/linux/rcupdate.h:594 rcu_read_lock() used illegally while idle!
        [  135.126839]
        [  135.126839] other info that might help us debug this:
        [  135.126839]
        [  135.127410]
        [  135.127410] RCU used illegally from idle CPU!
        [  135.127410] rcu_scheduler_active = 2, debug_locks = 1
        [  135.128114] RCU used illegally from extended quiescent state!
        [  135.128555] 1 lock held by swapper/0/0:
        [  135.128944]  #0: (____ptrval____) (rcu_read_lock){....}, at: call_break_hook+0x0/0x178
        [  135.130499]
        [  135.130499] stack backtrace:
        [  135.131192] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.2.0-08445-g9187c508bdc7 #20
        [  135.131841] Hardware name: linux,dummy-virt (DT)
        [  135.132224] Call trace:
        [  135.132491]  dump_backtrace+0x0/0x140
        [  135.132806]  show_stack+0x24/0x30
        [  135.133133]  dump_stack+0xc4/0x10c
        [  135.133726]  lockdep_rcu_suspicious+0xf8/0x108
        [  135.134171]  call_break_hook+0x170/0x178
        [  135.134486]  brk_handler+0x28/0x68
        [  135.134792]  do_debug_exception+0x90/0x150
        [  135.135051]  el1_dbg+0x18/0x8c
        [  135.135260]  default_idle_call+0x0/0x44
        [  135.135516]  cpu_startup_entry+0x2c/0x30
        [  135.135815]  rest_init+0x1b0/0x280
        [  135.136044]  arch_call_rest_init+0x14/0x1c
        [  135.136305]  start_kernel+0x4d4/0x500
        [  135.136597]
      
      So make debug exception visible to RCU can fix this warning.
      Reported-by: NNaresh Kamboju <naresh.kamboju@linaro.org>
      Acked-by: NPaul E. McKenney <paulmck@linux.ibm.com>
      Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: NWill Deacon <will@kernel.org>
      d8bb6718
    • M
      arm64: kprobes: Recover pstate.D in single-step exception handler · b3980e48
      Masami Hiramatsu 提交于
      kprobes manipulates the interrupted PSTATE for single step, and
      doesn't restore it. Thus, if we put a kprobe where the pstate.D
      (debug) masked, the mask will be cleared after the kprobe hits.
      
      Moreover, in the most complicated case, this can lead a kernel
      crash with below message when a nested kprobe hits.
      
      [  152.118921] Unexpected kernel single-step exception at EL1
      
      When the 1st kprobe hits, do_debug_exception() will be called.
      At this point, debug exception (= pstate.D) must be masked (=1).
      But if another kprobes hits before single-step of the first kprobe
      (e.g. inside user pre_handler), it unmask the debug exception
      (pstate.D = 0) and return.
      Then, when the 1st kprobe setting up single-step, it saves current
      DAIF, mask DAIF, enable single-step, and restore DAIF.
      However, since "D" flag in DAIF is cleared by the 2nd kprobe, the
      single-step exception happens soon after restoring DAIF.
      
      This has been introduced by commit 7419333f ("arm64: kprobe:
      Always clear pstate.D in breakpoint exception handler")
      
      To solve this issue, this stores all DAIF bits and restore it
      after single stepping.
      Reported-by: NNaresh Kamboju <naresh.kamboju@linaro.org>
      Fixes: 7419333f ("arm64: kprobe: Always clear pstate.D in breakpoint exception handler")
      Reviewed-by: NJames Morse <james.morse@arm.com>
      Tested-by: NJames Morse <james.morse@arm.com>
      Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: NWill Deacon <will@kernel.org>
      b3980e48
  5. 01 8月, 2019 11 次提交
  6. 31 7月, 2019 4 次提交
  7. 30 7月, 2019 8 次提交
  8. 29 7月, 2019 4 次提交
    • A
      arm64: module: Mark expected switch fall-through · eca92a53
      Anders Roxell 提交于
      When fall-through warnings was enabled by default the following warnings
      was starting to show up:
      
      ../arch/arm64/kernel/module.c: In function ‘apply_relocate_add’:
      ../arch/arm64/kernel/module.c:316:19: warning: this statement may fall
       through [-Wimplicit-fallthrough=]
          overflow_check = false;
          ~~~~~~~~~~~~~~~^~~~~~~
      ../arch/arm64/kernel/module.c:317:3: note: here
         case R_AARCH64_MOVW_UABS_G0:
         ^~~~
      ../arch/arm64/kernel/module.c:322:19: warning: this statement may fall
       through [-Wimplicit-fallthrough=]
          overflow_check = false;
          ~~~~~~~~~~~~~~~^~~~~~~
      ../arch/arm64/kernel/module.c:323:3: note: here
         case R_AARCH64_MOVW_UABS_G1:
         ^~~~
      
      Rework so that the compiler doesn't warn about fall-through.
      
      Fixes: d93512ef0f0e ("Makefile: Globally enable fall-through warning")
      Signed-off-by: NAnders Roxell <anders.roxell@linaro.org>
      Signed-off-by: NWill Deacon <will@kernel.org>
      eca92a53
    • A
      arm64: smp: Mark expected switch fall-through · 66554739
      Anders Roxell 提交于
      When fall-through warnings was enabled by default the following warning
      was starting to show up:
      
      In file included from ../include/linux/kernel.h:15,
                       from ../include/linux/list.h:9,
                       from ../include/linux/kobject.h:19,
                       from ../include/linux/of.h:17,
                       from ../include/linux/irqdomain.h:35,
                       from ../include/linux/acpi.h:13,
                       from ../arch/arm64/kernel/smp.c:9:
      ../arch/arm64/kernel/smp.c: In function ‘__cpu_up’:
      ../include/linux/printk.h:302:2: warning: this statement may fall
       through [-Wimplicit-fallthrough=]
        printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ../arch/arm64/kernel/smp.c:156:4: note: in expansion of macro ‘pr_crit’
          pr_crit("CPU%u: may not have shut down cleanly\n", cpu);
          ^~~~~~~
      ../arch/arm64/kernel/smp.c:157:3: note: here
         case CPU_STUCK_IN_KERNEL:
         ^~~~
      
      Rework so that the compiler doesn't warn about fall-through.
      
      Fixes: d93512ef0f0e ("Makefile: Globally enable fall-through warning")
      Signed-off-by: NAnders Roxell <anders.roxell@linaro.org>
      Signed-off-by: NWill Deacon <will@kernel.org>
      66554739
    • W
      arm64: hw_breakpoint: Fix warnings about implicit fallthrough · 75a382f1
      Will Deacon 提交于
      Now that -Wimplicit-fallthrough is passed to GCC by default, the kernel
      build has suddenly got noisy. Annotate the two fall-through cases in our
      hw_breakpoint implementation, since they are both intentional.
      Reported-by: NAnders Roxell <anders.roxell@linaro.org>
      Signed-off-by: NWill Deacon <will@kernel.org>
      75a382f1
    • W
      arm64: compat: Allow single-byte watchpoints on all addresses · 849adec4
      Will Deacon 提交于
      Commit d968d2b8 ("ARM: 7497/1: hw_breakpoint: allow single-byte
      watchpoints on all addresses") changed the validation requirements for
      hardware watchpoints on arch/arm/. Update our compat layer to implement
      the same relaxation.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NWill Deacon <will@kernel.org>
      849adec4
  9. 26 7月, 2019 3 次提交
  10. 25 7月, 2019 1 次提交
    • G
      perf/x86/intel: Mark expected switch fall-throughs · 289a2d22
      Gustavo A. R. Silva 提交于
      In preparation to enabling -Wimplicit-fallthrough, mark switch
      cases where we are expecting to fall through.
      
      This patch fixes the following warnings:
      
        arch/x86/events/intel/core.c: In function ‘intel_pmu_init’:
        arch/x86/events/intel/core.c:4959:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
        arch/x86/events/intel/core.c:5008:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
      
      Warning level 3 was used: -Wimplicit-fallthrough=3
      
      This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough.
      Signed-off-by: NGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/20190624161913.GA32270@embeddedorSigned-off-by: NIngo Molnar <mingo@kernel.org>
      289a2d22