1. 03 Sep, 2021 1 commit
    • Thomas Gleixner's avatar
      tracing: Add migrate-disabled counter to tracing output. · 54357f0c
      Thomas Gleixner authored
      migrate_disable() forbids task migration to another CPU. It is available
      since v5.11 and has already users such as highmem or BPF. It is useful
      to observe this task state in tracing which already has other states
      like the preemption counter.
      
      Instead of adding the migrate disable counter as a new entry to struct
      trace_entry, which would extend the whole struct by four bytes, it is
      squashed into the preempt-disable counter. The lower four bits represent
      the preemption counter, the upper four bits represent the migrate
      disable counter. Both counter shouldn't exceed 15 but if they do, there
      is a safety net which caps the value at 15.
      
      Add the migrate-disable counter to the trace entry so it shows up in the
      trace. Due to the users mentioned above, it is already possible to
      observe it:
      
      |  bash-1108    [000] ...21    73.950578: rss_stat: mm_id=2213312838 curr=0 type=MM_ANONPAGES size=8192B
      |  bash-1108    [000] d..31    73.951222: irq_disable: caller=flush_tlb_mm_range+0x115/0x130 parent=ptep_clear_flush+0x42/0x50
      |  bash-1108    [000] d..31    73.951222: tlb_flush: pages:1 reason:local mm shootdown (3)
      
      The last value is the migrate-disable counter.
      
      Things that popped up:
      - trace_print_lat_context() does not print the migrate counter. Not sure
        if it should. It is used in "verbose" mode and uses 8 digits and I'm
        not sure ther is something processing the value.
      
      - trace_define_common_fields() now defines a different variable. This
        probably breaks things. No ide what to do in order to preserve the old
        behaviour. Since this is used as a filter it should be split somehow
        to be able to match both nibbles here.
      
      Link: https://lkml.kernel.org/r/20210810132625.ylssabmsrkygokuv@linutronix.deSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      [bigeasy: patch description.]
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      [ SDR: Removed change to common_preempt_count field name ]
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      54357f0c
  2. 24 Aug, 2021 1 commit
  3. 21 Aug, 2021 4 commits
  4. 20 Aug, 2021 2 commits
  5. 19 Aug, 2021 3 commits
  6. 18 Aug, 2021 5 commits
  7. 17 Aug, 2021 1 commit
  8. 16 Aug, 2021 20 commits
  9. 12 Aug, 2021 3 commits
    • Steven Rostedt (VMware)'s avatar
      tracing / histogram: Fix NULL pointer dereference on strcmp() on NULL event name · 5acce0bf
      Steven Rostedt (VMware) authored
      The following commands:
      
       # echo 'read_max u64 size;' > synthetic_events
       # echo 'hist:keys=common_pid:count=count:onmax($count).trace(read_max,count)' > events/syscalls/sys_enter_read/trigger
      
      Causes:
      
       BUG: kernel NULL pointer dereference, address: 0000000000000000
       #PF: supervisor read access in kernel mode
       #PF: error_code(0x0000) - not-present page
       PGD 0 P4D 0
       Oops: 0000 [#1] PREEMPT SMP
       CPU: 4 PID: 1763 Comm: bash Not tainted 5.14.0-rc2-test+ #155
       Hardware name: Hewlett-Packard HP Compaq Pro 6300 SFF/339A, BIOS K01
      v03.03 07/14/2016
       RIP: 0010:strcmp+0xc/0x20
       Code: 75 f7 31 c0 0f b6 0c 06 88 0c 02 48 83 c0 01 84 c9 75 f1 4c 89 c0
      c3 0f 1f 80 00 00 00 00 31 c0 eb 08 48 83 c0 01 84 d2 74 0f <0f> b6 14 07
      3a 14 06 74 ef 19 c0 83 c8 01 c3 31 c0 c3 66 90 48 89
       RSP: 0018:ffffb5fdc0963ca8 EFLAGS: 00010246
       RAX: 0000000000000000 RBX: ffffffffb3a4e040 RCX: 0000000000000000
       RDX: 0000000000000000 RSI: ffff9714c0d0b640 RDI: 0000000000000000
       RBP: 0000000000000000 R08: 00000022986b7cde R09: ffffffffb3a4dff8
       R10: 0000000000000000 R11: 0000000000000000 R12: ffff9714c50603c8
       R13: 0000000000000000 R14: ffff97143fdf9e48 R15: ffff9714c01a2210
       FS:  00007f1fa6785740(0000) GS:ffff9714da400000(0000)
      knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 0000000000000000 CR3: 000000002d863004 CR4: 00000000001706e0
       Call Trace:
        __find_event_file+0x4e/0x80
        action_create+0x6b7/0xeb0
        ? kstrdup+0x44/0x60
        event_hist_trigger_func+0x1a07/0x2130
        trigger_process_regex+0xbd/0x110
        event_trigger_write+0x71/0xd0
        vfs_write+0xe9/0x310
        ksys_write+0x68/0xe0
        do_syscall_64+0x3b/0x90
        entry_SYSCALL_64_after_hwframe+0x44/0xae
       RIP: 0033:0x7f1fa6879e87
      
      The problem was the "trace(read_max,count)" where the "count" should be
      "$count" as "onmax()" only handles variables (although it really should be
      able to figure out that "count" is a field of sys_enter_read). But there's
      a path that does not find the variable and ends up passing a NULL for the
      event, which ends up getting passed to "strcmp()".
      
      Add a check for NULL to return and error on the command with:
      
       # cat error_log
        hist:syscalls:sys_enter_read: error: Couldn't create or find variable
        Command: hist:keys=common_pid:count=count:onmax($count).trace(read_max,count)
                                      ^
      Link: https://lkml.kernel.org/r/20210808003011.4037f8d0@oasis.local.home
      
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: stable@vger.kernel.org
      Fixes: 50450603 tracing: Add 'onmax' hist trigger action support
      Reviewed-by: default avatarTom Zanussi <zanussi@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      5acce0bf
    • Masami Hiramatsu's avatar
      init: Suppress wrong warning for bootconfig cmdline parameter · d0ac5fba
      Masami Hiramatsu authored
      Since the 'bootconfig' command line parameter is handled before
      parsing the command line, it doesn't use early_param(). But in
      this case, kernel shows a wrong warning message about it.
      
      [    0.013714] Kernel command line: ro console=ttyS0  bootconfig console=tty0
      [    0.013741] Unknown command line parameters: bootconfig
      
      To suppress this message, add a dummy handler for 'bootconfig'.
      
      Link: https://lkml.kernel.org/r/162812945097.77369.1849780946468010448.stgit@devnote2
      
      Fixes: 86d1919a ("init: print out unknown kernel parameters")
      Reviewed-by: default avatarAndrew Halaney <ahalaney@redhat.com>
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      d0ac5fba
    • Lukas Bulwahn's avatar
      tracing: define needed config DYNAMIC_FTRACE_WITH_ARGS · 12f9951d
      Lukas Bulwahn authored
      Commit 2860cd8a ("livepatch: Use the default ftrace_ops instead of
      REGS when ARGS is available") intends to enable config LIVEPATCH when
      ftrace with ARGS is available. However, the chain of configs to enable
      LIVEPATCH is incomplete, as HAVE_DYNAMIC_FTRACE_WITH_ARGS is available,
      but the definition of DYNAMIC_FTRACE_WITH_ARGS, combining DYNAMIC_FTRACE
      and HAVE_DYNAMIC_FTRACE_WITH_ARGS, needed to enable LIVEPATCH, is missing
      in the commit.
      
      Fortunately, ./scripts/checkkconfigsymbols.py detects this and warns:
      
      DYNAMIC_FTRACE_WITH_ARGS
      Referencing files: kernel/livepatch/Kconfig
      
      So, define the config DYNAMIC_FTRACE_WITH_ARGS analogously to the already
      existing similar configs, DYNAMIC_FTRACE_WITH_REGS and
      DYNAMIC_FTRACE_WITH_DIRECT_CALLS, in ./kernel/trace/Kconfig to connect the
      chain of configs.
      
      Link: https://lore.kernel.org/kernel-janitors/CAKXUXMwT2zS9fgyQHKUUiqo8ynZBdx2UEUu1WnV_q0OCmknqhw@mail.gmail.com/
      Link: https://lkml.kernel.org/r/20210806195027.16808-1-lukas.bulwahn@gmail.com
      
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Jiri Kosina <jikos@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Miroslav Benes <mbenes@suse.cz>
      Cc: stable@vger.kernel.org
      Fixes: 2860cd8a ("livepatch: Use the default ftrace_ops instead of REGS when ARGS is available")
      Signed-off-by: default avatarLukas Bulwahn <lukas.bulwahn@gmail.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      12f9951d