Skip to content

Commit

Permalink
x86/mce: Allow instrumentation during task work queueing
Browse files Browse the repository at this point in the history
[ Upstream commit 4fbce46 ]

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>
Link: https://lore.kernel.org/r/20211208111343.8130-6-bp@alien8.de
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
suryasaimadhu authored and gregkh committed Jan 27, 2022
1 parent 3903e62 commit f2bde2a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions arch/x86/kernel/cpu/mce/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,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.
*/
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. */
Expand All @@ -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_current_task);
}

instrumentation_end();

out:
mce_wrmsrl(MSR_IA32_MCG_STATUS, 0);
}
Expand Down

0 comments on commit f2bde2a

Please sign in to comment.