Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1264794

Re: [PATCH 1/4] x86/entry/64: Fix irqflag tracing wrt context tracking

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject Re: [PATCH 1/4] x86/entry/64: Fix irqflag tracing wrt context tracking
Date 2015-11-07 11:10 +0100
Message-ID <qs8Bz-Te-5@gated-at.bofh.it> (permalink)
References <qrYsx-2Hd-3@gated-at.bofh.it> <qrYsx-2Hd-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, 6 Nov 2015, Andy Lutomirski wrote:
> Paolo pointed out that enter_from_user_mode could be called while
> irqflags were traced as though IRQs were on.
> 
> In principle, this could confuse lockdep.  It doesn't cause any
> problems that I've seen in any configuration, but if I build with
> CONFIG_DEBUG_LOCKDEP=y, enable a nohz_full CPU, and add code like:
> 
> 	if (irqs_disabled()) {
> 		spin_lock(&something);
> 		spin_unlock(&something);
> 	}
> 
> to the top of enter_from_user_mode, then lockdep will complain
> without this fix.  It seems that lockdep's irqflags sanity checks
> are too weak to detect this bug without forcing the issue.
> 
> This patch adds one byte to normal kernels, and it's IMO a bit ugly.
> I haven't spotted a better way to do this yet, though.  The issue is
> that we can't do TRACE_IRQS_OFF until after SWAPGS (if needed), but
> we're also supposed to do it before calling C code.
> 
> An alternative approach would be to call trace_hardirqs_off in
> enter_from_user_mode.  That would be less code and would not bloat
> normal kernels at all, but it would be harder to see how the code
> worked.
> 
> Signed-off-by: Andy Lutomirski <luto@kernel.org>

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/4] x86/entry/64: Fix irqflag tracing wrt context tracking Andy Lutomirski <luto@kernel.org> - 2015-11-07 00:20 +0100
  Re: [PATCH 1/4] x86/entry/64: Fix irqflag tracing wrt context  tracking Thomas Gleixner <tglx@linutronix.de> - 2015-11-07 11:10 +0100
  Re: [PATCH 1/4] x86/entry/64: Fix irqflag tracing wrt context  tracking Borislav Petkov <bp@alien8.de> - 2015-11-07 12:20 +0100
    Re: [PATCH 1/4] x86/entry/64: Fix irqflag tracing wrt context tracking Andy Lutomirski <luto@amacapital.net> - 2015-11-09 05:30 +0100

csiph-web