lkml.org 
[lkml]   [2020]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [patch V5 part 3 12/29] x86/entry/common: Provide idtentry_enter/exit()
On Mon, May 11, 2020 at 3:59 AM Thomas Gleixner <tglx@linutronix.de> wrote:
>
> Andy Lutomirski <luto@kernel.org> writes:
> >> + * Invoked by all exception/interrupt IDTENTRY handlers which are not
> >> + * returning through the paranoid exit path (all except NMI, #DF and the IST
> >> + * variants of #MC and #DB).
> >

> +void noinstr idtentry_exit(struct pt_regs *regs)
> +{
> + lockdep_assert_irqs_disabled();
> +
> + if (IS_ENABLED(CONFIG_DEBUG_ENTRY))
> + WARN_ON_ONCE(!on_thread_stack());

Whoops. After sleeping on this, this is obviously wrong. If this is
something like a page fault, we can be on an IST or IRQ stack.
Perhaps the actual condition should be:

WARN_ON_ONCE(!on_thread_stack() && (regs->flags & X86_FLAGS_IF) &&
preempt_count() == 0);

IOW, the actual condition we want is that, if the idtenter_entry/exit
code might schedule or if a cond_local_irq_enable() path might
schedule, we had better be on the correct stack.

Sorry for causing confusion.

\
 
 \ /
  Last update: 2020-05-11 17:32    [W:0.104 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site