1. 15 12月, 2020 1 次提交
    • M
      tracing: Disable ftrace selftests when any tracer is running · 60efe21e
      Masami Hiramatsu 提交于
      Disable ftrace selftests when any tracer (kernel command line options
      like ftrace=, trace_events=, kprobe_events=, and boot-time tracing)
      starts running because selftest can disturb it.
      
      Currently ftrace= and trace_events= are checked, but kprobe_events
      has a different flag, and boot-time tracing didn't checked. This unifies
      the disabled flag and all of those boot-time tracing features sets
      the flag.
      
      This also fixes warnings on kprobe-event selftest
      (CONFIG_FTRACE_STARTUP_TEST=y and CONFIG_KPROBE_EVENTS=y) with boot-time
      tracing (ftrace.event.kprobes.EVENT.probes) like below;
      
      [   59.803496] trace_kprobe: Testing kprobe tracing:
      [   59.804258] ------------[ cut here ]------------
      [   59.805682] WARNING: CPU: 3 PID: 1 at kernel/trace/trace_kprobe.c:1987 kprobe_trace_self_tests_ib
      [   59.806944] Modules linked in:
      [   59.807335] CPU: 3 PID: 1 Comm: swapper/0 Not tainted 5.10.0-rc7+ #172
      [   59.808029] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1 04/01/204
      [   59.808999] RIP: 0010:kprobe_trace_self_tests_init+0x5f/0x42b
      [   59.809696] Code: e8 03 00 00 48 c7 c7 30 8e 07 82 e8 6d 3c 46 ff 48 c7 c6 00 b2 1a 81 48 c7 c7 7
      [   59.812439] RSP: 0018:ffffc90000013e78 EFLAGS: 00010282
      [   59.813038] RAX: 00000000ffffffef RBX: 0000000000000000 RCX: 0000000000049443
      [   59.813780] RDX: 0000000000049403 RSI: 0000000000049403 RDI: 000000000002deb0
      [   59.814589] RBP: ffffc90000013e90 R08: 0000000000000001 R09: 0000000000000001
      [   59.815349] R10: 0000000000000001 R11: 0000000000000000 R12: 00000000ffffffef
      [   59.816138] R13: ffff888004613d80 R14: ffffffff82696940 R15: ffff888004429138
      [   59.816877] FS:  0000000000000000(0000) GS:ffff88807dcc0000(0000) knlGS:0000000000000000
      [   59.817772] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   59.818395] CR2: 0000000001a8dd38 CR3: 0000000002222000 CR4: 00000000000006a0
      [   59.819144] Call Trace:
      [   59.819469]  ? init_kprobe_trace+0x6b/0x6b
      [   59.819948]  do_one_initcall+0x5f/0x300
      [   59.820392]  ? rcu_read_lock_sched_held+0x4f/0x80
      [   59.820916]  kernel_init_freeable+0x22a/0x271
      [   59.821416]  ? rest_init+0x241/0x241
      [   59.821841]  kernel_init+0xe/0x10f
      [   59.822251]  ret_from_fork+0x22/0x30
      [   59.822683] irq event stamp: 16403349
      [   59.823121] hardirqs last  enabled at (16403359): [<ffffffff810db81e>] console_unlock+0x48e/0x580
      [   59.824074] hardirqs last disabled at (16403368): [<ffffffff810db786>] console_unlock+0x3f6/0x580
      [   59.825036] softirqs last  enabled at (16403200): [<ffffffff81c0033a>] __do_softirq+0x33a/0x484
      [   59.825982] softirqs last disabled at (16403087): [<ffffffff81a00f02>] asm_call_irq_on_stack+0x10
      [   59.827034] ---[ end trace 200c544775cdfeb3 ]---
      [   59.827635] trace_kprobe: error on probing function entry.
      
      Link: https://lkml.kernel.org/r/160741764955.3448999.3347769358299456915.stgit@devnote2
      
      Fixes: 4d655281 ("tracing/boot Add kprobe event support")
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      60efe21e
  2. 08 12月, 2020 3 次提交
  3. 02 12月, 2020 1 次提交
    • S
      ring-buffer: Add test to validate the time stamp deltas · 5b7be9c7
      Steven Rostedt (VMware) 提交于
      While debugging a situation where a delta for an event was calucalted wrong,
      I realize there was nothing making sure that the delta of events are
      correct. If a single event has an incorrect delta, then all events after it
      will also have one. If the discrepency gets large enough, it could cause
      the time stamps to go backwards when crossing sub buffers, that record a
      full 64 bit time stamp, and the new deltas are added to that.
      
      Add a way to validate the events at most events and when crossing a buffer
      page. This will help make sure that the deltas are always correct. This test
      will detect if they are ever corrupted.
      
      The test adds a high overhead to the ring buffer recording, as it does the
      audit for almost every event, and should only be used for testing the ring
      buffer.
      
      This will catch the bug that is fixed by commit 55ea4cf4 ("ring-buffer:
      Update write stamp with the correct ts"), which is not applied when this
      commit is applied.
      Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      5b7be9c7
  4. 19 11月, 2020 1 次提交
  5. 17 11月, 2020 1 次提交
  6. 14 11月, 2020 4 次提交
  7. 11 11月, 2020 6 次提交
  8. 06 11月, 2020 11 次提交
  9. 04 11月, 2020 1 次提交
  10. 03 11月, 2020 3 次提交
  11. 02 11月, 2020 8 次提交
    • S
      ftrace: Handle tracing when switching between context · 726b3d3f
      Steven Rostedt (VMware) 提交于
      When an interrupt or NMI comes in and switches the context, there's a delay
      from when the preempt_count() shows the update. As the preempt_count() is
      used to detect recursion having each context have its own bit get set when
      tracing starts, and if that bit is already set, it is considered a recursion
      and the function exits. But if this happens in that section where context
      has changed but preempt_count() has not been updated, this will be
      incorrectly flagged as a recursion.
      
      To handle this case, create another bit call TRANSITION and test it if the
      current context bit is already set. Flag the call as a recursion if the
      TRANSITION bit is already set, and if not, set it and continue. The
      TRANSITION bit will be cleared normally on the return of the function that
      set it, or if the current context bit is clear, set it and clear the
      TRANSITION bit to allow for another transition between the current context
      and an even higher one.
      
      Cc: stable@vger.kernel.org
      Fixes: edc15caf ("tracing: Avoid unnecessary multiple recursion checks")
      Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      726b3d3f
    • S
      ftrace: Fix recursion check for NMI test · ee11b93f
      Steven Rostedt (VMware) 提交于
      The code that checks recursion will work to only do the recursion check once
      if there's nested checks. The top one will do the check, the other nested
      checks will see recursion was already checked and return zero for its "bit".
      On the return side, nothing will be done if the "bit" is zero.
      
      The problem is that zero is returned for the "good" bit when in NMI context.
      This will set the bit for NMIs making it look like *all* NMI tracing is
      recursing, and prevent tracing of anything in NMI context!
      
      The simple fix is to return "bit + 1" and subtract that bit on the end to
      get the real bit.
      
      Cc: stable@vger.kernel.org
      Fixes: edc15caf ("tracing: Avoid unnecessary multiple recursion checks")
      Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      ee11b93f
    • Q
      tracing: Fix out of bounds write in get_trace_buf · c1acb4ac
      Qiujun Huang 提交于
      The nesting count of trace_printk allows for 4 levels of nesting. The
      nesting counter starts at zero and is incremented before being used to
      retrieve the current context's buffer. But the index to the buffer uses the
      nesting counter after it was incremented, and not its original number,
      which in needs to do.
      
      Link: https://lkml.kernel.org/r/20201029161905.4269-1-hqjagain@gmail.com
      
      Cc: stable@vger.kernel.org
      Fixes: 3d9622c1 ("tracing: Add barrier to trace_printk() buffer nesting modification")
      Signed-off-by: NQiujun Huang <hqjagain@gmail.com>
      Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      c1acb4ac
    • L
      Linux 5.10-rc2 · 3cea11cd
      Linus Torvalds 提交于
      3cea11cd
    • L
      Merge tag 'x86-urgent-2020-11-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 7b56fbd8
      Linus Torvalds 提交于
      Pull x86 fixes from Thomas Gleixner:
       "Three fixes all related to #DB:
      
         - Handle the BTF bit correctly so it doesn't get lost due to a kernel
           #DB
      
         - Only clear and set the virtual DR6 value used by ptrace on user
           space triggered #DB. A kernel #DB must leave it alone to ensure
           data consistency for ptrace.
      
         - Make the bitmasking of the virtual DR6 storage correct so it does
           not lose DR_STEP"
      
      * tag 'x86-urgent-2020-11-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/debug: Fix DR_STEP vs ptrace_get_debugreg(6)
        x86/debug: Only clear/set ->virtual_dr6 for userspace #DB
        x86/debug: Fix BTF handling
      7b56fbd8
    • L
      Merge tag 'timers-urgent-2020-11-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 4312e0e8
      Linus Torvalds 提交于
      Pull timer fixes from Thomas Gleixner:
       "A few fixes for timers/timekeeping:
      
         - Prevent undefined behaviour in the timespec64_to_ns() conversion
           which is used for converting user supplied time input to
           nanoseconds. It lacked overflow protection.
      
         - Mark sched_clock_read_begin/retry() to prevent recursion in the
           tracer
      
         - Remove unused debug functions in the hrtimer and timerlist code"
      
      * tag 'timers-urgent-2020-11-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        time: Prevent undefined behaviour in timespec64_to_ns()
        timers: Remove unused inline funtion debug_timer_free()
        hrtimer: Remove unused inline function debug_hrtimer_free()
        time/sched_clock: Mark sched_clock_read_begin/retry() as notrace
      4312e0e8
    • L
      Merge tag 'smp-urgent-2020-11-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 82423b46
      Linus Torvalds 提交于
      Pull smp fix from Thomas Gleixner:
       "A single fix for stop machine.
      
        Mark functions no trace to prevent a crash caused by recursion when
        enabling or disabling a tracer on RISC-V (probably all architectures
        which patch through stop machine)"
      
      * tag 'smp-urgent-2020-11-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        stop_machine, rcu: Mark functions as notrace
      82423b46
    • L
      Merge tag 'locking-urgent-2020-11-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 8d99084e
      Linus Torvalds 提交于
      Pull locking fixes from Thomas Gleixner:
       "A couple of locking fixes:
      
         - Fix incorrect failure injection handling in the fuxtex code
      
         - Prevent a preemption warning in lockdep when tracking
           local_irq_enable() and interrupts are already enabled
      
         - Remove more raw_cpu_read() usage from lockdep which causes state
           corruption on !X86 architectures.
      
         - Make the nr_unused_locks accounting in lockdep correct again"
      
      * tag 'locking-urgent-2020-11-01' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        lockdep: Fix nr_unused_locks accounting
        locking/lockdep: Remove more raw_cpu_read() usage
        futex: Fix incorrect should_fail_futex() handling
        lockdep: Fix preemption WARN for spurious IRQ-enable
      8d99084e