lkml.org 
[lkml]   [2021]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v17 06/26] x86/cet: Add control-protection fault handler
From
Date
On 1/19/2021 4:04 AM, Borislav Petkov wrote:
> On Tue, Dec 29, 2020 at 01:30:33PM -0800, Yu-cheng Yu wrote:
[...]
>> +DEFINE_IDTENTRY_ERRORCODE(exc_control_protection)
>> +{
>> + struct task_struct *tsk;
>> +
>> + if (!user_mode(regs)) {
>> + if (notify_die(DIE_TRAP, "control protection fault", regs,
>> + error_code, X86_TRAP_CP, SIGSEGV) == NOTIFY_STOP)
>> + return;
>> + die("Upexpected/unsupported kernel control protection fault", regs, error_code);
>
> Isn't the machine supposed to panic() here and do no further progress?

Ok, make it panic().

>> + }
>> +
>> + cond_local_irq_enable(regs);
>> +
>> + if (!boot_cpu_has(X86_FEATURE_CET))
>> + WARN_ONCE(1, "Control protection fault with CET support disabled\n");
>> +
>> + tsk = current;
>> + tsk->thread.error_code = error_code;
>> + tsk->thread.trap_nr = X86_TRAP_CP;
>> +
>> + if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) &&
>> + printk_ratelimit()) {
>
> WARNING: Prefer printk_ratelimited or pr_<level>_ratelimited to printk_ratelimit
> #136: FILE: arch/x86/kernel/traps.c:645:
> + printk_ratelimit()) {
>
> Still not using checkpatch?

Most places in arch/x86 still use printk_ratelimit(). I should have
trusted checkpatch. I will fix it.

>> + unsigned int max_err;
>> + unsigned long ssp;
>> +
>> + max_err = ARRAY_SIZE(control_protection_err) - 1;
>> + if ((error_code < 0) || (error_code > max_err))
>> + error_code = 0;
>> +
>> + rdmsrl(MSR_IA32_PL3_SSP, ssp);
>> + pr_info("%s[%d] control protection ip:%lx sp:%lx ssp:%lx error:%lx(%s)",
>
> If anything, all this stuff should be pr_emerg().

I will fix it.

--
Yu-cheng

\
 
 \ /
  Last update: 2021-01-19 20:41    [W:0.193 / U:0.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site