Skip to content
Snippets Groups Projects
  1. Jul 24, 2023
  2. Jul 22, 2023
  3. Jul 13, 2023
  4. Jul 12, 2023
  5. Jul 11, 2023
    • Ingo Molnar's avatar
      x86/cfi: Only define poison_cfi() if CONFIG_X86_KERNEL_IBT=y · 535d0ae3
      Ingo Molnar authored
      
      poison_cfi() was introduced in:
      
        9831c625 ("x86/cfi: Extend ENDBR sealing to kCFI")
      
      ... but it's only ever used under CONFIG_X86_KERNEL_IBT=y,
      and if that option is disabled, we get:
      
        arch/x86/kernel/alternative.c:1243:13: error: ‘poison_cfi’ defined but not used [-Werror=unused-function]
      
      Guard the definition with CONFIG_X86_KERNEL_IBT.
      
      Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Sami Tolvanen <samitolvanen@google.com>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      535d0ae3
    • Björn Töpel's avatar
      riscv, bpf: Fix inconsistent JIT image generation · c56fb2aa
      Björn Töpel authored
      
      In order to generate the prologue and epilogue, the BPF JIT needs to
      know which registers that are clobbered. Therefore, the during
      pre-final passes, the prologue is generated after the body of the
      program body-prologue-epilogue. Then, in the final pass, a proper
      prologue-body-epilogue JITted image is generated.
      
      This scheme has worked most of the time. However, for some large
      programs with many jumps, e.g. the test_kmod.sh BPF selftest with
      hardening enabled (blinding constants), this has shown to be
      incorrect. For the final pass, when the proper prologue-body-epilogue
      is generated, the image has not converged. This will lead to that the
      final image will have incorrect jump offsets. The following is an
      excerpt from an incorrect image:
      
        | ...
        |     3b8:       00c50663                beq     a0,a2,3c4 <.text+0x3c4>
        |     3bc:       0020e317                auipc   t1,0x20e
        |     3c0:       49630067                jalr    zero,1174(t1) # 20e852 <.text+0x20e852>
        | ...
        |  20e84c:       8796                    c.mv    a5,t0
        |  20e84e:       6422                    c.ldsp  s0,8(sp)    # Epilogue start
        |  20e850:       6141                    c.addi16sp      sp,16
        |  20e852:       853e                    c.mv    a0,a5       # Incorrect jump target
        |  20e854:       8082                    c.jr    ra
      
      The image has shrunk, and the epilogue offset is incorrect in the
      final pass.
      
      Correct the problem by always generating proper prologue-body-epilogue
      outputs, which means that the first pass will only generate the body
      to track what registers that are touched.
      
      Fixes: 2353ecc6 ("bpf, riscv: add BPF JIT for RV64G")
      Signed-off-by: default avatarBjörn Töpel <bjorn@rivosinc.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20230710074131.19596-1-bjorn@kernel.org
      c56fb2aa
    • Max Filippov's avatar
      xtensa: fix unaligned and load/store configuration interaction · a160e941
      Max Filippov authored
      
      Unaligned exception handler is needed in configurations with hardware
      support for unaligned access when the load/store exception handler is
      enabled because such configurations would still raise an exception on
      unaligned access through the instruction bus.
      
      Fixes: f29cf776 ("xtensa: add load/store exception handler")
      Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      a160e941
    • Max Filippov's avatar
      xtensa: ISS: fix call to split_if_spec · bc8d5916
      Max Filippov authored
      
      split_if_spec expects a NULL-pointer as an end marker for the argument
      list, but tuntap_probe never supplied that terminating NULL. As a result
      incorrectly formatted interface specification string may cause a crash
      because of the random memory access. Fix that by adding NULL terminator
      to the split_if_spec argument list.
      
      Cc: stable@vger.kernel.org
      Fixes: 7282bee7 ("[PATCH] xtensa: Architecture support for Tensilica Xtensa Part 8")
      Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      bc8d5916
    • Max Filippov's avatar
      xtensa: ISS: add comment about etherdev freeing · c44e783e
      Max Filippov authored
      
      iss_net_configure explicitly frees etherdev in all error return paths
      except one where register_netdevice fails. In that remaining error
      return path the etherdev is freed by the iss_net_pdev_release callback
      triggered by the platform_device_unregister call. Add a comment stating
      that.
      
      Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      c44e783e
    • YueHaibing's avatar
      x86/ftrace: Remove unsued extern declaration ftrace_regs_caller_ret() · b599b065
      YueHaibing authored
      This is now unused, so can remove it.
      
      Link: https://lore.kernel.org/linux-trace-kernel/20230623091640.21952-1-yuehaibing@huawei.com
      
      
      
      Cc: <mark.rutland@arm.com>
      Cc: <tglx@linutronix.de>
      Cc: <mingo@redhat.com>
      Cc: <bp@alien8.de>
      Cc: <dave.hansen@linux.intel.com>
      Cc: <x86@kernel.org>
      Cc: <hpa@zytor.com>
      Cc: <peterz@infradead.org>
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Acked-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      b599b065
  6. Jul 10, 2023
  7. Jul 09, 2023
    • Aneesh Kumar K.V's avatar
      powerpc/mm/book3s64/hash/4k: Add pmd_same callback for 4K page size · cf53564b
      Aneesh Kumar K.V authored
      
      With commit 0d940a9b ("mm/pgtable: allow pte_offset_map[_lock]() to
      fail") the kernel is now using pmd_same to compare pmd values that are
      pointing to a level 4 page table page. Move the functions out of #ifdef
      CONFIG_TRANSPARENT_HUGEPAGE and add a variant that can work with both 4K
      and 64K page size.
      
      kernel BUG at arch/powerpc/include/asm/book3s/64/hash-4k.h:141!
      Oops: Exception in kernel mode, sig: 5 [#1]
      LE PAGE_SIZE=4K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
      .....
      NIP [c00000000048aee0] __pte_offset_map_lock+0xf0/0x164
      LR [c00000000048ae78] __pte_offset_map_lock+0x88/0x164
      Call Trace:
       0xc0003f000009a340 (unreliable)
       __handle_mm_fault+0x1340/0x1980
       handle_mm_fault+0xbc/0x380
       __get_user_pages+0x320/0x550
       get_user_pages_remote+0x13c/0x520
       get_arg_page+0x80/0x1d0
       copy_string_kernel+0xc8/0x250
       kernel_execve+0x11c/0x270
       run_init_process+0xe4/0x10c
       kernel_init+0xbc/0x1a0
       ret_from_kernel_user_thread+0x14/0x1c
      
      Reported-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatar"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://msgid.link/20230706022405.798157-1-aneesh.kumar@linux.ibm.com
      cf53564b
    • Michael Ellerman's avatar
      powerpc/64e: Fix obtool warnings in exceptions-64e.S · cf65b12c
      Michael Ellerman authored
      
      Since commit aec0ba74 ("powerpc/64: Use -mprofile-kernel for big
      endian ELFv2 kernels"), this file is checked by objtool. Fix warnings
      such as:
      
        arch/powerpc/kernel/idle_64e.o: warning: objtool: .text+0x20: unannotated intra-function call
        arch/powerpc/kernel/exceptions-64e.o: warning: objtool: .text+0x218: unannotated intra-function call
      
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://msgid.link/20230622112451.735268-1-mpe@ellerman.id.au
      cf65b12c
    • Michael Ellerman's avatar
      powerpc/security: Fix Speculation_Store_Bypass reporting on Power10 · 5bcedc59
      Michael Ellerman authored
      
      Nageswara reported that /proc/self/status was showing "vulnerable" for
      the Speculation_Store_Bypass feature on Power10, eg:
      
        $ grep Speculation_Store_Bypass: /proc/self/status
        Speculation_Store_Bypass:       vulnerable
      
      But at the same time the sysfs files, and lscpu, were showing "Not
      affected".
      
      This turns out to simply be a bug in the reporting of the
      Speculation_Store_Bypass, aka. PR_SPEC_STORE_BYPASS, case.
      
      When SEC_FTR_STF_BARRIER was added, so that firmware could communicate
      the vulnerability was not present, the code in ssb_prctl_get() was not
      updated to check the new flag.
      
      So add the check for SEC_FTR_STF_BARRIER being disabled. Rather than
      adding the new check to the existing if block and expanding the comment
      to cover both cases, rewrite the three cases to be separate so they can
      be commented separately for clarity.
      
      Fixes: 84ed26fd ("powerpc/security: Add a security feature for STF barrier")
      Cc: stable@vger.kernel.org # v5.14+
      Reported-by: default avatarNageswara R Sastry <rnsastry@linux.ibm.com>
      Tested-by: default avatarNageswara R Sastry <rnsastry@linux.ibm.com>
      Reviewed-by: default avatarRussell Currey <ruscur@russell.cc>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://msgid.link/20230517074945.53188-1-mpe@ellerman.id.au
      5bcedc59
    • Michael Ellerman's avatar
      powerpc/64s: Fix native_hpte_remove() to be irq-safe · 8bbe9fee
      Michael Ellerman authored
      
      Lockdep warns that the use of the hpte_lock in native_hpte_remove() is
      not safe against an IRQ coming in:
      
        ================================
        WARNING: inconsistent lock state
        6.4.0-rc2-g0c54f4d30ecc #1 Not tainted
        --------------------------------
        inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage.
        qemu-system-ppc/93865 [HC0[0]:SC0[0]:HE1:SE1] takes:
        c0000000021f5180 (hpte_lock){+.?.}-{0:0}, at: native_lock_hpte+0x8/0xd0
        {IN-SOFTIRQ-W} state was registered at:
          lock_acquire+0x134/0x3f0
          native_lock_hpte+0x44/0xd0
          native_hpte_insert+0xd4/0x2a0
          __hash_page_64K+0x218/0x4f0
          hash_page_mm+0x464/0x840
          do_hash_fault+0x11c/0x260
          data_access_common_virt+0x210/0x220
          __ip_select_ident+0x140/0x150
          ...
          net_rx_action+0x3bc/0x440
          __do_softirq+0x180/0x534
          ...
          sys_sendmmsg+0x34/0x50
          system_call_exception+0x128/0x320
          system_call_common+0x160/0x2e4
        ...
         Possible unsafe locking scenario:
      
               CPU0
               ----
          lock(hpte_lock);
          <Interrupt>
            lock(hpte_lock);
      
         *** DEADLOCK ***
        ...
        Call Trace:
          dump_stack_lvl+0x98/0xe0 (unreliable)
          print_usage_bug.part.0+0x250/0x278
          mark_lock+0xc9c/0xd30
          __lock_acquire+0x440/0x1ca0
          lock_acquire+0x134/0x3f0
          native_lock_hpte+0x44/0xd0
          native_hpte_remove+0xb0/0x190
          kvmppc_mmu_map_page+0x650/0x698 [kvm_pr]
          kvmppc_handle_pagefault+0x534/0x6e8 [kvm_pr]
          kvmppc_handle_exit_pr+0x6d8/0xe90 [kvm_pr]
          after_sprg3_load+0x80/0x90 [kvm_pr]
          kvmppc_vcpu_run_pr+0x108/0x270 [kvm_pr]
          kvmppc_vcpu_run+0x34/0x48 [kvm]
          kvm_arch_vcpu_ioctl_run+0x340/0x470 [kvm]
          kvm_vcpu_ioctl+0x338/0x8b8 [kvm]
          sys_ioctl+0x7c4/0x13e0
          system_call_exception+0x128/0x320
          system_call_common+0x160/0x2e4
      
      I suspect kvm_pr is the only caller that doesn't already have IRQs
      disabled, which is why this hasn't been reported previously.
      
      Fix it by disabling IRQs in native_hpte_remove().
      
      Fixes: 35159b57 ("powerpc/64s: make HPTE lock and native_tlbie_lock irq-safe")
      Cc: stable@vger.kernel.org # v6.1+
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://msgid.link/20230517123033.18430-1-mpe@ellerman.id.au
      8bbe9fee
  8. Jul 08, 2023
  9. Jul 07, 2023
  10. Jul 06, 2023
  11. Jul 05, 2023
Loading