1. 09 1月, 2020 6 次提交
  2. 05 1月, 2020 5 次提交
  3. 03 1月, 2020 5 次提交
  4. 30 12月, 2019 1 次提交
  5. 28 12月, 2019 3 次提交
    • O
      riscv: export flush_icache_all to modules · 1833e327
      Olof Johansson 提交于
      This is needed by LKDTM (crash dump test module), it calls
      flush_icache_range(), which on RISC-V turns into flush_icache_all(). On
      other architectures, the actual implementation is exported, so follow
      that precedence and export it here too.
      
      Fixes build of CONFIG_LKDTM that fails with:
      ERROR: "flush_icache_all" [drivers/misc/lkdtm/lkdtm.ko] undefined!
      Signed-off-by: NOlof Johansson <olof@lixom.net>
      Signed-off-by: NPaul Walmsley <paul.walmsley@sifive.com>
      1833e327
    • D
      riscv: reject invalid syscalls below -1 · 556f47ac
      David Abdurachmanov 提交于
      Running "stress-ng --enosys 4 -t 20 -v" showed a large number of kernel oops
      with "Unable to handle kernel paging request at virtual address" message. This
      happens when enosys stressor starts testing random non-valid syscalls.
      
      I forgot to redirect any syscall below -1 to sys_ni_syscall.
      
      With the patch kernel oops messages are gone while running stress-ng enosys
      stressor.
      Signed-off-by: NDavid Abdurachmanov <david.abdurachmanov@sifive.com>
      Fixes: 5340627e ("riscv: add support for SECCOMP and SECCOMP_FILTER")
      Signed-off-by: NPaul Walmsley <paul.walmsley@sifive.com>
      556f47ac
    • L
      riscv: fix compile failure with EXPORT_SYMBOL() & !MMU · 4d47ce15
      Luc Van Oostenryck 提交于
      When support for !MMU was added, the declaration of
      __asm_copy_to_user() & __asm_copy_from_user() were #ifdefed
      out hence their EXPORT_SYMBOL() give an error message like:
        .../riscv_ksyms.c:13:15: error: '__asm_copy_to_user' undeclared here
        .../riscv_ksyms.c:14:15: error: '__asm_copy_from_user' undeclared here
      
      Since these symbols are not defined with !MMU it's wrong to export them.
      Same for __clear_user() (even though this one is also declared in
      include/asm-generic/uaccess.h and thus doesn't give an error message).
      
      Fix this by doing the EXPORT_SYMBOL() directly where these symbols
      are defined: inside lib/uaccess.S itself.
      
      Fixes: 6bd33e1e ("riscv: fix compile failure with EXPORT_SYMBOL() & !MMU")
      Reported-by: Nkbuild test robot <lkp@intel.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Signed-off-by: NLuc Van Oostenryck <luc.vanoostenryck@gmail.com>
      Signed-off-by: NPaul Walmsley <paul.walmsley@sifive.com>
      4d47ce15
  6. 23 12月, 2019 1 次提交
    • M
      powerpc/mm: Mark get_slice_psize() & slice_addr_is_low() as notrace · 91a063c9
      Michael Ellerman 提交于
      These slice routines are called from the SLB miss handler, which can
      lead to warnings from the IRQ code, because we have not reconciled the
      IRQ state properly:
      
        WARNING: CPU: 72 PID: 30150 at arch/powerpc/kernel/irq.c:258 arch_local_irq_restore.part.0+0xcc/0x100
        Modules linked in:
        CPU: 72 PID: 30150 Comm: ftracetest Not tainted 5.5.0-rc2-gcc9x-g7e0165b2 #1
        NIP:  c00000000001d83c LR: c00000000029ab90 CTR: c00000000026cf90
        REGS: c0000007eee3b960 TRAP: 0700   Not tainted  (5.5.0-rc2-gcc9x-g7e0165b2)
        MSR:  8000000000021033 <SF,ME,IR,DR,RI,LE>  CR: 22242844  XER: 20000000
        CFAR: c00000000001d780 IRQMASK: 0
        ...
        NIP arch_local_irq_restore.part.0+0xcc/0x100
        LR  trace_graph_entry+0x270/0x340
        Call Trace:
          trace_graph_entry+0x254/0x340 (unreliable)
          function_graph_enter+0xe4/0x1a0
          prepare_ftrace_return+0xa0/0x130
          ftrace_graph_caller+0x44/0x94	# (get_slice_psize())
          slb_allocate_user+0x7c/0x100
          do_slb_fault+0xf8/0x300
          instruction_access_slb_common+0x140/0x180
      
      Fixes: 48e7b769 ("powerpc/64s/hash: Convert SLB miss handlers to C")
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20191221121337.4894-1-mpe@ellerman.id.au
      91a063c9
  7. 21 12月, 2019 3 次提交
  8. 20 12月, 2019 4 次提交
  9. 19 12月, 2019 10 次提交
    • A
      MIPS: BPF: eBPF JIT: check for MIPS ISA compliance in Kconfig · f596cf0d
      Alexander Lobakin 提交于
      It is completely wrong to check for compile-time MIPS ISA revision in
      the body of bpf_int_jit_compile() as it may lead to get MIPS JIT fully
      omitted by the CC while the rest system will think that the JIT is
      actually present and works [1].
      We can check if the selected CPU really supports MIPS eBPF JIT at
      configure time and avoid such situations when kernel can be built
      without both JIT and interpreter, but with CONFIG_BPF_SYSCALL=y.
      
      [1] https://lore.kernel.org/linux-mips/09d713a59665d745e21d021deeaebe0a@dlink.ru/
      
      Fixes: 716850ab ("MIPS: eBPF: Initial eBPF support for MIPS32 architecture.")
      Cc: <stable@vger.kernel.org> # v5.2+
      Signed-off-by: NAlexander Lobakin <alobakin@dlink.ru>
      Signed-off-by: NPaul Burton <paulburton@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Hassan Naveed <hnaveed@wavecomp.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: Andrii Nakryiko <andriin@fb.com>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Cc: bpf@vger.kernel.org
      f596cf0d
    • P
      MIPS: BPF: Disable MIPS32 eBPF JIT · f8fffebd
      Paul Burton 提交于
      Commit 716850ab ("MIPS: eBPF: Initial eBPF support for MIPS32
      architecture.") enabled our eBPF JIT for MIPS32 kernels, whereas it has
      previously only been availailable for MIPS64. It was my understanding at
      the time that the BPF test suite was passing & JITing a comparable
      number of tests to our cBPF JIT [1], but it turns out that was not the
      case.
      
      The eBPF JIT has a number of problems on MIPS32:
      
      - Most notably various code paths still result in emission of MIPS64
        instructions which will cause reserved instruction exceptions & kernel
        panics when run on MIPS32 CPUs.
      
      - The eBPF JIT doesn't account for differences between the O32 ABI used
        by MIPS32 kernels versus the N64 ABI used by MIPS64 kernels. Notably
        arguments beyond the first 4 are passed on the stack in O32, and this
        is entirely unhandled when JITing a BPF_CALL instruction. Stack space
        must be reserved for arguments even if they all fit in registers, and
        the callee is free to assume that stack space has been reserved for
        its use - with the eBPF JIT this is not the case, so calling any
        function can result in clobbering values on the stack & unpredictable
        behaviour. Function arguments in eBPF are always 64-bit values which
        is also entirely unhandled - the JIT still uses a single (32-bit)
        register per argument. As a result all function arguments are always
        passed incorrectly when JITing a BPF_CALL instruction, leading to
        kernel crashes or strange behavior.
      
      - The JIT attempts to bail our on use of ALU64 instructions or 64-bit
        memory access instructions. The code doing this at the start of
        build_one_insn() incorrectly checks whether BPF_OP() equals BPF_DW,
        when it should really be checking BPF_SIZE() & only doing so when
        BPF_CLASS() is one of BPF_{LD,LDX,ST,STX}. This results in false
        positives that cause more bailouts than intended, and that in turns
        hides some of the problems described above.
      
      - The kernel's cBPF->eBPF translation makes heavy use of 64-bit eBPF
        instructions that the MIPS32 eBPF JIT bails out on, leading to most
        cBPF programs not being JITed at all.
      
      Until these problems are resolved, revert the enabling of the eBPF JIT
      on MIPS32 done by commit 716850ab ("MIPS: eBPF: Initial eBPF support
      for MIPS32 architecture.").
      
      Note that this does not undo the changes made to the eBPF JIT by that
      commit, since they are a useful starting point to providing MIPS32
      support - they're just not nearly complete.
      
      [1] https://lore.kernel.org/linux-mips/MWHPR2201MB13583388481F01A422CE7D66D4410@MWHPR2201MB1358.namprd22.prod.outlook.com/Signed-off-by: NPaul Burton <paulburton@kernel.org>
      Fixes: 716850ab ("MIPS: eBPF: Initial eBPF support for MIPS32 architecture.")
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Hassan Naveed <hnaveed@wavecomp.com>
      Cc: Tony Ambardar <itugrok@yahoo.com>
      Cc: bpf@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Cc: <stable@vger.kernel.org> # v5.2+
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      f8fffebd
    • J
      MIPS: Prevent link failure with kcov instrumentation · a4a38931
      Jouni Hogander 提交于
      __sanitizer_cov_trace_pc() is not linked in and causing link
      failure if KCOV_INSTRUMENT is enabled. Fix this by disabling
      instrumentation for compressed image.
      Signed-off-by: NJouni Hogander <jouni.hogander@unikie.com>
      Signed-off-by: NPaul Burton <paulburton@kernel.org>
      Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>
      Cc: linux-mips@vger.kernel.org
      a4a38931
    • V
      s390/ftrace: save traced function caller · b4adfe55
      Vasily Gorbik 提交于
      A typical backtrace acquired from ftraced function currently looks like
      the following (e.g. for "path_openat"):
      
      arch_stack_walk+0x15c/0x2d8
      stack_trace_save+0x50/0x68
      stack_trace_call+0x15a/0x3b8
      ftrace_graph_caller+0x0/0x1c
      0x3e0007e3c98 <- ftraced function caller (should be do_filp_open+0x7c/0xe8)
      do_open_execat+0x70/0x1b8
      __do_execve_file.isra.0+0x7d8/0x860
      __s390x_sys_execve+0x56/0x68
      system_call+0xdc/0x2d8
      
      Note random "0x3e0007e3c98" stack value as ftraced function caller. This
      value causes either imprecise unwinder result or unwinding failure.
      That "0x3e0007e3c98" comes from r14 of ftraced function stack frame, which
      it haven't had a chance to initialize since the very first instruction
      calls ftrace code ("ftrace_caller"). (ftraced function might never
      save r14 as well). Nevertheless according to s390 ABI any function
      is called with stack frame allocated for it and r14 contains return
      address. "ftrace_caller" itself is called with "brasl %r0,ftrace_caller".
      So, to fix this issue simply always save traced function caller onto
      ftraced function stack frame.
      Reported-by: NSven Schnelle <svens@linux.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      b4adfe55
    • V
      s390/unwind: stop gracefully at user mode pt_regs in irq stack · eef06cbf
      Vasily Gorbik 提交于
      Consider reaching user mode pt_regs at the bottom of irq stack graceful
      unwinder termination. This is the case when irq/mcck/ext interrupt arrives
      while in user mode.
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      eef06cbf
    • C
      s390/purgatory: do not build purgatory with kcov, kasan and friends · c23587c9
      Christian Borntraeger 提交于
      the purgatory must not rely on functions from the "old" kernel,
      so we must disable kasan and friends. We also need to have a
      separate copy of string.c as the default does not build memcmp
      with KASAN.
      Reported-by: Nkbuild test robot <lkp@intel.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Reviewed-by: NVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      c23587c9
    • H
      s390/purgatory: Make sure we fail the build if purgatory has missing symbols · cd92ac25
      Hans de Goede 提交于
      Since we link purgatory with -r aka we enable "incremental linking"
      no checks for unresolved symbols are done while linking the purgatory.
      
      This commit adds an extra check for unresolved symbols by calling ld
      without -r before running objcopy to generate purgatory.ro.
      
      This will help us catch missing symbols in the purgatory sooner.
      
      Note this commit also removes --no-undefined from LDFLAGS_purgatory
      as that has no effect.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/lkml/20191212205304.191610-1-hdegoede@redhat.comTested-by: NPhilipp Rudo <prudo@linux.ibm.com>
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      cd92ac25
    • S
      s390/ftrace: fix endless recursion in function_graph tracer · 6feeee8e
      Sven Schnelle 提交于
      The following sequence triggers a kernel stack overflow on s390x:
      
      mount -t tracefs tracefs /sys/kernel/tracing
      cd /sys/kernel/tracing
      echo function_graph > current_tracer
      [crash]
      
      This is because preempt_count_{add,sub} are in the list of traced
      functions, which can be demonstrated by:
      
      echo preempt_count_add >set_ftrace_filter
      echo function_graph > current_tracer
      [crash]
      
      The stack overflow happens because get_tod_clock_monotonic() gets called
      by ftrace but itself calls preempt_{disable,enable}(), which leads to a
      endless recursion. Fix this by using preempt_{disable,enable}_notrace().
      
      Fixes: 01162068 ("s390/time: ensure get_clock_monotonic() returns monotonic values")
      Signed-off-by: NSven Schnelle <svens@linux.ibm.com>
      Reviewed-by: NVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      6feeee8e
    • J
      kvm: x86: Host feature SSBD doesn't imply guest feature AMD_SSBD · 8715f052
      Jim Mattson 提交于
      The host reports support for the synthetic feature X86_FEATURE_SSBD
      when any of the three following hardware features are set:
        CPUID.(EAX=7,ECX=0):EDX.SSBD[bit 31]
        CPUID.80000008H:EBX.AMD_SSBD[bit 24]
        CPUID.80000008H:EBX.VIRT_SSBD[bit 25]
      
      Either of the first two hardware features implies the existence of the
      IA32_SPEC_CTRL MSR, but CPUID.80000008H:EBX.VIRT_SSBD[bit 25] does
      not. Therefore, CPUID.80000008H:EBX.AMD_SSBD[bit 24] should only be
      set in the guest if CPUID.(EAX=7,ECX=0):EDX.SSBD[bit 31] or
      CPUID.80000008H:EBX.AMD_SSBD[bit 24] is set on the host.
      
      Fixes: 4c6903a0 ("KVM: x86: fix reporting of AMD speculation bug CPUID leaf")
      Signed-off-by: NJim Mattson <jmattson@google.com>
      Reviewed-by: NJacob Xu <jacobhxu@google.com>
      Reviewed-by: NPeter Shier <pshier@google.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: stable@vger.kernel.org
      Reported-by: NEric Biggers <ebiggers@kernel.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      8715f052
    • J
      kvm: x86: Host feature SSBD doesn't imply guest feature SPEC_CTRL_SSBD · 396d2e87
      Jim Mattson 提交于
      The host reports support for the synthetic feature X86_FEATURE_SSBD
      when any of the three following hardware features are set:
        CPUID.(EAX=7,ECX=0):EDX.SSBD[bit 31]
        CPUID.80000008H:EBX.AMD_SSBD[bit 24]
        CPUID.80000008H:EBX.VIRT_SSBD[bit 25]
      
      Either of the first two hardware features implies the existence of the
      IA32_SPEC_CTRL MSR, but CPUID.80000008H:EBX.VIRT_SSBD[bit 25] does
      not. Therefore, CPUID.(EAX=7,ECX=0):EDX.SSBD[bit 31] should only be
      set in the guest if CPUID.(EAX=7,ECX=0):EDX.SSBD[bit 31] or
      CPUID.80000008H:EBX.AMD_SSBD[bit 24] is set on the host.
      
      Fixes: 0c54914d ("KVM: x86: use Intel speculation bugs and features as derived in generic x86 code")
      Signed-off-by: NJim Mattson <jmattson@google.com>
      Reviewed-by: NJacob Xu <jacobhxu@google.com>
      Reviewed-by: NPeter Shier <pshier@google.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: stable@vger.kernel.org
      Reported-by: NEric Biggers <ebiggers@kernel.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      396d2e87
  10. 18 12月, 2019 1 次提交
    • P
      KVM: PPC: Book3S HV: Don't do ultravisor calls on systems without ultravisor · d89c69f4
      Paul Mackerras 提交于
      Commit 22945688 ("KVM: PPC: Book3S HV: Support reset of secure
      guest") added a call to uv_svm_terminate, which is an ultravisor
      call, without any check that the guest is a secure guest or even that
      the system has an ultravisor.  On a system without an ultravisor,
      the ultracall will degenerate to a hypercall, but since we are not
      in KVM guest context, the hypercall will get treated as a system
      call, which could have random effects depending on what happens to
      be in r0, and could also corrupt the current task's kernel stack.
      Hence this adds a test for the guest being a secure guest before
      doing uv_svm_terminate().
      
      Fixes: 22945688 ("KVM: PPC: Book3S HV: Support reset of secure guest")
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      d89c69f4
  11. 17 12月, 2019 1 次提交