lkml.org 
[lkml]   [2021]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v1 05/12] x86/mce: Allow instrumentation during task work queueing
On Wed, Dec 08, 2021 at 12:13:36PM +0100, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
>
> Fixes
>
> vmlinux.o: warning: objtool: do_machine_check()+0xdb1: call to queue_task_work() leaves .noinstr.text section
>
> Signed-off-by: Borislav Petkov <bp@suse.de>
> ---
> arch/x86/kernel/cpu/mce/core.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
> index f61f14faa532..d7fa444d6282 100644
> --- a/arch/x86/kernel/cpu/mce/core.c
> +++ b/arch/x86/kernel/cpu/mce/core.c
> @@ -1451,6 +1451,14 @@ noinstr void do_machine_check(struct pt_regs *regs)
> if (worst != MCE_AR_SEVERITY && !kill_current_task)
> goto out;
>
> + /*
> + * Enable instrumentation around the external facilities like
> + * task_work_add() (via queue_task_work()), fixup_exception() etc.
> + * For now, that is. Fixing this properly would need a lot more involved
> + * reorganization.

The only reason we want to fix that is to limit the amount of code MCE
runs, or is there additional concerns, like perhaps getting #DB traps
from !noinstr code?

> + */
> + instrumentation_begin();
> +
> /* Fault was in user mode and we need to take some action */
> if ((m.cs & 3) == 3) {
> /* If this triggers there is no way to recover. Die hard. */
> @@ -1479,6 +1487,9 @@ noinstr void do_machine_check(struct pt_regs *regs)
> if (m.kflags & MCE_IN_KERNEL_COPYIN)
> queue_task_work(&m, msg, kill_me_never);
> }
> +
> + instrumentation_end();
> +
> out:
> mce_wrmsrl(MSR_IA32_MCG_STATUS, 0);
> }
> --
> 2.29.2
>

\
 
 \ /
  Last update: 2021-12-09 13:18    [W:0.238 / U:0.360 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site