linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Andy Lutomirski <luto@kernel.org>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	"Brian Gerst" <brgerst@gmail.com>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"Frédéric Weisbecker" <fweisbec@gmail.com>,
	"Peter Zijlstra" <peterz@infradead.org>
Subject: Re: [PATCH 1/4] x86/entry/64: Fix irqflag tracing wrt context tracking
Date: Sat, 7 Nov 2015 12:18:24 +0100	[thread overview]
Message-ID: <20151107111824.GA6137@pd.tnic> (raw)
In-Reply-To: <f3b6b3003f7a2d3304763394160dc7e32ff70d6c.1446849780.git.luto@kernel.org>

On Fri, Nov 06, 2015 at 03:12:43PM -0800, 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.

I would not mind to have that explanation in the code itself so that
people don't scratch heads why the duplicated TRACE_IRQS_OFF call.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.

  parent reply	other threads:[~2015-11-07 11:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06 23:12 [PATCH 0/4] x86 entry stuff, maybe for 4.4 Andy Lutomirski
2015-11-06 23:12 ` [PATCH 1/4] x86/entry/64: Fix irqflag tracing wrt context tracking Andy Lutomirski
2015-11-07  9:59   ` Thomas Gleixner
2015-11-07 11:18   ` Borislav Petkov [this message]
2015-11-09  4:20     ` Andy Lutomirski
2015-11-06 23:12 ` [PATCH 2/4] context_tracking: Switch to new static_branch API Andy Lutomirski
2015-11-07  9:59   ` Thomas Gleixner
2015-11-06 23:12 ` [PATCH 3/4] x86/asm: Add asm macros for static keys/jump labels Andy Lutomirski
2015-11-07 11:20   ` Thomas Gleixner
2015-11-07 16:49     ` Andy Lutomirski
2015-11-07 16:58       ` Thomas Gleixner
2015-11-07 17:05         ` Andy Lutomirski
2015-11-07 17:08           ` Thomas Gleixner
2015-11-07 18:16             ` Andy Lutomirski
2015-11-09  9:48               ` Peter Zijlstra
2015-11-08 16:16             ` Andy Lutomirski
2015-11-06 23:12 ` [PATCH 4/4] x86/entry/64: Bypass enter_from_user_mode on non-context-tracking boots Andy Lutomirski
2015-11-09  8:52   ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151107111824.GA6137@pd.tnic \
    --to=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).