1. 14 Apr, 2023 1 commit
  2. 11 Apr, 2023 1 commit
  3. 29 Mar, 2023 3 commits
  4. 23 Mar, 2023 1 commit
    • Nathan Chancellor's avatar
      riscv: Handle zicsr/zifencei issues between clang and binutils · e89c2e81
      Nathan Chancellor authored
      There are two related issues that appear in certain combinations with
      clang and GNU binutils.
      
      The first occurs when a version of clang that supports zicsr or zifencei
      via '-march=' [1] (i.e, >= 17.x) is used in combination with a version
      of GNU binutils that do not recognize zicsr and zifencei in the
      '-march=' value (i.e., < 2.36):
      
        riscv64-linux-gnu-ld: -march=rv64i2p0_m2p0_a2p0_c2p0_zicsr2p0_zifencei2p0: Invalid or unknown z ISA extension: 'zifencei'
        riscv64-linux-gnu-ld: failed to merge target specific data of file fs/efivarfs/file.o
        riscv64-linux-gnu-ld: -march=rv64i2p0_m2p0_a2p0_c2p0_zicsr2p0_zifencei2p0: Invalid or unknown z ISA extension: 'zifencei'
        riscv64-linux-gnu-ld: failed to merge target specific data of file fs/efivarfs/super.o
      
      The second occurs when a version of clang that does not support zicsr or
      zifencei via '-march=' (i.e., <= 16.x) is used in combination with a
      version of GNU as that defaults to a newer ISA base spec, which requires
      specifying zicsr and zifencei in the '-march=' value explicitly (i.e, >=
      2.38):
      
        ../arch/riscv/kernel/kexec_relocate.S: Assembler messages:
        ../arch/riscv/kernel/kexec_relocate.S:147: Error: unrecognized opcode `fence.i', extension `zifencei' required
        clang-12: error: assembler command failed with exit code 1 (use -v to see invocation)
      
      This is the same issue addressed by commit 6df2a016 ("riscv: fix
      build with binutils 2.38") (see [2] for additional information) but
      older versions of clang miss out on it because the cc-option check
      fails:
      
        clang-12: error: invalid arch name 'rv64imac_zicsr_zifencei', unsupported standard user-level extension 'zicsr'
        clang-12: error: invalid arch name 'rv64imac_zicsr_zifencei', unsupported standard user-level extension 'zicsr'
      
      To resolve the first issue, only attempt to add zicsr and zifencei to
      the march string when using the GNU assembler 2.38 or newer, which is
      when the default ISA spec was updated, requiring these extensions to be
      specified explicitly. LLVM implements an older version of the base
      specification for all currently released versions, so these instructions
      are available as part of the 'i' extension. If LLVM's implementation is
      updated in the future, a CONFIG_AS_IS_LLVM condition can be added to
      CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI.
      
      To resolve the second issue, use version 2.2 of the base ISA spec when
      using an older version of clang that does not support zicsr or zifencei
      via '-march=', as that is the spec version most compatible with the one
      clang/LLVM implements and avoids the need to specify zicsr and zifencei
      explicitly due to still being a part of 'i'.
      
      [1]: https://github.com/llvm/llvm-project/commit/22e199e6afb1263c943c0c0d4498694e15bf8a16
      [2]: https://lore.kernel.org/ZAxT7T9Xy1Fo3d5W@aurel32.net/
      
      Cc: stable@vger.kernel.org
      Link: https://github.com/ClangBuiltLinux/linux/issues/1808Co-developed-by: default avatarConor Dooley <conor.dooley@microchip.com>
      Signed-off-by: default avatarConor Dooley <conor.dooley@microchip.com>
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Acked-by: default avatarConor Dooley <conor.dooley@microchip.com>
      Link: https://lore.kernel.org/r/20230313-riscv-zicsr-zifencei-fiasco-v1-1-dd1b7840a551@kernel.orgSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      e89c2e81
  5. 21 Mar, 2023 1 commit
  6. 15 Mar, 2023 1 commit
  7. 09 Mar, 2023 5 commits
    • Palmer Dabbelt's avatar
      Merge patch series "riscv: asid: switch to alternative way to fix stale TLB entries" · 9b7fef25
      Palmer Dabbelt authored
      Sergey Matyukevich <geomatsi@gmail.com> says:
      
      Some time ago two different patches have been posted to fix stale TLB
      entries that caused applications crashes.
      
      The patch [0] suggested 'aggregating' mm_cpumask, i.e. current cpu is not
      cleared for the switched-out task in switch_mm function. For additional
      explanations see the commit message by Guo Ren. The same approach is
      used by arc architecture, so another good comment is for switch_mm
      in arch/arc/include/asm/mmu_context.h.
      
      The patch [1] attempted to reduce the number of TLB flushes by deferring
      (and possibly avoiding) them for CPUs not running the task.
      
      Patch [1] has been merged. However we already have two bug reports from
      different vendors. So apparently something is missing in the approach
      suggested in [1]. In both cases the patch [0] fixed the issue.
      
      This patch series reverts [1] and replaces it by [0].
      
      [0] https://lore.kernel.org/linux-riscv/20221111075902.798571-1-guoren@kernel.org/
      [1] https://lore.kernel.org/linux-riscv/20220829205219.283543-1-geomatsi@gmail.com/
      
      * b4-shazam-merge:
        riscv: asid: Fixup stale TLB entry cause application crash
        Revert "riscv: mm: notify remote harts about mmu cache updates"
      
      Link: https://lore.kernel.org/r/20230226150137.1919750-1-geomatsi@gmail.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      9b7fef25
    • Guo Ren's avatar
      riscv: asid: Fixup stale TLB entry cause application crash · 82dd33fd
      Guo Ren authored
      After use_asid_allocator is enabled, the userspace application will
      crash by stale TLB entries. Because only using cpumask_clear_cpu without
      local_flush_tlb_all couldn't guarantee CPU's TLB entries were fresh.
      Then set_mm_asid would cause the user space application to get a stale
      value by stale TLB entry, but set_mm_noasid is okay.
      
      Here is the symptom of the bug:
      unhandled signal 11 code 0x1 (coredump)
         0x0000003fd6d22524 <+4>:     auipc   s0,0x70
         0x0000003fd6d22528 <+8>:     ld      s0,-148(s0) # 0x3fd6d92490
      => 0x0000003fd6d2252c <+12>:    ld      a5,0(s0)
      (gdb) i r s0
      s0          0x8082ed1cc3198b21       0x8082ed1cc3198b21
      (gdb) x /2x 0x3fd6d92490
      0x3fd6d92490:   0xd80ac8a8      0x0000003f
      The core dump file shows that register s0 is wrong, but the value in
      memory is correct. Because 'ld s0, -148(s0)' used a stale mapping entry
      in TLB and got a wrong result from an incorrect physical address.
      
      When the task ran on CPU0, which loaded/speculative-loaded the value of
      address(0x3fd6d92490), then the first version of the mapping entry was
      PTWed into CPU0's TLB.
      When the task switched from CPU0 to CPU1 (No local_tlb_flush_all here by
      asid), it happened to write a value on the address (0x3fd6d92490). It
      caused do_page_fault -> wp_page_copy -> ptep_clear_flush ->
      ptep_get_and_clear & flush_tlb_page.
      The flush_tlb_page used mm_cpumask(mm) to determine which CPUs need TLB
      flush, but CPU0 had cleared the CPU0's mm_cpumask in the previous
      switch_mm. So we only flushed the CPU1 TLB and set the second version
      mapping of the PTE. When the task switched from CPU1 to CPU0 again, CPU0
      still used a stale TLB mapping entry which contained a wrong target
      physical address. It raised a bug when the task happened to read that
      value.
      
         CPU0                               CPU1
         - switch 'task' in
         - read addr (Fill stale mapping
           entry into TLB)
         - switch 'task' out (no tlb_flush)
                                            - switch 'task' in (no tlb_flush)
                                            - write addr cause pagefault
                                              do_page_fault() (change to
                                              new addr mapping)
                                                wp_page_copy()
                                                  ptep_clear_flush()
                                                    ptep_get_and_clear()
                                                    & flush_tlb_page()
                                              write new value into addr
                                            - switch 'task' out (no tlb_flush)
         - switch 'task' in (no tlb_flush)
         - read addr again (Use stale
           mapping entry in TLB)
           get wrong value from old phyical
           addr, BUG!
      
      The solution is to keep all CPUs' footmarks of cpumask(mm) in switch_mm,
      which could guarantee to invalidate all stale TLB entries during TLB
      flush.
      
      Fixes: 65d4b9c5 ("RISC-V: Implement ASID allocator")
      Signed-off-by: default avatarGuo Ren <guoren@linux.alibaba.com>
      Signed-off-by: default avatarGuo Ren <guoren@kernel.org>
      Tested-by: default avatarLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
      Tested-by: default avatarZong Li <zong.li@sifive.com>
      Tested-by: default avatarSergey Matyukevich <sergey.matyukevich@syntacore.com>
      Cc: Anup Patel <apatel@ventanamicro.com>
      Cc: Palmer Dabbelt <palmer@rivosinc.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarAndrew Jones <ajones@ventanamicro.com>
      Link: https://lore.kernel.org/r/20230226150137.1919750-3-geomatsi@gmail.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      82dd33fd
    • Sergey Matyukevich's avatar
      Revert "riscv: mm: notify remote harts about mmu cache updates" · e9210500
      Sergey Matyukevich authored
      This reverts the remaining bits of commit 4bd1d80e ("riscv: mm:
      notify remote harts harts about mmu cache updates").
      
      According to bug reports, suggested approach to fix stale TLB entries
      is not sufficient. It needs to be replaced by a more robust solution.
      
      Fixes: 4bd1d80e ("riscv: mm: notify remote harts about mmu cache updates")
      Reported-by: default avatarZong Li <zong.li@sifive.com>
      Reported-by: default avatarLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
      Signed-off-by: default avatarSergey Matyukevich <sergey.matyukevich@syntacore.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarGuo Ren <guoren@kernel.org>
      Link: https://lore.kernel.org/r/20230226150137.1919750-2-geomatsi@gmail.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      e9210500
    • Conor Dooley's avatar
      RISC-V: Don't check text_mutex during stop_machine · 2a8db5ec
      Conor Dooley authored
      We're currently using stop_machine() to update ftrace & kprobes, which
      means that the thread that takes text_mutex during may not be the same
      as the thread that eventually patches the code.  This isn't actually a
      race because the lock is still held (preventing any other concurrent
      accesses) and there is only one thread running during stop_machine(),
      but it does trigger a lockdep failure.
      
      This patch just elides the lockdep check during stop_machine.
      
      Fixes: c15ac4fd ("riscv/ftrace: Add dynamic function tracer support")
      Suggested-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Reported-by: default avatarChangbin Du <changbin.du@gmail.com>
      Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
      Signed-off-by: default avatarConor Dooley <conor.dooley@microchip.com>
      Link: https://lore.kernel.org/r/20230303143754.4005217-1-conor.dooley@microchip.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      2a8db5ec
    • Alexandre Ghiti's avatar
      riscv: Use READ_ONCE_NOCHECK in imprecise unwinding stack mode · 76950340
      Alexandre Ghiti authored
      When CONFIG_FRAME_POINTER is unset, the stack unwinding function
      walk_stackframe randomly reads the stack and then, when KASAN is enabled,
      it can lead to the following backtrace:
      
      [    0.000000] ==================================================================
      [    0.000000] BUG: KASAN: stack-out-of-bounds in walk_stackframe+0xa6/0x11a
      [    0.000000] Read of size 8 at addr ffffffff81807c40 by task swapper/0
      [    0.000000]
      [    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 6.2.0-12919-g24203e6db61f #43
      [    0.000000] Hardware name: riscv-virtio,qemu (DT)
      [    0.000000] Call Trace:
      [    0.000000] [<ffffffff80007ba8>] walk_stackframe+0x0/0x11a
      [    0.000000] [<ffffffff80099ecc>] init_param_lock+0x26/0x2a
      [    0.000000] [<ffffffff80007c4a>] walk_stackframe+0xa2/0x11a
      [    0.000000] [<ffffffff80c49c80>] dump_stack_lvl+0x22/0x36
      [    0.000000] [<ffffffff80c3783e>] print_report+0x198/0x4a8
      [    0.000000] [<ffffffff80099ecc>] init_param_lock+0x26/0x2a
      [    0.000000] [<ffffffff80007c4a>] walk_stackframe+0xa2/0x11a
      [    0.000000] [<ffffffff8015f68a>] kasan_report+0x9a/0xc8
      [    0.000000] [<ffffffff80007c4a>] walk_stackframe+0xa2/0x11a
      [    0.000000] [<ffffffff80007c4a>] walk_stackframe+0xa2/0x11a
      [    0.000000] [<ffffffff8006e99c>] desc_make_final+0x80/0x84
      [    0.000000] [<ffffffff8009a04e>] stack_trace_save+0x88/0xa6
      [    0.000000] [<ffffffff80099fc2>] filter_irq_stacks+0x72/0x76
      [    0.000000] [<ffffffff8006b95e>] devkmsg_read+0x32a/0x32e
      [    0.000000] [<ffffffff8015ec16>] kasan_save_stack+0x28/0x52
      [    0.000000] [<ffffffff8006e998>] desc_make_final+0x7c/0x84
      [    0.000000] [<ffffffff8009a04a>] stack_trace_save+0x84/0xa6
      [    0.000000] [<ffffffff8015ec52>] kasan_set_track+0x12/0x20
      [    0.000000] [<ffffffff8015f22e>] __kasan_slab_alloc+0x58/0x5e
      [    0.000000] [<ffffffff8015e7ea>] __kmem_cache_create+0x21e/0x39a
      [    0.000000] [<ffffffff80e133ac>] create_boot_cache+0x70/0x9c
      [    0.000000] [<ffffffff80e17ab2>] kmem_cache_init+0x6c/0x11e
      [    0.000000] [<ffffffff80e00fd6>] mm_init+0xd8/0xfe
      [    0.000000] [<ffffffff80e011d8>] start_kernel+0x190/0x3ca
      [    0.000000]
      [    0.000000] The buggy address belongs to stack of task swapper/0
      [    0.000000]  and is located at offset 0 in frame:
      [    0.000000]  stack_trace_save+0x0/0xa6
      [    0.000000]
      [    0.000000] This frame has 1 object:
      [    0.000000]  [32, 56) 'c'
      [    0.000000]
      [    0.000000] The buggy address belongs to the physical page:
      [    0.000000] page:(____ptrval____) refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x81a07
      [    0.000000] flags: 0x1000(reserved|zone=0)
      [    0.000000] raw: 0000000000001000 ff600003f1e3d150 ff600003f1e3d150 0000000000000000
      [    0.000000] raw: 0000000000000000 0000000000000000 00000001ffffffff
      [    0.000000] page dumped because: kasan: bad access detected
      [    0.000000]
      [    0.000000] Memory state around the buggy address:
      [    0.000000]  ffffffff81807b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [    0.000000]  ffffffff81807b80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [    0.000000] >ffffffff81807c00: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00 00 f3
      [    0.000000]                                            ^
      [    0.000000]  ffffffff81807c80: f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
      [    0.000000]  ffffffff81807d00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [    0.000000] ==================================================================
      
      Fix that by using READ_ONCE_NOCHECK when reading the stack in imprecise
      mode.
      
      Fixes: 5d8544e2 ("RISC-V: Generic library routines and assembly")
      Reported-by: default avatarChathura Rajapaksha <chathura.abeyrathne.lk@gmail.com>
      Link: https://lore.kernel.org/all/CAD7mqryDQCYyJ1gAmtMm8SASMWAQ4i103ptTb0f6Oda=tPY2=A@mail.gmail.com/Suggested-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Signed-off-by: default avatarAlexandre Ghiti <alexghiti@rivosinc.com>
      Link: https://lore.kernel.org/r/20230308091639.602024-1-alexghiti@rivosinc.comSigned-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      76950340
  8. 07 Mar, 2023 1 commit
    • Conor Dooley's avatar
      RISC-V: fix taking the text_mutex twice during sifive errata patching · bf89b7ee
      Conor Dooley authored
      Chris pointed out that some bonehead, *cough* me *cough*, added two
      mutex_locks() to the SiFive errata patching. The second was meant to
      have been a mutex_unlock().
      
      This results in errors such as
      
      Unable to handle kernel NULL pointer dereference at virtual address 0000000000000030
      Oops [#1]
      Modules linked in:
      CPU: 0 PID: 0 Comm: swapper Not tainted
      6.2.0-rc1-starlight-00079-g9493e6f3 #229
      Hardware name: BeagleV Starlight Beta (DT)
      epc : __schedule+0x42/0x500
       ra : schedule+0x46/0xce
      epc : ffffffff8065957c ra : ffffffff80659a80 sp : ffffffff81203c80
       gp : ffffffff812d50a0 tp : ffffffff8120db40 t0 : ffffffff81203d68
       t1 : 0000000000000001 t2 : 4c45203a76637369 s0 : ffffffff81203cf0
       s1 : ffffffff8120db40 a0 : 0000000000000000 a1 : ffffffff81213958
       a2 : ffffffff81213958 a3 : 0000000000000000 a4 : 0000000000000000
       a5 : ffffffff80a1bd00 a6 : 0000000000000000 a7 : 0000000052464e43
       s2 : ffffffff8120db41 s3 : ffffffff80a1ad00 s4 : 0000000000000000
       s5 : 0000000000000002 s6 : ffffffff81213938 s7 : 0000000000000000
       s8 : 0000000000000000 s9 : 0000000000000001 s10: ffffffff812d7204
       s11: ffffffff80d3c920 t3 : 0000000000000001 t4 : ffffffff812e6dd7
       t5 : ffffffff812e6dd8 t6 : ffffffff81203bb8
      status: 0000000200000100 badaddr: 0000000000000030 cause: 000000000000000d
      [<ffffffff80659a80>] schedule+0x46/0xce
      [<ffffffff80659dce>] schedule_preempt_disabled+0x16/0x28
      [<ffffffff8065ae0c>] __mutex_lock.constprop.0+0x3fe/0x652
      [<ffffffff8065b138>] __mutex_lock_slowpath+0xe/0x16
      [<ffffffff8065b182>] mutex_lock+0x42/0x4c
      [<ffffffff8000ad94>] sifive_errata_patch_func+0xf6/0x18c
      [<ffffffff80002b92>] _apply_alternatives+0x74/0x76
      [<ffffffff80802ee8>] apply_boot_alternatives+0x3c/0xfa
      [<ffffffff80803cb0>] setup_arch+0x60c/0x640
      [<ffffffff80800926>] start_kernel+0x8e/0x99c
      ---[ end trace 0000000000000000 ]---
      Reported-by: default avatarChris Hofstaedtler <zeha@debian.org>
      Fixes: 9493e6f3 ("RISC-V: take text_mutex during alternative patching")
      Signed-off-by: default avatarConor Dooley <conor.dooley@microchip.com>
      Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Link: https://lore.kernel.org/r/20230302174154.970746-1-conor@kernel.org
      [Palmer: pick up Geert's bug report from the thread]
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      bf89b7ee
  9. 06 Mar, 2023 1 commit
  10. 05 Mar, 2023 9 commits
    • Linus Torvalds's avatar
      Linux 6.3-rc1 · fe15c26e
      Linus Torvalds authored
      fe15c26e
    • Linus Torvalds's avatar
      cpumask: re-introduce constant-sized cpumask optimizations · 596ff4a0
      Linus Torvalds authored
      Commit aa47a7c2 ("lib/cpumask: deprecate nr_cpumask_bits") resulted
      in the cpumask operations potentially becoming hugely less efficient,
      because suddenly the cpumask was always considered to be variable-sized.
      
      The optimization was then later added back in a limited form by commit
      6f9c07be ("lib/cpumask: add FORCE_NR_CPUS config option"), but that
      FORCE_NR_CPUS option is not useful in a generic kernel and more of a
      special case for embedded situations with fixed hardware.
      
      Instead, just re-introduce the optimization, with some changes.
      
      Instead of depending on CPUMASK_OFFSTACK being false, and then always
      using the full constant cpumask width, this introduces three different
      cpumask "sizes":
      
       - the exact size (nr_cpumask_bits) remains identical to nr_cpu_ids.
      
         This is used for situations where we should use the exact size.
      
       - the "small" size (small_cpumask_bits) is the NR_CPUS constant if it
         fits in a single word and the bitmap operations thus end up able
         to trigger the "small_const_nbits()" optimizations.
      
         This is used for the operations that have optimized single-word
         cases that get inlined, notably the bit find and scanning functions.
      
       - the "large" size (large_cpumask_bits) is the NR_CPUS constant if it
         is an sufficiently small constant that makes simple "copy" and
         "clear" operations more efficient.
      
         This is arbitrarily set at four words or less.
      
      As a an example of this situation, without this fixed size optimization,
      cpumask_clear() will generate code like
      
              movl    nr_cpu_ids(%rip), %edx
              addq    $63, %rdx
              shrq    $3, %rdx
              andl    $-8, %edx
              callq   memset@PLT
      
      on x86-64, because it would calculate the "exact" number of longwords
      that need to be cleared.
      
      In contrast, with this patch, using a MAX_CPU of 64 (which is quite a
      reasonable value to use), the above becomes a single
      
      	movq $0,cpumask
      
      instruction instead, because instead of caring to figure out exactly how
      many CPU's the system has, it just knows that the cpumask will be a
      single word and can just clear it all.
      
      Note that this does end up tightening the rules a bit from the original
      version in another way: operations that set bits in the cpumask are now
      limited to the actual nr_cpu_ids limit, whereas we used to do the
      nr_cpumask_bits thing almost everywhere in the cpumask code.
      
      But if you just clear bits, or scan for bits, we can use the simpler
      compile-time constants.
      
      In the process, remove 'cpumask_complement()' and 'for_each_cpu_not()'
      which were not useful, and which fundamentally have to be limited to
      'nr_cpu_ids'.  Better remove them now than have somebody introduce use
      of them later.
      
      Of course, on x86-64 with MAXSMP there is no sane small compile-time
      constant for the cpumask sizes, and we end up using the actual CPU bits,
      and will generate the above kind of horrors regardless.  Please don't
      use MAXSMP unless you really expect to have machines with thousands of
      cores.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      596ff4a0
    • Linus Torvalds's avatar
      Merge tag 'v6.3-p2' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 · f915322f
      Linus Torvalds authored
      Pull crypto fix from Herbert Xu:
       "Fix a regression in the caam driver"
      
      * tag 'v6.3-p2' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
        crypto: caam - Fix edesc/iv ordering mixup
      f915322f
    • Linus Torvalds's avatar
      Merge tag 'x86-urgent-2023-03-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 7f9ec7d8
      Linus Torvalds authored
      Pull x86 updates from Thomas Gleixner:
       "A small set of updates for x86:
      
         - Return -EIO instead of success when the certificate buffer for SEV
           guests is not large enough
      
         - Allow STIPB to be enabled with legacy IBSR. Legacy IBRS is cleared
           on return to userspace for performance reasons, but the leaves user
           space vulnerable to cross-thread attacks which STIBP prevents.
           Update the documentation accordingly"
      
      * tag 'x86-urgent-2023-03-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        virt/sev-guest: Return -EIO if certificate buffer is not large enough
        Documentation/hw-vuln: Document the interaction between IBRS and STIBP
        x86/speculation: Allow enabling STIBP with legacy IBRS
      7f9ec7d8
    • Linus Torvalds's avatar
      Merge tag 'irq-urgent-2023-03-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 4e9c542c
      Linus Torvalds authored
      Pull irq updates from Thomas Gleixner:
       "A set of updates for the interrupt susbsystem:
      
         - Prevent possible NULL pointer derefences in
           irq_data_get_affinity_mask() and irq_domain_create_hierarchy()
      
         - Take the per device MSI lock before invoking code which relies on
           it being hold
      
         - Make sure that MSI descriptors are unreferenced before freeing
           them. This was overlooked when the platform MSI code was converted
           to use core infrastructure and results in a fals positive warning
      
         - Remove dead code in the MSI subsystem
      
         - Clarify the documentation for pci_msix_free_irq()
      
         - More kobj_type constification"
      
      * tag 'irq-urgent-2023-03-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        genirq/msi, platform-msi: Ensure that MSI descriptors are unreferenced
        genirq/msi: Drop dead domain name assignment
        irqdomain: Add missing NULL pointer check in irq_domain_create_hierarchy()
        genirq/irqdesc: Make kobj_type structures constant
        PCI/MSI: Clarify usage of pci_msix_free_irq()
        genirq/msi: Take the per-device MSI lock before validating the control structure
        genirq/ipi: Fix NULL pointer deref in irq_data_get_affinity_mask()
      4e9c542c
    • Linus Torvalds's avatar
      Merge tag 'pull-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 1a90673e
      Linus Torvalds authored
      Pull vfs update from Al Viro:
       "Adding Christian Brauner as VFS co-maintainer"
      
      * tag 'pull-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        Adding VFS co-maintainer
      1a90673e
    • Linus Torvalds's avatar
      Merge tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 1a8d05a7
      Linus Torvalds authored
      Pull VM_FAULT_RETRY fixes from Al Viro:
       "Some of the page fault handlers do not deal with the following case
        correctly:
      
         - handle_mm_fault() has returned VM_FAULT_RETRY
      
         - there is a pending fatal signal
      
         - fault had happened in kernel mode
      
        Correct action in such case is not "return unconditionally" - fatal
        signals are handled only upon return to userland and something like
        copy_to_user() would end up retrying the faulting instruction and
        triggering the same fault again and again.
      
        What we need to do in such case is to make the caller to treat that as
        failed uaccess attempt - handle exception if there is an exception
        handler for faulting instruction or oops if there isn't one.
      
        Over the years some architectures had been fixed and now are handling
        that case properly; some still do not. This series should fix the
        remaining ones.
      
        Status:
      
         - m68k, riscv, hexagon, parisc: tested/acked by maintainers.
      
         - alpha, sparc32, sparc64: tested locally - bug has been reproduced
           on the unpatched kernel and verified to be fixed by this series.
      
         - ia64, microblaze, nios2, openrisc: build, but otherwise completely
           untested"
      
      * tag 'pull-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        openrisc: fix livelock in uaccess
        nios2: fix livelock in uaccess
        microblaze: fix livelock in uaccess
        ia64: fix livelock in uaccess
        sparc: fix livelock in uaccess
        alpha: fix livelock in uaccess
        parisc: fix livelock in uaccess
        hexagon: fix livelock in uaccess
        riscv: fix livelock in uaccess
        m68k: fix livelock in uaccess
      1a8d05a7
    • Masahiro Yamada's avatar
      Remove Intel compiler support · 95207db8
      Masahiro Yamada authored
      include/linux/compiler-intel.h had no update in the past 3 years.
      
      We often forget about the third C compiler to build the kernel.
      
      For example, commit a0a12c3e ("asm goto: eradicate CC_HAS_ASM_GOTO")
      only mentioned GCC and Clang.
      
      init/Kconfig defines CC_IS_GCC and CC_IS_CLANG but not CC_IS_ICC,
      and nobody has reported any issue.
      
      I guess the Intel Compiler support is broken, and nobody is caring
      about it.
      
      Harald Arnesen pointed out ICC (classic Intel C/C++ compiler) is
      deprecated:
      
          $ icc -v
          icc: remark #10441: The Intel(R) C++ Compiler Classic (ICC) is
          deprecated and will be removed from product release in the second half
          of 2023. The Intel(R) oneAPI DPC++/C++ Compiler (ICX) is the recommended
          compiler moving forward. Please transition to use this compiler. Use
          '-diag-disable=10441' to disable this message.
          icc version 2021.7.0 (gcc version 12.1.0 compatibility)
      
      Arnd Bergmann provided a link to the article, "Intel C/C++ compilers
      complete adoption of LLVM".
      
      lib/zstd/common/compiler.h and lib/zstd/compress/zstd_fast.c were kept
      untouched for better sync with https://github.com/facebook/zstd
      
      Link: https://www.intel.com/content/www/us/en/developer/articles/technical/adoption-of-llvm-complete-icx.htmlSigned-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      Reviewed-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      95207db8
    • Al Viro's avatar
      Adding VFS co-maintainer · 3304f18b
      Al Viro authored
      Acked-by: default avatarChristian Brauner <brauner@kernel.org>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      3304f18b
  11. 04 Mar, 2023 8 commits
    • Linus Torvalds's avatar
      Merge tag 'i2c-for-6.3-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · b01fe98d
      Linus Torvalds authored
      Pull more i2c updates from Wolfram Sang:
       "Some improvements/fixes for the newly added GXP driver and a Kconfig
        dependency fix"
      
      * tag 'i2c-for-6.3-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: gxp: fix an error code in probe
        i2c: gxp: return proper error on address NACK
        i2c: gxp: remove "empty" switch statement
        i2c: Disable I2C_APPLE when I2C_PASEMI is a builtin
      b01fe98d
    • Linus Torvalds's avatar
      mm: avoid gcc complaint about pointer casting · e77d587a
      Linus Torvalds authored
      The migration code ends up temporarily stashing information of the wrong
      type in unused fields of the newly allocated destination folio.  That
      all works fine, but gcc does complain about the pointer type mis-use:
      
          mm/migrate.c: In function ‘__migrate_folio_extract’:
          mm/migrate.c:1050:20: note: randstruct: casting between randomized structure pointer types (ssa): ‘struct anon_vma’ and ‘struct address_space’
      
           1050 |         *anon_vmap = (void *)dst->mapping;
                |         ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
      
      and gcc is actually right to complain since it really doesn't understand
      that this is a very temporary special case where this is ok.
      
      This could be fixed in different ways by just obfuscating the assignment
      sufficiently that gcc doesn't see what is going on, but the truly
      "proper C" way to do this is by explicitly using a union.
      
      Using unions for type conversions like this is normally hugely ugly and
      syntactically nasty, but this really is one of the few cases where we
      want to make it clear that we're not doing type conversion, we're really
      re-using the value bit-for-bit just using another type.
      
      IOW, this should not become a common pattern, but in this one case using
      that odd union is probably the best way to document to the compiler what
      is conceptually going on here.
      
      [ Side note: there are valid cases where we convert pointers to other
        pointer types, notably the whole "folio vs page" situation, where the
        types actually have fundamental commonalities.
      
        The fact that the gcc note is limited to just randomized structures
        means that we don't see equivalent warnings for those cases, but it
        migth also mean that we miss other cases where we do play these kinds
        of dodgy games, and this kind of explicit conversion might be a good
        idea. ]
      
      I verified that at least for an allmodconfig build on x86-64, this
      generates the exact same code, apart from line numbers and assembler
      comment changes.
      
      Fixes: 64c8902e ("migrate_pages: split unmap_and_move() to _unmap() and _move()")
      Cc: Huang, Ying <ying.huang@intel.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e77d587a
    • Linus Torvalds's avatar
      Merge tag 'mm-hotfixes-stable-2023-03-04-13-12' of... · 20fdfd55
      Linus Torvalds authored
      Merge tag 'mm-hotfixes-stable-2023-03-04-13-12' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
      
      Pull misc fixes from Andrew Morton:
       "17 hotfixes.
      
        Eight are for MM and seven are for other parts of the kernel. Seven
        are cc:stable and eight address post-6.3 issues or were judged
        unsuitable for -stable backporting"
      
      * tag 'mm-hotfixes-stable-2023-03-04-13-12' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
        mailmap: map Dikshita Agarwal's old address to his current one
        mailmap: map Vikash Garodia's old address to his current one
        fs/cramfs/inode.c: initialize file_ra_state
        fs: hfsplus: fix UAF issue in hfsplus_put_super
        panic: fix the panic_print NMI backtrace setting
        lib: parser: update documentation for match_NUMBER functions
        kasan, x86: don't rename memintrinsics in uninstrumented files
        kasan: test: fix test for new meminstrinsic instrumentation
        kasan: treat meminstrinsic as builtins in uninstrumented files
        kasan: emit different calls for instrumentable memintrinsics
        ocfs2: fix non-auto defrag path not working issue
        ocfs2: fix defrag path triggering jbd2 ASSERT
        mailmap: map Georgi Djakov's old Linaro address to his current one
        mm/hwpoison: convert TTU_IGNORE_HWPOISON to TTU_HWPOISON
        lib/zlib: DFLTCC deflate does not write all available bits for Z_NO_FLUSH
        mm/damon/paddr: fix missing folio_put()
        mm/mremap: fix dup_anon_vma() in vma_merge() case 4
      20fdfd55
    • Linus Torvalds's avatar
      Merge tag 'powerpc-6.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · c29214bc
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
      
       - Drop orphaned VAS MAINTAINERS entry
      
       - Fix build errors with clang and KCSAN
      
       - Avoid build errors seen with LD_DEAD_CODE_DATA_ELIMINATION together
         with recordmcount
      
      Thanks to Nathan Chancellor.
      
      * tag 'powerpc-6.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc: Avoid dead code/data elimination when using recordmcount
        powerpc/vmlinux.lds: Add .text.asan/tsan sections
        powerpc: Drop orphaned VAS MAINTAINERS entry
      c29214bc
    • Linus Torvalds's avatar
      Merge tag 'sound-fix-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · d172859e
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "A collection of various small fixes that have been gathered since the
        last PR.
      
        The majority of changes are for ASoC, and there is a small change in
        ASoC PCM core, but the rest are all for driver- specific fixes /
        quirks / updates"
      
      * tag 'sound-fix-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (32 commits)
        ALSA: ice1712: Delete unreachable code in aureon_add_controls()
        ALSA: ice1712: Do not left ice->gpio_mutex locked in aureon_add_controls()
        ALSA: hda/realtek: Add quirk for HP EliteDesk 800 G6 Tower PC
        ALSA: hda/realtek: Improve support for Dell Precision 3260
        ASoC: mediatek: mt8195: add missing initialization
        ASoC: mediatek: mt8188: add missing initialization
        ASoC: amd: yc: Add DMI entries to support HP OMEN 16-n0xxx (8A43)
        ASoC: zl38060 add gpiolib dependency
        ASoC: sam9g20ek: Disable capture unless building with microphone input
        ASoC: mt8192: Fix range for sidetone positive gain
        ASoC: mt8192: Report an error if when an invalid sidetone gain is written
        ASoC: mt8192: Fix event generation for controls
        ASoC: mt8192: Remove spammy log messages
        ASoC: mchp-pdmc: fix poc noise at capture startup
        ASoC: dt-bindings: sama7g5-pdmc: add microchip,startup-delay-us binding
        ASoC: soc-pcm: add option to start DMA after DAI
        ASoC: mt8183: Fix event generation for I2S DAI operations
        ASoC: mt8183: Remove spammy logging from I2S DAI driver
        ASoC: mt6358: Remove undefined HPx Mux enumeration values
        ASoC: mt6358: Validate Wake on Voice 2 writes
        ...
      d172859e
    • Linus Torvalds's avatar
      Merge tag 'for-v6.3-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply · 0988a0ea
      Linus Torvalds authored
      Pull more power supply updates from Sebastian Reichel:
      
       - Fix DT binding for Richtek RT9467
      
       - Fix a NULL pointer check in the power-supply core
      
       - Document meaning of absent "present" property
      
      * tag 'for-v6.3-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply:
        dt-bindings: power: supply: Revise Richtek RT9467 compatible name
        ABI: testing: sysfs-class-power: Document absence of "present" property
        power: supply: fix null pointer check order in __power_supply_register
      0988a0ea
    • Linus Torvalds's avatar
      Merge tag '6.3-rc-smb3-client-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6 · 3162745a
      Linus Torvalds authored
      Pull more cifs updates from Steve French:
      
       - xfstest generic/208 fix (memory leak)
      
       - minor netfs fix (to address smatch warning)
      
       - a DFS fix for stable
      
       - a reconnect race fix
      
       - two multichannel fixes
      
       - RDMA (smbdirect) fix
      
       - two additional writeback fixes from David
      
      * tag '6.3-rc-smb3-client-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: Fix memory leak in direct I/O
        cifs: prevent data race in cifs_reconnect_tcon()
        cifs: improve checking of DFS links over STATUS_OBJECT_NAME_INVALID
        iov: Fix netfs_extract_user_to_sg()
        cifs: Fix cifs_write_back_from_locked_folio()
        cifs: reuse cifs_match_ipaddr for comparison of dstaddr too
        cifs: match even the scope id for ipv6 addresses
        cifs: Fix an uninitialised variable
        cifs: Add some missing xas_retry() calls
      3162745a
    • Linus Torvalds's avatar
      umh: simplify the capability pointer logic · e7783615
      Linus Torvalds authored
      The usermodehelper code uses two fake pointers for the two capability
      cases: CAP_BSET for reading and writing 'usermodehelper_bset', and
      CAP_PI to read and write 'usermodehelper_inheritable'.
      
      This seems to be a completely unnecessary indirection, since we could
      instead just use the pointers themselves, and never have to do any "if
      this then that" kind of logic.
      
      So just get rid of the fake pointer values, and use the real pointer
      values instead.
      Reviewed-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
      Cc: Eric Biederman <ebiederm@xmission.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Iurii Zaikin <yzaikin@google.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e7783615
  12. 03 Mar, 2023 8 commits