Skip to content
  1. Jan 14, 2022
    • Yuntao Wang's avatar
      tracing: Remove duplicate warnings when calling trace_create_file() · 6e1b4bd1
      Yuntao Wang authored
      
      
      Since the same warning message is already printed in the
      trace_create_file() function, there is no need to print it again.
      
      Link: https://lkml.kernel.org/r/20220109162232.361747-1-ytcoode@gmail.com
      
      Signed-off-by: default avatarYuntao Wang <ytcoode@gmail.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      6e1b4bd1
    • Xiangyang Zhang's avatar
      tracing/kprobes: 'nmissed' not showed correctly for kretprobe · dfea08a2
      Xiangyang Zhang authored
      The 'nmissed' column of the 'kprobe_profile' file for kretprobe is
      not showed correctly, kretprobe can be skipped by two reasons,
      shortage of kretprobe_instance which is counted by tk->rp.nmissed,
      and kprobe itself is missed by some reason, so to show the sum.
      
      Link: https://lkml.kernel.org/r/20220107150242.5019-1-xyz.sun.ok@gmail.com
      
      Cc: stable@vger.kernel.org
      Fixes: 4a846b44
      
       ("tracing/kprobes: Cleanup kprobe tracer code")
      Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarXiangyang Zhang <xyz.sun.ok@gmail.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      dfea08a2
    • Steven Rostedt's avatar
      tracing: Add test for user space strings when filtering on string pointers · 77360f9b
      Steven Rostedt authored
      
      
      Pingfan reported that the following causes a fault:
      
        echo "filename ~ \"cpu\"" > events/syscalls/sys_enter_openat/filter
        echo 1 > events/syscalls/sys_enter_at/enable
      
      The reason is that trace event filter treats the user space pointer
      defined by "filename" as a normal pointer to compare against the "cpu"
      string. The following bug happened:
      
       kvm-03-guest16 login: [72198.026181] BUG: unable to handle page fault for address: 00007fffaae8ef60
       #PF: supervisor read access in kernel mode
       #PF: error_code(0x0001) - permissions violation
       PGD 80000001008b7067 P4D 80000001008b7067 PUD 2393f1067 PMD 2393ec067 PTE 8000000108f47867
       Oops: 0001 [#1] PREEMPT SMP PTI
       CPU: 1 PID: 1 Comm: systemd Kdump: loaded Not tainted 5.14.0-32.el9.x86_64 #1
       Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011
       RIP: 0010:strlen+0x0/0x20
       Code: 48 89 f9 74 09 48 83 c1 01 80 39 00 75 f7 31 d2 44 0f b6 04 16 44 88 04 11
             48 83 c2 01 45 84 c0 75 ee c3 0f 1f 80 00 00 00 00 <80> 3f 00 74 10 48 89 f8
             48 83 c0 01 80 38 00 75 f7 48 29 f8 c3 31
       RSP: 0018:ffffb5b900013e48 EFLAGS: 00010246
       RAX: 0000000000000018 RBX: ffff8fc1c49ede00 RCX: 0000000000000000
       RDX: 0000000000000020 RSI: ffff8fc1c02d601c RDI: 00007fffaae8ef60
       RBP: 00007fffaae8ef60 R08: 0005034f4ddb8ea4 R09: 0000000000000000
       R10: ffff8fc1c02d601c R11: 0000000000000000 R12: ffff8fc1c8a6e380
       R13: 0000000000000000 R14: ffff8fc1c02d6010 R15: ffff8fc1c00453c0
       FS:  00007fa86123db40(0000) GS:ffff8fc2ffd00000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 00007fffaae8ef60 CR3: 0000000102880001 CR4: 00000000007706e0
       DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
       DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
       PKRU: 55555554
       Call Trace:
        filter_pred_pchar+0x18/0x40
        filter_match_preds+0x31/0x70
        ftrace_syscall_enter+0x27a/0x2c0
        syscall_trace_enter.constprop.0+0x1aa/0x1d0
        do_syscall_64+0x16/0x90
        entry_SYSCALL_64_after_hwframe+0x44/0xae
       RIP: 0033:0x7fa861d88664
      
      The above happened because the kernel tried to access user space directly
      and triggered a "supervisor read access in kernel mode" fault. Worse yet,
      the memory could not even be loaded yet, and a SEGFAULT could happen as
      well. This could be true for kernel space accessing as well.
      
      To be even more robust, test both kernel and user space strings. If the
      string fails to read, then simply have the filter fail.
      
      Note, TASK_SIZE is used to determine if the pointer is user or kernel space
      and the appropriate strncpy_from_kernel/user_nofault() function is used to
      copy the memory. For some architectures, the compare to TASK_SIZE may always
      pick user space or kernel space. If it gets it wrong, the only thing is that
      the filter will fail to match. In the future, this needs to be fixed to have
      the event denote which should be used. But failing a filter is much better
      than panicing the machine, and that can be solved later.
      
      Link: https://lore.kernel.org/all/20220107044951.22080-1-kernelfans@gmail.com/
      Link: https://lkml.kernel.org/r/20220110115532.536088fd@gandalf.local.home
      
      Cc: stable@vger.kernel.org
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Tom Zanussi <zanussi@kernel.org>
      Reported-by: default avatarPingfan Liu <kernelfans@gmail.com>
      Tested-by: default avatarPingfan Liu <kernelfans@gmail.com>
      Fixes: 87a342f5
      
       ("tracing/filters: Support filtering for char * strings")
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      77360f9b
    • Steven Rostedt's avatar
      tracing: Have syscall trace events use trace_event_buffer_lock_reserve() · 3e2a56e6
      Steven Rostedt authored
      
      
      Currently, the syscall trace events call trace_buffer_lock_reserve()
      directly, which means that it misses out on some of the filtering
      optimizations provided by the helper function
      trace_event_buffer_lock_reserve(). Have the syscall trace events call that
      instead, as it was missed when adding the update to use the temp buffer
      when filtering.
      
      Link: https://lkml.kernel.org/r/20220107225839.823118570@goodmis.org
      
      Cc: stable@vger.kernel.org
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Tom Zanussi <zanussi@kernel.org>
      Reviewed-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Fixes: 0fc1b09f
      
       ("tracing: Use temp buffer when filtering events")
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      3e2a56e6
    • Geliang Tang's avatar
      tracing: Fix mismatched comment in __string_len · ecbe794e
      Geliang Tang authored
      
      
      Here __assign_str_len() should be used for the __string_len type, instead
      of __assign_str() in the comment.
      
      Link: https://lkml.kernel.org/r/5c012db463392d0e6d4f0636203d778962ad060a.1640170494.git.geliang.tang@suse.com
      
      Reviewed-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Fixes: 883b4aee
      
       ("tracing: Add trace_event helper macros __string_len() and __assign_str_len()")
      Signed-off-by: default avatarGeliang Tang <geliang.tang@suse.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      ecbe794e
    • Steven Rostedt (VMware)'s avatar
      ftrace: Add test to make sure compiled time sorts work · 8147dc78
      Steven Rostedt (VMware) authored
      
      
      Now that ftrace function pointers are sorted at compile time, add a test
      that makes sure they are sorted at run time. This test is only run if it is
      configured in.
      
      Link: https://lkml.kernel.org/r/20211206151858.4d21a24d@gandalf.local.home
      
      Cc: Yinan Liu <yinan@linux.alibaba.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      8147dc78
    • Yinan Liu's avatar
      scripts: ftrace - move the sort-processing in ftrace_init · 72b3942a
      Yinan Liu authored
      
      
      When the kernel starts, the initialization of ftrace takes
      up a portion of the time (approximately 6~8ms) to sort mcount
      addresses. We can save this time by moving mcount-sorting to
      compile time.
      
      Link: https://lkml.kernel.org/r/20211212113358.34208-2-yinan@linux.alibaba.com
      
      Signed-off-by: default avatarYinan Liu <yinan@linux.alibaba.com>
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      72b3942a
    • Xiaoke Wang's avatar
      tracing/probes: check the return value of kstrndup() for pbuf · 1c1857d4
      Xiaoke Wang authored
      
      
      kstrndup() is a memory allocation-related function, it returns NULL when
      some internal memory errors happen. It is better to check the return
      value of it so to catch the memory error in time.
      
      Link: https://lkml.kernel.org/r/tencent_4D6E270731456EB88712ED7F13883C334906@qq.com
      
      Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Fixes: a42e3c4d
      
       ("tracing/probe: Add immediate string parameter support")
      Signed-off-by: default avatarXiaoke Wang <xkernel.wang@foxmail.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      1c1857d4
    • Xiaoke Wang's avatar
      tracing/uprobes: Check the return value of kstrdup() for tu->filename · 8c722424
      Xiaoke Wang authored
      
      
      kstrdup() returns NULL when some internal memory errors happen, it is
      better to check the return value of it so to catch the memory error in
      time.
      
      Link: https://lkml.kernel.org/r/tencent_3C2E330722056D7891D2C83F29C802734B06@qq.com
      
      Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Fixes: 33ea4b24
      
       ("perf/core: Implement the 'perf_uprobe' PMU")
      Signed-off-by: default avatarXiaoke Wang <xkernel.wang@foxmail.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      8c722424
    • Sebastian Andrzej Siewior's avatar
      tracing: Account bottom half disabled sections. · 289e7b0f
      Sebastian Andrzej Siewior authored
      
      
      Disabling only bottom halves via local_bh_disable() disables also
      preemption but this remains invisible to tracing. On a CONFIG_PREEMPT
      kernel one might wonder why there is no scheduling happening despite the
      N flag in the trace. The reason might be the a rcu_read_lock_bh()
      section.
      
      Add a 'b' to the tracing output if in task context with disabled bottom
      halves.
      
      Link: https://lkml.kernel.org/r/YbcbtdtC/bjCKo57@linutronix.de
      
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      289e7b0f
  2. Jan 11, 2022
  3. Dec 11, 2021
  4. Dec 08, 2021
    • John Keeping's avatar
      tracing: Make trace_marker{,_raw} stream-like · 2972e305
      John Keeping authored
      
      
      The tracing marker files are write-only streams with no meaningful
      concept of file position.  Using stream_open() to mark them as
      stream-link indicates this and has the added advantage that a single
      file descriptor can now be used from multiple threads without contention
      thanks to clearing FMODE_ATOMIC_POS.
      
      Note that this has the potential to break existing userspace by since
      both lseek(2) and pwrite(2) will now return ESPIPE when previously lseek
      would have updated the stored offset and pwrite would have appended to
      the trace.  A survey of libtracefs and several other projects found to
      use trace_marker(_raw) [1][2][3] suggests that everyone limits
      themselves to calling write(2) and close(2) on these file descriptors so
      there is a good chance this will go unnoticed and the benefits of
      reduced overhead and lock contention seem worth the risk.
      
      [1] https://github.com/google/perfetto
      [2] https://github.com/intel/media-driver/
      [3] https://w1.fi/cgit/hostap/
      
      Link: https://lkml.kernel.org/r/20211207142558.347029-1-john@metanate.com
      
      Signed-off-by: default avatarJohn Keeping <john@metanate.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      2972e305
  5. Dec 07, 2021
  6. Dec 06, 2021
    • Linus Torvalds's avatar
      Linux 5.16-rc4 · 0fcfb00b
      Linus Torvalds authored
      0fcfb00b
    • Linus Torvalds's avatar
      Merge tag 'for-5.16/parisc-6' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux · 268ba095
      Linus Torvalds authored
      Pull parisc fixes from Helge Deller:
       "Some bug and warning fixes:
      
         - Fix "make install" to use debians "installkernel" script which is
           now in /usr/sbin
      
         - Fix the bindeb-pkg make target by giving the correct KBUILD_IMAGE
           file name
      
         - Fix compiler warnings by annotating parisc agp init functions with
           __init
      
         - Fix timekeeping on SMP machines with dual-core CPUs
      
         - Enable some more config options in the 64-bit defconfig"
      
      * tag 'for-5.16/parisc-6' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
        parisc: Mark cr16 CPU clocksource unstable on all SMP machines
        parisc: Fix "make install" on newer debian releases
        parisc/agp: Annotate parisc agp init functions with __init
        parisc: Enable sata sil, audit and usb support on 64-bit defconfig
        parisc: Fix KBUILD_IMAGE for self-extracting kernel
      268ba095
    • Linus Torvalds's avatar
      Merge tag 'usb-5.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 94420704
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are some small USB fixes for a few reported issues. Included in
        here are:
      
         - xhci fix for a _much_ reported regression. I don't think there's a
           community distro that has not reported this problem yet :(
      
         - new USB quirk addition
      
         - cdns3 minor fixes
      
         - typec regression fix.
      
        All of these have been in linux-next with no reported problems, and
        the xhci fix has been reported by many to resolve their reported
        problem"
      
      * tag 'usb-5.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        usb: cdnsp: Fix a NULL pointer dereference in cdnsp_endpoint_init()
        usb: cdns3: gadget: fix new urb never complete if ep cancel previous requests
        usb: typec: tcpm: Wait in SNK_DEBOUNCED until disconnect
        USB: NO_LPM quirk Lenovo Powered USB-C Travel Hub
        xhci: Fix commad ring abort, write all 64 bits to CRCR register.
      94420704
    • Linus Torvalds's avatar
      Merge tag 'tty-5.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · 51639539
      Linus Torvalds authored
      Pull tty/serial fixes from Greg KH:
       "Here are some small TTY and Serial driver fixes for 5.16-rc4 to
        resolve a number of reported problems.
      
        They include:
      
         - liteuart serial driver fixes
      
         - 8250_pci serial driver fixes for pericom devices
      
         - 8250 RTS line control fix while in RS-485 mode
      
         - tegra serial driver fix
      
         - msm_serial driver fix
      
         - pl011 serial driver new id
      
         - fsl_lpuart revert of broken change
      
         - 8250_bcm7271 serial driver fix
      
         - MAINTAINERS file update for rpmsg tty driver that came in 5.16-rc1
      
         - vgacon fix for reported problem
      
        All of these, except for the 8250_bcm7271 fix have been in linux-next
        with no reported problem. The 8250_bcm7271 fix was added to the tree
        on Friday so no chance to be linux-next yet. But it should be fine as
        the affected developers submitted it"
      
      * tag 'tty-5.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
        serial: 8250_bcm7271: UART errors after resuming from S2
        serial: 8250_pci: rewrite pericom_do_set_divisor()
        serial: 8250_pci: Fix ACCES entries in pci_serial_quirks array
        serial: 8250: Fix RTS modem control while in rs485 mode
        Revert "tty: serial: fsl_lpuart: drop earlycon entry for i.MX8QXP"
        serial: tegra: Change lower tolerance baud rate limit for tegra20 and tegra30
        serial: liteuart: relax compile-test dependencies
        serial: liteuart: fix minor-number leak on probe errors
        serial: liteuart: fix use-after-free and memleak on unbind
        serial: liteuart: Fix NULL pointer dereference in ->remove()
        vgacon: Propagate console boot parameters before calling `vc_resize'
        tty: serial: msm_serial: Deactivate RX DMA for polling support
        serial: pl011: Add ACPI SBSA UART match id
        serial: core: fix transmit-buffer reset and memleak
        MAINTAINERS: Add rpmsg tty driver maintainer
      51639539
    • Linus Torvalds's avatar
      Merge tag 'timers_urgent_for_v5.16_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 7587a4a5
      Linus Torvalds authored
      Pull timer fix from Borislav Petkov:
      
       - Prevent a tick storm when a dedicated timekeeper CPU in nohz_full
         mode runs for prolonged periods with interrupts disabled and ends up
         programming the next tick in the past, leading to that storm
      
      * tag 'timers_urgent_for_v5.16_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        timers/nohz: Last resort update jiffies on nohz_full IRQ entry
      7587a4a5
    • Linus Torvalds's avatar
      Merge tag 'sched_urgent_for_v5.16_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 1d213767
      Linus Torvalds authored
      Pull scheduler fixes from Borislav Petkov:
      
       - Properly init uclamp_flags of a runqueue, on first enqueuing
      
       - Fix preempt= callback return values
      
       - Correct utime/stime resource usage reporting on nohz_full to return
         the proper times instead of shorter ones
      
      * tag 'sched_urgent_for_v5.16_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        sched/uclamp: Fix rq->uclamp_max not set on first enqueue
        preempt/dynamic: Fix setup_preempt_mode() return value
        sched/cputime: Fix getrusage(RUSAGE_THREAD) with nohz_full
      1d213767