加载提交签名时发生错误
  1. 29 5月, 2021 3 次提交
    • W
      KVM: X86: Kill off ctxt->ud · b35491e6
      Wanpeng Li 提交于
      ctxt->ud is consumed only by x86_decode_insn(), we can kill it off by
      passing emulation_type to x86_decode_insn() and dropping ctxt->ud
      altogether. Tracking that info in ctxt for literally one call is silly.
      Suggested-by: NSean Christopherson <seanjc@google.com>
      Signed-off-by: NWanpeng Li <wanpengli@tencent.com>
      Reviewed-by: NSean Christopherson <seanjc@google.com>
      Message-Id: <1622160097-37633-2-git-send-email-wanpengli@tencent.com>
      b35491e6
    • W
      KVM: X86: Fix warning caused by stale emulation context · da6393cd
      Wanpeng Li 提交于
      Reported by syzkaller:
      
        WARNING: CPU: 7 PID: 10526 at linux/arch/x86/kvm//x86.c:7621 x86_emulate_instruction+0x41b/0x510 [kvm]
        RIP: 0010:x86_emulate_instruction+0x41b/0x510 [kvm]
        Call Trace:
         kvm_mmu_page_fault+0x126/0x8f0 [kvm]
         vmx_handle_exit+0x11e/0x680 [kvm_intel]
         vcpu_enter_guest+0xd95/0x1b40 [kvm]
         kvm_arch_vcpu_ioctl_run+0x377/0x6a0 [kvm]
         kvm_vcpu_ioctl+0x389/0x630 [kvm]
         __x64_sys_ioctl+0x8e/0xd0
         do_syscall_64+0x3c/0xb0
         entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Commit 4a1e10d5 ("KVM: x86: handle hardware breakpoints during emulation())
      adds hardware breakpoints check before emulation the instruction and parts of
      emulation context initialization, actually we don't have the EMULTYPE_NO_DECODE flag
      here and the emulation context will not be reused. Commit c8848cee ("KVM: x86:
      set ctxt->have_exception in x86_decode_insn()) triggers the warning because it
      catches the stale emulation context has #UD, however, it is not during instruction
      decoding which should result in EMULATION_FAILED. This patch fixes it by moving
      the second part emulation context initialization into init_emulate_ctxt() and
      before hardware breakpoints check. The ctxt->ud will be dropped by a follow-up
      patch.
      
      syzkaller source: https://syzkaller.appspot.com/x/repro.c?x=134683fdd00000
      
      Reported-by: syzbot+71271244f206d17f6441@syzkaller.appspotmail.com
      Fixes: 4a1e10d5 (KVM: x86: handle hardware breakpoints during emulation)
      Signed-off-by: NWanpeng Li <wanpengli@tencent.com>
      Reviewed-by: NSean Christopherson <seanjc@google.com>
      Message-Id: <1622160097-37633-1-git-send-email-wanpengli@tencent.com>
      da6393cd
    • Y
      KVM: X86: Use kvm_get_linear_rip() in single-step and #DB/#BP interception · e87e46d5
      Yuan Yao 提交于
      The kvm_get_linear_rip() handles x86/long mode cases well and has
      better readability, __kvm_set_rflags() also use the paired
      function kvm_is_linear_rip() to check the vcpu->arch.singlestep_rip
      set in kvm_arch_vcpu_ioctl_set_guest_debug(), so change the
      "CS.BASE + RIP" code in kvm_arch_vcpu_ioctl_set_guest_debug() and
      handle_exception_nmi() to this one.
      Signed-off-by: NYuan Yao <yuan.yao@intel.com>
      Message-Id: <20210526063828.1173-1-yuan.yao@linux.intel.com>
      Reviewed-by: NSean Christopherson <seanjc@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      e87e46d5
  2. 27 5月, 2021 11 次提交
  3. 25 5月, 2021 8 次提交
    • T
      MIPS: Fix kernel hang under FUNCTION_GRAPH_TRACER and PREEMPT_TRACER · 78cf0eb9
      Tiezhu Yang 提交于
      When update the latest mainline kernel with the following three configs,
      the kernel hangs during startup:
      
      (1) CONFIG_FUNCTION_GRAPH_TRACER=y
      (2) CONFIG_PREEMPT_TRACER=y
      (3) CONFIG_FTRACE_STARTUP_TEST=y
      
      When update the latest mainline kernel with the above two configs (1)
      and (2), the kernel starts normally, but it still hangs when execute
      the following command:
      
      echo "function_graph" > /sys/kernel/debug/tracing/current_tracer
      
      Without CONFIG_PREEMPT_TRACER=y, the above two kinds of kernel hangs
      disappeared, so it seems that CONFIG_PREEMPT_TRACER has some influences
      with function_graph tracer at the first glance.
      
      I use ejtag to find out the epc address is related with preempt_enable()
      in the file arch/mips/lib/mips-atomic.c, because function tracing can
      trace the preempt_{enable,disable} calls that are traced, replace them
      with preempt_{enable,disable}_notrace to prevent function tracing from
      going into an infinite loop, and then it can fix the kernel hang issue.
      
      By the way, it seems that this commit is a complement and improvement of
      commit f93a1a00 ("MIPS: Fix crash that occurs when function tracing
      is enabled").
      Signed-off-by: NTiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NThomas Bogendoerfer <tsbogend@alpha.franken.de>
      78cf0eb9
    • R
      MIPS: ralink: export rt_sysc_membase for rt2880_wdt.c · fef532ea
      Randy Dunlap 提交于
      rt2880_wdt.c uses (well, attempts to use) rt_sysc_membase. However,
      when this watchdog driver is built as a loadable module, there is a
      build error since the rt_sysc_membase symbol is not exported.
      Export it to quell the build error.
      
      ERROR: modpost: "rt_sysc_membase" [drivers/watchdog/rt2880_wdt.ko] undefined!
      
      Fixes: 473cf939 ("watchdog: add ralink watchdog driver")
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: Wim Van Sebroeck <wim@iguana.be>
      Cc: John Crispin <john@phrozen.org>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-watchdog@vger.kernel.org
      Acked-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NThomas Bogendoerfer <tsbogend@alpha.franken.de>
      fef532ea
    • R
      MIPS: launch.h: add include guard to prevent build errors · 6855adc2
      Randy Dunlap 提交于
      arch/mips/include/asm/mips-boards/launch.h needs an include guard
      to prevent it from being #included more than once.
      Prevents these build errors:
      
      In file included from ../arch/mips/mti-malta/malta-amon.c:16:
      ../arch/mips/include/asm/mips-boards/launch.h:8:8: error: redefinition of 'struct cpulaunch'
          8 | struct cpulaunch {
            |        ^~~~~~~~~
      In file included from ../arch/mips/include/asm/mips-cps.h:13,
                       from ../arch/mips/include/asm/smp-ops.h:16,
                       from ../arch/mips/include/asm/smp.h:21,
                       from ../include/linux/smp.h:114,
                       from ../arch/mips/mti-malta/malta-amon.c:12:
      ../arch/mips/include/asm/mips-boards/launch.h:8:8: note: originally defined here
          8 | struct cpulaunch {
            |        ^~~~~~~~~
      make[3]: [../scripts/Makefile.build:273: arch/mips/mti-malta/malta-amon.o] Error 1 (ignored)
      
      Fixes: 6decd1aa ("MIPS: add support for buggy MT7621S core detection")
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Reported-by: Nkernel test robot <lkp@intel.com>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: linux-mips@vger.kernel.org
      Cc: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
      Reviewed-by: NIlya Lipnitskiy <ilya.lipnitskiy@gmail.com>
      Signed-off-by: NThomas Bogendoerfer <tsbogend@alpha.franken.de>
      6855adc2
    • R
      MIPS: alchemy: xxs1500: add gpio-au1000.h header file · ff4cff96
      Randy Dunlap 提交于
      board-xxs1500.c references 2 functions without declaring them, so add
      the header file to placate the build.
      
      ../arch/mips/alchemy/board-xxs1500.c: In function 'board_setup':
      ../arch/mips/alchemy/board-xxs1500.c:56:2: error: implicit declaration of function 'alchemy_gpio1_input_enable' [-Werror=implicit-function-declaration]
         56 |  alchemy_gpio1_input_enable();
      ../arch/mips/alchemy/board-xxs1500.c:57:2: error: implicit declaration of function 'alchemy_gpio2_enable'; did you mean 'alchemy_uart_enable'? [-Werror=implicit-function-declaration]
         57 |  alchemy_gpio2_enable();
      
      Fixes: 8e026910 ("MIPS: Alchemy: merge GPR/MTX-1/XXS1500 board code into single files")
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: linux-mips@vger.kernel.org
      Cc: Manuel Lauss <manuel.lauss@googlemail.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Acked-by: NManuel Lauss <manuel.lauss@gmail.com>
      Signed-off-by: NThomas Bogendoerfer <tsbogend@alpha.franken.de>
      ff4cff96
    • J
      arm64: mm: don't use CON and BLK mapping if KFENCE is enabled · e6901240
      Jisheng Zhang 提交于
      When we added KFENCE support for arm64, we intended that it would
      force the entire linear map to be mapped at page granularity, but we
      only enforced this in arch_add_memory() and not in map_mem(), so
      memory mapped at boot time can be mapped at a larger granularity.
      
      When booting a kernel with KFENCE=y and RODATA_FULL=n, this results in
      the following WARNING at boot:
      
      [    0.000000] ------------[ cut here ]------------
      [    0.000000] WARNING: CPU: 0 PID: 0 at mm/memory.c:2462 apply_to_pmd_range+0xec/0x190
      [    0.000000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.13.0-rc1+ #10
      [    0.000000] Hardware name: linux,dummy-virt (DT)
      [    0.000000] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO BTYPE=--)
      [    0.000000] pc : apply_to_pmd_range+0xec/0x190
      [    0.000000] lr : __apply_to_page_range+0x94/0x170
      [    0.000000] sp : ffffffc010573e20
      [    0.000000] x29: ffffffc010573e20 x28: ffffff801f400000 x27: ffffff801f401000
      [    0.000000] x26: 0000000000000001 x25: ffffff801f400fff x24: ffffffc010573f28
      [    0.000000] x23: ffffffc01002b710 x22: ffffffc0105fa450 x21: ffffffc010573ee4
      [    0.000000] x20: ffffff801fffb7d0 x19: ffffff801f401000 x18: 00000000fffffffe
      [    0.000000] x17: 000000000000003f x16: 000000000000000a x15: ffffffc01060b940
      [    0.000000] x14: 0000000000000000 x13: 0098968000000000 x12: 0000000098968000
      [    0.000000] x11: 0000000000000000 x10: 0000000098968000 x9 : 0000000000000001
      [    0.000000] x8 : 0000000000000000 x7 : ffffffc010573ee4 x6 : 0000000000000001
      [    0.000000] x5 : ffffffc010573f28 x4 : ffffffc01002b710 x3 : 0000000040000000
      [    0.000000] x2 : ffffff801f5fffff x1 : 0000000000000001 x0 : 007800005f400705
      [    0.000000] Call trace:
      [    0.000000]  apply_to_pmd_range+0xec/0x190
      [    0.000000]  __apply_to_page_range+0x94/0x170
      [    0.000000]  apply_to_page_range+0x10/0x20
      [    0.000000]  __change_memory_common+0x50/0xdc
      [    0.000000]  set_memory_valid+0x30/0x40
      [    0.000000]  kfence_init_pool+0x9c/0x16c
      [    0.000000]  kfence_init+0x20/0x98
      [    0.000000]  start_kernel+0x284/0x3f8
      
      Fixes: 840b2398 ("arm64, kfence: enable KFENCE for ARM64")
      Cc: <stable@vger.kernel.org> # 5.12.x
      Signed-off-by: NJisheng Zhang <Jisheng.Zhang@synaptics.com>
      Acked-by: NMark Rutland <mark.rutland@arm.com>
      Acked-by: NMarco Elver <elver@google.com>
      Tested-by: NMarco Elver <elver@google.com>
      Link: https://lore.kernel.org/r/20210525104551.2ec37f77@xhacker.debianSigned-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      e6901240
    • P
      KVM: SVM: make the avic parameter a bool · 28a4aa11
      Paolo Bonzini 提交于
      Make it consistent with kvm_intel.enable_apicv.
      Suggested-by: NSean Christopherson <seanjc@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      28a4aa11
    • V
      KVM: VMX: Drop unneeded CONFIG_X86_LOCAL_APIC check · 377872b3
      Vitaly Kuznetsov 提交于
      CONFIG_X86_LOCAL_APIC is always on when CONFIG_KVM (on x86) since
      commit e42eef4b ("KVM: add X86_LOCAL_APIC dependency").
      Suggested-by: NSean Christopherson <seanjc@google.com>
      Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Message-Id: <20210518144339.1987982-3-vkuznets@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NSean Christopherson <seanjc@google.com>
      377872b3
    • V
      KVM: SVM: Drop unneeded CONFIG_X86_LOCAL_APIC check · 778a136e
      Vitaly Kuznetsov 提交于
      AVIC dependency on CONFIG_X86_LOCAL_APIC is dead code since
      commit e42eef4b ("KVM: add X86_LOCAL_APIC dependency").
      Suggested-by: NSean Christopherson <seanjc@google.com>
      Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Message-Id: <20210518144339.1987982-2-vkuznets@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Reviewed-by: NSean Christopherson <seanjc@google.com>
      778a136e
  4. 23 5月, 2021 4 次提交
    • J
      riscv: kexec: Fix W=1 build warnings · bab0d47c
      Jisheng Zhang 提交于
      Fixes the following W=1 build warning(s):
      
      In file included from include/linux/kexec.h:28,
                       from arch/riscv/kernel/machine_kexec.c:7:
      arch/riscv/include/asm/kexec.h:45:1: warning: ‘extern’ is not at beginning of declaration [-Wold-style-declaration]
         45 | const extern unsigned char riscv_kexec_relocate[];
            | ^~~~~
      arch/riscv/include/asm/kexec.h:46:1: warning: ‘extern’ is not at beginning of declaration [-Wold-style-declaration]
         46 | const extern unsigned int riscv_kexec_relocate_size;
            | ^~~~~
      arch/riscv/kernel/machine_kexec.c:125:6: warning: no previous prototype for ‘machine_shutdown’ [-Wmissing-prototypes]
        125 | void machine_shutdown(void)
            |      ^~~~~~~~~~~~~~~~
      arch/riscv/kernel/machine_kexec.c:147:1: warning: no previous prototype for ‘machine_crash_shutdown’ [-Wmissing-prototypes]
        147 | machine_crash_shutdown(struct pt_regs *regs)
            | ^~~~~~~~~~~~~~~~~~~~~~
      arch/riscv/kernel/machine_kexec.c:23: warning: Function parameter or member 'image' not described in 'kexec_image_info'
      arch/riscv/kernel/machine_kexec.c:53: warning: Function parameter or member 'image' not described in 'machine_kexec_prepare'
      arch/riscv/kernel/machine_kexec.c:114: warning: Function parameter or member 'image' not described in 'machine_kexec_cleanup'
      arch/riscv/kernel/machine_kexec.c:148: warning: Function parameter or member 'regs' not described in 'machine_crash_shutdown'
      arch/riscv/kernel/machine_kexec.c:167: warning: Function parameter or member 'image' not described in 'machine_kexec'
      Signed-off-by: NJisheng Zhang <jszhang@kernel.org>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      bab0d47c
    • J
      riscv: kprobes: Fix build error when MMU=n · 02ccdeed
      Jisheng Zhang 提交于
      lkp reported a randconfig failure:
      
      arch/riscv/kernel/probes/kprobes.c:90:22: error: use of undeclared identifier 'PAGE_KERNEL_READ_EXEC'
      
      We implemented the alloc_insn_page() to allocate PAGE_KERNEL_READ_EXEC
      page for kprobes insn page for STRICT_MODULE_RWX. But if MMU=n, we
      should fall back to the generic weak alloc_insn_page() by generic
      kprobe subsystem.
      
      Fixes: cdd1b2bd ("riscv: kprobes: Implement alloc_insn_page()")
      Signed-off-by: NJisheng Zhang <jszhang@kernel.org>
      Reported-by: Nkernel test robot <lkp@intel.com>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      02ccdeed
    • K
      riscv: Select ARCH_USE_MEMTEST · 97a03108
      Kefeng Wang 提交于
      As of commit dce44566 ("mm/memtest: add ARCH_USE_MEMTEST"),
      architectures must select ARCH_USE_MEMTESET to enable CONFIG_MEMTEST.
      Signed-off-by: NKefeng Wang <wangkefeng.wang@huawei.com>
      Fixes: f6e5aedf ("riscv: Add support for memtest")
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      97a03108
    • C
      riscv: stacktrace: fix the riscv stacktrace when CONFIG_FRAME_POINTER enabled · eac2f305
      Chen Huang 提交于
      As [1] and [2] said, the arch_stack_walk should not to trace itself, or it will
      leave the trace unexpectedly when called. The example is when we do "cat
      /sys/kernel/debug/page_owner", all pages' stack is the same.
      
      arch_stack_walk+0x18/0x20
      stack_trace_save+0x40/0x60
      register_dummy_stack+0x24/0x5e
      init_page_owner+0x2e
      
      So we use __builtin_frame_address(1) as the first frame to be walked. And mark
      the arch_stack_walk() noinline.
      
      We found that pr_cont will affact pages' stack whose task state is RUNNING when
      testing "echo t > /proc/sysrq-trigger". So move the place of pr_cont and mark
      the function dump_backtrace() noinline.
      
      Also we move the case when task == NULL into else branch, and test for it in
      "echo c > /proc/sysrq-trigger".
      
      [1] https://lore.kernel.org/lkml/20210319184106.5688-1-mark.rutland@arm.com/
      [2] https://lore.kernel.org/lkml/20210317142050.57712-1-chenjun102@huawei.com/Signed-off-by: NChen Huang <chenhuang5@huawei.com>
      Fixes: 5d8544e2 ("RISC-V: Generic library routines and assembly")
      Cc: stable@vger.kernel.org
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      eac2f305
  5. 21 5月, 2021 2 次提交
    • J
      x86/Xen: swap NX determination and GDT setup on BSP · ae897fda
      Jan Beulich 提交于
      xen_setup_gdt(), via xen_load_gdt_boot(), wants to adjust page tables.
      For this to work when NX is not available, x86_configure_nx() needs to
      be called first.
      
      [jgross] Note that this is a revert of 36104cb9 ("x86/xen:
      Delay get_cpu_cap until stack canary is established"), which is possible
      now that we no longer support running as PV guest in 32-bit mode.
      
      Cc: <stable.vger.kernel.org> # 5.9
      Fixes: 36104cb9 ("x86/xen: Delay get_cpu_cap until stack canary is established")
      Reported-by: NOlaf Hering <olaf@aepfle.de>
      Signed-off-by: NJan Beulich <jbeulich@suse.com>
      Reviewed-by: NJuergen Gross <jgross@suse.com>
      
      Link: https://lore.kernel.org/r/12a866b0-9e89-59f7-ebeb-a2a6cec0987a@suse.comSigned-off-by: NJuergen Gross <jgross@suse.com>
      ae897fda
    • D
      bpf: Fix BPF_JIT kconfig symbol dependency · 6bdacdb4
      Daniel Borkmann 提交于
      Randy reported a randconfig build error recently on i386:
      
        ld: arch/x86/net/bpf_jit_comp32.o: in function `do_jit':
        bpf_jit_comp32.c:(.text+0x28c9): undefined reference to `__bpf_call_base'
        ld: arch/x86/net/bpf_jit_comp32.o: in function `bpf_int_jit_compile':
        bpf_jit_comp32.c:(.text+0x3694): undefined reference to `bpf_jit_blind_constants'
        ld: bpf_jit_comp32.c:(.text+0x3719): undefined reference to `bpf_jit_binary_free'
        ld: bpf_jit_comp32.c:(.text+0x3745): undefined reference to `bpf_jit_binary_alloc'
        ld: bpf_jit_comp32.c:(.text+0x37d3): undefined reference to `bpf_jit_prog_release_other'
        [...]
      
      The cause was that b24abcff ("bpf, kconfig: Add consolidated menu entry for
      bpf with core options") moved BPF_JIT from net/Kconfig into kernel/bpf/Kconfig
      and previously BPF_JIT was guarded by a 'if NET'. However, there is no actual
      dependency on NET, it's just that menuconfig NET selects BPF. And the latter in
      turn causes kernel/bpf/core.o to be built which contains above symbols. Randy's
      randconfig didn't have NET set, and BPF wasn't either, but BPF_JIT otoh was.
      Detangle this by making BPF_JIT depend on BPF instead. arm64 was the only arch
      that pulled in its JIT in net/ via obj-$(CONFIG_NET), all others unconditionally
      pull this dir in via obj-y. Do the same since CONFIG_NET guard there is really
      useless as we compiled the JIT via obj-$(CONFIG_BPF_JIT) += bpf_jit_comp.o anyway.
      
      Fixes: b24abcff ("bpf, kconfig: Add consolidated menu entry for bpf with core options")
      Reported-by: NRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NRandy Dunlap <rdunlap@infradead.org>
      Tested-by: NRandy Dunlap <rdunlap@infradead.org>
      6bdacdb4
  6. 20 5月, 2021 3 次提交
  7. 19 5月, 2021 5 次提交
  8. 18 5月, 2021 4 次提交