提交 5ff2048e 编写于 作者: A Andy Lutomirski 提交者: Yang Yingliang

x86/traps: Stop using ist_enter/exit() in do_int3()

mainline inclusion
from mainline-v5.7-rc1
commit 65c668f5
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I47H3V
CVE: NA

--------------------------------

harder to change ist_enter() and ist_exit()'s behavior.  Instead open-code
the very small amount of required logic.
Signed-off-by: NAndy Lutomirski <luto@kernel.org>
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
Reviewed-by: NAlexandre Chartre <alexandre.chartre@oracle.com>
Reviewed-by: NAndy Lutomirski <luto@kernel.org>
Link: https://lkml.kernel.org/r/20200225220217.150607679@linutronix.deSigned-off-by: NGuoqing Jiang <jiangguoqing@kylinos.cn>
Signed-off-by: NJackie Liu <liuyun01@kylinos.cn>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 f816e3aa
...@@ -593,14 +593,20 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code) ...@@ -593,14 +593,20 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)
return; return;
/* /*
* Use ist_enter despite the fact that we don't use an IST stack. * Unlike any other non-IST entry, we can be called from a kprobe in
* We can be called from a kprobe in non-CONTEXT_KERNEL kernel * non-CONTEXT_KERNEL kernel mode or even during context tracking
* mode or even during context tracking state changes. * state changes. Make sure that we wake up RCU even if we're coming
* from kernel code.
* *
* This means that we can't schedule. That's okay. * This means that we can't schedule even if we came from a
* preemptible kernel context. That's okay.
*/ */
ist_enter(regs); if (!user_mode(regs)) {
rcu_nmi_enter();
preempt_disable();
}
RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU"); RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU");
#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP #ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP, if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP,
SIGTRAP) == NOTIFY_STOP) SIGTRAP) == NOTIFY_STOP)
...@@ -621,7 +627,10 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code) ...@@ -621,7 +627,10 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)
cond_local_irq_disable(regs); cond_local_irq_disable(regs);
exit: exit:
ist_exit(regs); if (!user_mode(regs)) {
preempt_enable_no_resched();
rcu_nmi_exit();
}
} }
NOKPROBE_SYMBOL(do_int3); NOKPROBE_SYMBOL(do_int3);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册