Commit 15150116 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'riscv-for-linus-5.12-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux

Pull RISC-V fixes from Palmer Dabbelt:
 "A handful of fixes:

   - a fix to properly select SPARSEMEM_STATIC on rv32

   - a few fixes to kprobes

  I don't generally like sending stuff this late, but these all seem
  pretty safe"

* tag 'riscv-for-linus-5.12-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
  riscv: keep interrupts disabled for BREAKPOINT exception
  riscv: kprobes/ftrace: Add recursion protection to the ftrace callback
  riscv: add do_page_fault and do_trap_break into the kprobes blacklist
  riscv: Fix spelling mistake "SPARSEMEM" to "SPARSMEM"
parents 06c2aac4 7ae11635
...@@ -153,7 +153,7 @@ config ARCH_FLATMEM_ENABLE ...@@ -153,7 +153,7 @@ config ARCH_FLATMEM_ENABLE
config ARCH_SPARSEMEM_ENABLE config ARCH_SPARSEMEM_ENABLE
def_bool y def_bool y
depends on MMU depends on MMU
select SPARSEMEM_STATIC if 32BIT && SPARSMEM select SPARSEMEM_STATIC if 32BIT && SPARSEMEM
select SPARSEMEM_VMEMMAP_ENABLE if 64BIT select SPARSEMEM_VMEMMAP_ENABLE if 64BIT
config ARCH_SELECT_MEMORY_MODEL config ARCH_SELECT_MEMORY_MODEL
......
...@@ -130,6 +130,9 @@ skip_context_tracking: ...@@ -130,6 +130,9 @@ skip_context_tracking:
*/ */
andi t0, s1, SR_PIE andi t0, s1, SR_PIE
beqz t0, 1f beqz t0, 1f
/* kprobes, entered via ebreak, must have interrupts disabled. */
li t0, EXC_BREAKPOINT
beq s4, t0, 1f
#ifdef CONFIG_TRACE_IRQFLAGS #ifdef CONFIG_TRACE_IRQFLAGS
call trace_hardirqs_on call trace_hardirqs_on
#endif #endif
......
...@@ -9,10 +9,16 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, ...@@ -9,10 +9,16 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
struct kprobe *p; struct kprobe *p;
struct pt_regs *regs; struct pt_regs *regs;
struct kprobe_ctlblk *kcb; struct kprobe_ctlblk *kcb;
int bit;
bit = ftrace_test_recursion_trylock(ip, parent_ip);
if (bit < 0)
return;
preempt_disable_notrace();
p = get_kprobe((kprobe_opcode_t *)ip); p = get_kprobe((kprobe_opcode_t *)ip);
if (unlikely(!p) || kprobe_disabled(p)) if (unlikely(!p) || kprobe_disabled(p))
return; goto out;
regs = ftrace_get_regs(fregs); regs = ftrace_get_regs(fregs);
kcb = get_kprobe_ctlblk(); kcb = get_kprobe_ctlblk();
...@@ -45,6 +51,9 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, ...@@ -45,6 +51,9 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
*/ */
__this_cpu_write(current_kprobe, NULL); __this_cpu_write(current_kprobe, NULL);
} }
out:
preempt_enable_notrace();
ftrace_test_recursion_unlock(bit);
} }
NOKPROBE_SYMBOL(kprobe_ftrace_handler); NOKPROBE_SYMBOL(kprobe_ftrace_handler);
......
...@@ -178,6 +178,7 @@ asmlinkage __visible void do_trap_break(struct pt_regs *regs) ...@@ -178,6 +178,7 @@ asmlinkage __visible void do_trap_break(struct pt_regs *regs)
else else
die(regs, "Kernel BUG"); die(regs, "Kernel BUG");
} }
NOKPROBE_SYMBOL(do_trap_break);
#ifdef CONFIG_GENERIC_BUG #ifdef CONFIG_GENERIC_BUG
int is_valid_bugaddr(unsigned long pc) int is_valid_bugaddr(unsigned long pc)
......
...@@ -328,3 +328,4 @@ asmlinkage void do_page_fault(struct pt_regs *regs) ...@@ -328,3 +328,4 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
} }
return; return;
} }
NOKPROBE_SYMBOL(do_page_fault);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment