Skip to content
  1. Jun 26, 2021
    • Steven Rostedt (VMware)'s avatar
      tracing: Add LATENCY_FS_NOTIFY to define if latency_fsnotify() is defined · 6880c987
      Steven Rostedt (VMware) authored
      
      
      With the coming addition of the osnoise tracer, the configs needed to
      include the latency_fsnotify() has become more complex, and to keep the
      declaration in the header file the same as in the C file, just have the
      logic needed to define it in one place, and that defines LATENCY_FS_NOTIFY
      which will be used in the C code.
      
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      6880c987
    • Steven Rostedt's avatar
      trace: Add __print_ns_to_secs() and __print_ns_without_secs() helpers · 62de4f29
      Steven Rostedt authored
      
      
      To have nanosecond output displayed in a more human readable format, its
      nicer to convert it to a seconds format (XXX.YYYYYYYYY). The problem is that
      to do so, the numbers must be divided by NSEC_PER_SEC, and moded too. But as
      these numbers are 64 bit, this can not be done simply with '/' and '%'
      operators, but must use do_div() instead.
      
      Instead of performing the expensive do_div() in the hot path of the
      tracepoint, it is more efficient to perform it during the output phase. But
      passing in do_div() can confuse the parser, and do_div() doesn't work
      exactly like a normal C function. It modifies the number in place, and we
      don't want to modify the actual values in the ring buffer.
      
      Two helper functions are now created:
      
        __print_ns_to_secs() and __print_ns_without_secs()
      
      They both take a value of nanoseconds, and the former will return that
      number divided by NSEC_PER_SEC, and the latter will mod it with NSEC_PER_SEC
      giving a way to print a nice human readable format:
      
       __print_fmt("time=%llu.%09u",
      	__print_ns_to_secs(REC->nsec_val),
      	__print_ns_without_secs(REC->nsec_val))
      
      Link: https://lkml.kernel.org/r/e503b903045496c4ccde52843e1e318b422f7a56.1624372313.git.bristot@redhat.com
      
      Cc: Phil Auld <pauld@redhat.com>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Kate Carcia <kcarcia@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Alexandre Chartre <alexandre.chartre@oracle.com>
      Cc: Clark Willaims <williams@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: x86@kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@redhat.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      62de4f29
    • Daniel Bristot de Oliveira's avatar
      trace/hwlat: Remove printk from sampling loop · aa892f8c
      Daniel Bristot de Oliveira authored
      
      
      hwlat has some time operation checks on the sample loop, and it is
      currently using pr_err (printk) to report them. The problem is that
      this can lead the system to an unresponsible state due to an overflow of
      printk messages. This problem can be mitigated by writing the error
      message to the trace buffer.
      
      Remove the printk messages from the sampling loop, switching the to
      messages in the trace buffer.
      
      No functional change.
      
      Link: https://lkml.kernel.org/r/9d77c34869748aa105e965c769d24642914eea3a.1624372313.git.bristot@redhat.com
      
      Cc: Phil Auld <pauld@redhat.com>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Kate Carcia <kcarcia@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Alexandre Chartre <alexandre.chartre@oracle.com>
      Cc: Clark Willaims <williams@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: x86@kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@redhat.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      aa892f8c
    • Daniel Bristot de Oliveira's avatar
      trace/hwlat: Use trace_min_max_param for width and window params · f27a1c9e
      Daniel Bristot de Oliveira authored
      
      
      Use the trace_min_max_param to reduce code duplication.
      
      No functional change.
      
      Link: https://lkml.kernel.org/r/b91accd5a7c6c14ea02d3379aae974ba22b47dd6.1624372313.git.bristot@redhat.com
      
      Cc: Phil Auld <pauld@redhat.com>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Kate Carcia <kcarcia@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Alexandre Chartre <alexandre.chartre@oracle.com>
      Cc: Clark Willaims <williams@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: x86@kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@redhat.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      f27a1c9e
    • Daniel Bristot de Oliveira's avatar
      trace: Add a generic function to read/write u64 values from tracefs · bc87cf0a
      Daniel Bristot de Oliveira authored
      
      
      The hwlat detector and (in preparation for) the osnoise/timerlat tracers
      have a set of u64 parameters that the user can read/write via tracefs.
      For instance, we have hwlat_detector's window and width.
      
      To reduce the code duplication, hwlat's window and width share the same
      read function. However, they do not share the write functions because
      they do different parameter checks. For instance, the width needs to
      be smaller than the window, while the window needs to be larger
      than the window. The same pattern repeats on osnoise/timerlat, and
      a large portion of the code was devoted to the write function.
      
      Despite having different checks, the write functions have the same
      structure:
      
         read a user-space buffer
         take the lock that protects the value
         check for minimum and maximum acceptable values
            save the value
         release the lock
         return success or error
      
      To reduce the code duplication also in the write functions, this patch
      provides a generic read and write implementation for u64 values that
      need to be within some minimum and/or maximum parameters, while
      (potentially) being protected by a lock.
      
      To use this interface, the structure trace_min_max_param needs to be
      filled:
      
       struct trace_min_max_param {
               struct mutex    *lock;
               u64             *val;
               u64             *min;
               u64             *max;
       };
      
      The desired value is stored on the variable pointed by *val. If *min
      points to a minimum acceptable value, it will be checked during the
      write operation. Likewise, if *max points to a maximum allowable value,
      it will be checked during the write operation. Finally, if *lock points
      to a mutex, it will be taken at the beginning of the operation and
      released at the end.
      
      The definition of a trace_min_max_param needs to passed as the
      (private) *data for tracefs_create_file(), and the trace_min_max_fops
      (added by this patch) as the *fops file_operations.
      
      Link: https://lkml.kernel.org/r/3e35760a7c8b5c55f16ae5ad5fc54a0e71cbe647.1624372313.git.bristot@redhat.com
      
      Cc: Phil Auld <pauld@redhat.com>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Kate Carcia <kcarcia@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Alexandre Chartre <alexandre.chartre@oracle.com>
      Cc: Clark Willaims <williams@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: x86@kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@redhat.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      bc87cf0a
    • Daniel Bristot de Oliveira's avatar
      trace/hwlat: Implement the per-cpu mode · f46b1652
      Daniel Bristot de Oliveira authored
      
      
      Implements the per-cpu mode in which a sampling thread is created for
      each cpu in the "cpus" (and tracing_mask).
      
      The per-cpu mode has the potention to speed up the hwlat detection by
      running on multiple CPUs at the same time, at the cost of higher cpu
      usage with irqs disabled. Use with care.
      
      [
        Changed get_cpu_data() to static.
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      ]
      
      Link: https://lkml.kernel.org/r/ec06d0ab340e8460d293772faba19ad8a5c371aa.1624372313.git.bristot@redhat.com
      
      Cc: Phil Auld <pauld@redhat.com>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Kate Carcia <kcarcia@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Alexandre Chartre <alexandre.chartre@oracle.com>
      Cc: Clark Willaims <williams@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: x86@kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@redhat.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      f46b1652
  2. Jun 25, 2021
    • Daniel Bristot de Oliveira's avatar
      trace/hwlat: Switch disable_migrate to mode none · 7bb7d802
      Daniel Bristot de Oliveira authored
      
      
      When in the round-robin mode, if the tracer detects a change in the
      hwlatd thread affinity by an external tool, e.g., taskset, the
      round-robin logic is disabled. The disable_migrate variable currently
      tracks this.
      
      With the addition of the "mode" config and the mode "none," the
      disable_migrate logic is equivalent to switch to the "none" mode.
      
      Hence, instead of using a hidden variable to track this behavior,
      switch the mode to none, informing the user about this change.
      
      Link: https://lkml.kernel.org/r/a679af672458d6b1f62252605905c5214030f247.1624372313.git.bristot@redhat.com
      
      Cc: Phil Auld <pauld@redhat.com>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Kate Carcia <kcarcia@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Alexandre Chartre <alexandre.chartre@oracle.com>
      Cc: Clark Willaims <williams@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: x86@kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@redhat.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      7bb7d802
    • Daniel Bristot de Oliveira's avatar
      trace/hwlat: Implement the mode config option · 8fa826b7
      Daniel Bristot de Oliveira authored
      
      
      Provides the "mode" config to the hardware latency detector. hwlatd has
      two different operation modes. The default mode is the "round-robin" one,
      in which a single hwlatd thread runs, migrating among the allowed CPUs in a
      "round-robin" fashion. This is the current behavior.
      
      The "none" sets the allowed cpumask for a single hwlatd thread at the
      startup, but skips the round-robin, letting the scheduler handle the
      migration.
      
      In preparation to the per-cpu mode.
      
      Link: https://lkml.kernel.org/r/f3b1271262aa030c680e26615c1b9b2d71e55e92.1624372313.git.bristot@redhat.com
      
      Cc: Phil Auld <pauld@redhat.com>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Kate Carcia <kcarcia@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Alexandre Chartre <alexandre.chartre@oracle.com>
      Cc: Clark Willaims <williams@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: x86@kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@redhat.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      8fa826b7
    • Daniel Bristot de Oliveira's avatar
      trace/hwlat: Fix Clark's email · bb1b24cf
      Daniel Bristot de Oliveira authored
      
      
      Clark's email is williams@redhat.com.
      
      No functional change.
      
      Link: https://lkml.kernel.org/r/6fa4b49e17ab8a1ff19c335ab7cde38d8afb0e29.1624372313.git.bristot@redhat.com
      
      Cc: Phil Auld <pauld@redhat.com>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Kate Carcia <kcarcia@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Alexandre Chartre <alexandre.chartre@oracle.com>
      Cc: Clark Willaims <williams@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: x86@kernel.org
      Cc: linux-doc@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarDaniel Bristot de Oliveira <bristot@redhat.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      bb1b24cf
    • Steven Rostedt (VMware)'s avatar
      bootconfig/tracing/ktest: Add ktest examples of testing bootconfig · 171ec346
      Steven Rostedt (VMware) authored
      
      
      bootconfig is a new feature that appends scripts onto the initrd, and the
      kernel executes the scripts as an extended kernel command line.
      
      Need to add tests to test that the happened. To test the bootconfig
      properly, the initrd needs to be updated and the kernel rebooted. ktest is
      the perfect solution to perform these tests.
      
      Add a example bootconfig.conf in the tools/testing/ktest/examples/include
      and example bootconfig scripts in tools/testing/ktest/examples/bootconfig
      and also include verifier scripts that ktest will install on the target
      and run to make sure that the bootconfig options in the scripts took place
      after the target rebooted with the new initrd update.
      
      Link: https://lkml.kernel.org/r/20210618112647.6a81dec5@oasis.local.home
      
      Reviewed-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      171ec346
  3. Jun 18, 2021
    • Steven Rostedt (VMware)'s avatar
      tracing: Have ftrace_dump_on_oops kernel parameter take numbers · 2db7ab6b
      Steven Rostedt (VMware) authored
      
      
      The kernel parameter for ftrace_dump_on_oops can take a single assignment.
      That is, it can be:
      
        ftrace_dump_on_oops or ftrace_dump_on_oops=orig_cpu
      
      But the content in the sysctl file is a number.
      
       0 for disabled
       1 for ftrace_dump_on_oops (all CPUs)
       2 for ftrace_dump_on_oops (orig CPU)
      
      Allow the kernel command line to take a number as well to match the sysctl
      numbers.
      
      That is:
      
        ftrace_dump_on_oops=1 is the same as ftrace_dump_on_oops
      
      and
      
        ftrace_dump_on_oops=2 is the same as ftrace_dump_on_oops=orig_cpu
      
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      2db7ab6b
  4. Jun 17, 2021
  5. Jun 11, 2021
  6. Jun 10, 2021
  7. Jun 09, 2021
    • Liangyan's avatar
      tracing: Correct the length check which causes memory corruption · 3e08a9f9
      Liangyan authored
      We've suffered from severe kernel crashes due to memory corruption on
      our production environment, like,
      
      Call Trace:
      [1640542.554277] general protection fault: 0000 [#1] SMP PTI
      [1640542.554856] CPU: 17 PID: 26996 Comm: python Kdump: loaded Tainted:G
      [1640542.556629] RIP: 0010:kmem_cache_alloc+0x90/0x190
      [1640542.559074] RSP: 0018:ffffb16faa597df8 EFLAGS: 00010286
      [1640542.559587] RAX: 0000000000000000 RBX: 0000000000400200 RCX:
      0000000006e931bf
      [1640542.560323] RDX: 0000000006e931be RSI: 0000000000400200 RDI:
      ffff9a45ff004300
      [1640542.560996] RBP: 0000000000400200 R08: 0000000000023420 R09:
      0000000000000000
      [1640542.561670] R10: 0000000000000000 R11: 0000000000000000 R12:
      ffffffff9a20608d
      [1640542.562366] R13: ffff9a45ff004300 R14: ffff9a45ff004300 R15:
      696c662f65636976
      [1640542.563128] FS:  00007f45d7c6f740(0000) GS:ffff9a45ff840000(0000)
      knlGS:0000000000000000
      [1640542.563937] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [1640542.564557] CR2: 00007f45d71311a0 CR3: 000000189d63e004 CR4:
      00000000003606e0
      [1640542.565279] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
      0000000000000000
      [1640542.566069] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7:
      0000000000000400
      [1640542.566742] Call Trace:
      [1640542.567009]  anon_vma_clone+0x5d/0x170
      [1640542.567417]  __split_vma+0x91/0x1a0
      [1640542.567777]  do_munmap+0x2c6/0x320
      [1640542.568128]  vm_munmap+0x54/0x70
      [1640542.569990]  __x64_sys_munmap+0x22/0x30
      [1640542.572005]  do_syscall_64+0x5b/0x1b0
      [1640542.573724]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [1640542.575642] RIP: 0033:0x7f45d6e61e27
      
      James Wang has reproduced it stably on the latest 4.19 LTS.
      After some debugging, we finally proved that it's due to ftrace
      buffer out-of-bound access using a debug tool as follows:
      [   86.775200] BUG: Out-of-bounds write at addr 0xffff88aefe8b7000
      [   86.780806]  no_context+0xdf/0x3c0
      [   86.784327]  __do_page_fault+0x252/0x470
      [   86.788367]  do_page_fault+0x32/0x140
      [   86.792145]  page_fault+0x1e/0x30
      [   86.795576]  strncpy_from_unsafe+0x66/0xb0
      [   86.799789]  fetch_memory_string+0x25/0x40
      [   86.804002]  fetch_deref_string+0x51/0x60
      [   86.808134]  kprobe_trace_func+0x32d/0x3a0
      [   86.812347]  kprobe_dispatcher+0x45/0x50
      [   86.816385]  kprobe_ftrace_handler+0x90/0xf0
      [   86.820779]  ftrace_ops_assist_func+0xa1/0x140
      [   86.825340]  0xffffffffc00750bf
      [   86.828603]  do_sys_open+0x5/0x1f0
      [   86.832124]  do_syscall_64+0x5b/0x1b0
      [   86.835900]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      commit b220c049 ("tracing: Check length before giving out
      the filter buffer") adds length check to protect trace data
      overflow introduced in 0fc1b09f, seems that this fix can't prevent
      overflow entirely, the length check should also take the sizeof
      entry->array[0] into account, since this array[0] is filled the
      length of trace data and occupy addtional space and risk overflow.
      
      Link: https://lkml.kernel.org/r/20210607125734.1770447-1-liangyan.peng@linux.alibaba.com
      
      Cc: stable@vger.kernel.org
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Xunlei Pang <xlpang@linux.alibaba.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Fixes: b220c049
      
       ("tracing: Check length before giving out the filter buffer")
      Reviewed-by: default avatarXunlei Pang <xlpang@linux.alibaba.com>
      Reviewed-by: default avataryinbinbin <yinbinbin@alibabacloud.com>
      Reviewed-by: default avatarWetp Zhang <wetp.zy@linux.alibaba.com>
      Tested-by: default avatarJames Wang <jnwang@linux.alibaba.com>
      Signed-off-by: default avatarLiangyan <liangyan.peng@linux.alibaba.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      3e08a9f9
    • Steven Rostedt (VMware)'s avatar
      ftrace: Do not blindly read the ip address in ftrace_bug() · 6c14133d
      Steven Rostedt (VMware) authored
      It was reported that a bug on arm64 caused a bad ip address to be used for
      updating into a nop in ftrace_init(), but the error path (rightfully)
      returned -EINVAL and not -EFAULT, as the bug caused more than one error to
      occur. But because -EINVAL was returned, the ftrace_bug() tried to report
      what was at the location of the ip address, and read it directly. This
      caused the machine to panic, as the ip was not pointing to a valid memory
      address.
      
      Instead, read the ip address with copy_from_kernel_nofault() to safely
      access the memory, and if it faults, report that the address faulted,
      otherwise report what was in that location.
      
      Link: https://lore.kernel.org/lkml/20210607032329.28671-1-mark-pk.tsai@mediatek.com/
      
      Cc: stable@vger.kernel.org
      Fixes: 05736a42
      
       ("ftrace: warn on failure to disable mcount callers")
      Reported-by: default avatarMark-PK Tsai <mark-pk.tsai@mediatek.com>
      Tested-by: default avatarMark-PK Tsai <mark-pk.tsai@mediatek.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      6c14133d
    • Masami Hiramatsu's avatar
      tools/bootconfig: Fix a build error accroding to undefined fallthrough · 824afd55
      Masami Hiramatsu authored
      Since the "fallthrough" is defined only in the kernel, building
      lib/bootconfig.c as a part of user-space tools causes a build
      error.
      
      Add a dummy fallthrough to avoid the build error.
      
      Link: https://lkml.kernel.org/r/162087519356.442660.11385099982318160180.stgit@devnote2
      
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: stable@vger.kernel.org
      Fixes: 4c1ca831
      
       ("Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"")
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      824afd55
    • Zhen Lei's avatar
      tools/bootconfig: Fix error return code in apply_xbc() · e8ba0b2b
      Zhen Lei authored
      Fix to return a negative error code from the error handling case instead
      of 0, as done elsewhere in this function.
      
      Link: https://lkml.kernel.org/r/20210508034216.2277-1-thunder.leizhen@huawei.com
      
      Fixes: a995e6bc
      
       ("tools/bootconfig: Fix to check the write failure correctly")
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      e8ba0b2b
  8. Jun 07, 2021
    • Linus Torvalds's avatar
      Linux 5.13-rc5 · 614124be
      Linus Torvalds authored
      614124be
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 90d56a3d
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "Five small and fairly minor fixes, all in drivers"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: scsi_devinfo: Add blacklist entry for HPE OPEN-V
        scsi: ufs: ufs-mediatek: Fix HCI version in some platforms
        scsi: qedf: Do not put host in qedf_vport_create() unconditionally
        scsi: lpfc: Fix failure to transmit ABTS on FC link
        scsi: target: core: Fix warning on realtime kernels
      90d56a3d
    • Linus Torvalds's avatar
      Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · 20e41d9b
      Linus Torvalds authored
      Pull ext4 fixes from Ted Ts'o:
       "Miscellaneous ext4 bug fixes"
      
      * tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
        ext4: Only advertise encrypted_casefold when encryption and unicode are enabled
        ext4: fix no-key deletion for encrypt+casefold
        ext4: fix memory leak in ext4_fill_super
        ext4: fix fast commit alignment issues
        ext4: fix bug on in ext4_es_cache_extent as ext4_split_extent_at failed
        ext4: fix accessing uninit percpu counter variable with fast_commit
        ext4: fix memory leak in ext4_mb_init_backend on error path.
      20e41d9b
    • Linus Torvalds's avatar
      Merge tag 'arm-soc-fixes-v5.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · decad3e1
      Linus Torvalds authored
      Pull ARM SoC fixes from Olof Johansson:
       "A set of fixes that have been coming in over the last few weeks, the
        usual mix of fixes:
      
         - DT fixups for TI K3
      
         - SATA drive detection fix for TI DRA7
      
         - Power management fixes and a few build warning removals for OMAP
      
         - OP-TEE fix to use standard API for UUID exporting
      
         - DT fixes for a handful of i.MX boards
      
        And a few other smaller items"
      
      * tag 'arm-soc-fixes-v5.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (29 commits)
        arm64: meson: select COMMON_CLK
        soc: amlogic: meson-clk-measure: remove redundant dev_err call in meson_msr_probe()
        ARM: OMAP1: ams-delta: remove unused function ams_delta_camera_power
        bus: ti-sysc: Fix flakey idling of uarts and stop using swsup_sidle_act
        ARM: dts: imx: emcon-avari: Fix nxp,pca8574 #gpio-cells
        ARM: dts: imx7d-pico: Fix the 'tuning-step' property
        ARM: dts: imx7d-meerkat96: Fix the 'tuning-step' property
        arm64: dts: freescale: sl28: var1: fix RGMII clock and voltage
        arm64: dts: freescale: sl28: var4: fix RGMII clock and voltage
        ARM: imx: pm-imx27: Include "common.h"
        arm64: dts: zii-ultra: fix 12V_MAIN voltage
        arm64: dts: zii-ultra: remove second GEN_3V3 regulator instance
        arm64: dts: ls1028a: fix memory node
        bus: ti-sysc: Fix am335x resume hang for usb otg module
        ARM: OMAP2+: Fix build warning when mmc_omap is not built
        ARM: OMAP1: isp1301-omap: Add missing gpiod_add_lookup_table function
        ARM: OMAP1: Fix use of possibly uninitialized irq variable
        optee: use export_uuid() to copy client UUID
        arm64: dts: ti: k3*: Introduce reg definition for interrupt routers
        arm64: dts: ti: k3-am65|j721e|am64: Map the dma / navigator subsystem via explicit ranges
        ...
      decad3e1
    • Linus Torvalds's avatar
      Merge tag 'powerpc-5.13-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · bd7b12aa
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
       "Fix our KVM reverse map real-mode handling since we enabled huge
        vmalloc (in some configurations).
      
        Revert a recent change to our IOMMU code which broke some devices.
      
        Fix KVM handling of FSCR on P7/P8, which could have possibly let a
        guest crash it's Qemu.
      
        Fix kprobes validation of prefixed instructions across page boundary.
      
        Thanks to Alexey Kardashevskiy, Christophe Leroy, Fabiano Rosas,
        Frederic Barrat, Naveen N. Rao, and Nicholas Piggin"
      
      * tag 'powerpc-5.13-5' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        Revert "powerpc/kernel/iommu: Align size for IOMMU_PAGE_SIZE() to save TCEs"
        KVM: PPC: Book3S HV: Save host FSCR in the P7/8 path
        powerpc: Fix reverse map real-mode address lookup with huge vmalloc
        powerpc/kprobes: Fix validation of prefixed instructions across page boundary
      bd7b12aa
    • Linus Torvalds's avatar
      Merge tag 'x86_urgent_for_v5.13-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 773ac53b
      Linus Torvalds authored
      Pull x86 fixes from Borislav Petkov:
       "A bunch of x86/urgent stuff accumulated for the last two weeks so
        lemme unload it to you.
      
        It should be all totally risk-free, of course. :-)
      
         - Fix out-of-spec hardware (1st gen Hygon) which does not implement
           MSR_AMD64_SEV even though the spec clearly states so, and check
           CPUID bits first.
      
         - Send only one signal to a task when it is a SEGV_PKUERR si_code
           type.
      
         - Do away with all the wankery of reserving X amount of memory in the
           first megabyte to prevent BIOS corrupting it and simply and
           unconditionally reserve the whole first megabyte.
      
         - Make alternatives NOP optimization work at an arbitrary position
           within the patched sequence because the compiler can put
           single-byte NOPs for alignment anywhere in the sequence (32-bit
           retpoline), vs our previous assumption that the NOPs are only
           appended.
      
         - Force-disable ENQCMD[S] instructions support and remove
           update_pasid() because of insufficient protection against FPU state
           modification in an interrupt context, among other xstate horrors
           which are being addressed at the moment. This one limits the
           fallout until proper enablement.
      
         - Use cpu_feature_enabled() in the idxd driver so that it can be
           build-time disabled through the defines in disabled-features.h.
      
         - Fix LVT thermal setup for SMI delivery mode by making sure the APIC
           LVT value is read before APIC initialization so that softlockups
           during boot do not happen at least on one machine.
      
         - Mark all legacy interrupts as legacy vectors when the IO-APIC is
           disabled and when all legacy interrupts are routed through the PIC"
      
      * tag 'x86_urgent_for_v5.13-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/sev: Check SME/SEV support in CPUID first
        x86/fault: Don't send SIGSEGV twice on SEGV_PKUERR
        x86/setup: Always reserve the first 1M of RAM
        x86/alternative: Optimize single-byte NOPs at an arbitrary position
        x86/cpufeatures: Force disable X86_FEATURE_ENQCMD and remove update_pasid()
        dmaengine: idxd: Use cpu_feature_enabled()
        x86/thermal: Fix LVT thermal setup for SMI delivery mode
        x86/apic: Mark _all_ legacy interrupts when IO/APIC is missing
      773ac53b
  9. Jun 06, 2021