lkml.org 
[lkml]   [2021]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v19 06/25] x86/cet: Add control-protection fault handler
From
Date
On 2/5/2021 5:59 AM, Borislav Petkov wrote:
> On Wed, Feb 03, 2021 at 02:55:28PM -0800, Yu-cheng Yu wrote:
>> +DEFINE_IDTENTRY_ERRORCODE(exc_control_protection)
>> +{
>> + static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL,
>> + DEFAULT_RATELIMIT_BURST);
>> + struct task_struct *tsk;
>> +
>> + if (!user_mode(regs)) {
>> + pr_emerg("PANIC: unexpected kernel control protection fault\n");
>> + die("kernel control protection fault", regs, error_code);
>> + panic("Machine halted.");
>> + }
>> +
>> + 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) &&
>> + __ratelimit(&rs)) {
>
> I can't find it written down anywhere why the ratelimiting is needed at
> all?
>

The ratelimit here is only for #CP, and its rate is not counted together
with other types of faults. If a task gets here, it will exit. The
only condition the ratelimit will trigger is when multiple tasks hit #CP
at once, which is unlikely. Are you suggesting that we do not need the
ratelimit here?

Thanks!

--
Yu-cheng

\
 
 \ /
  Last update: 2021-02-05 19:05    [W:0.144 / U:0.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site