linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Linus Torvalds <torvalds@linuxfoundation.org>,
	x86@kernel.org, Peter Zijlstra <peterz@infradead.org>,
	Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@alien8.de>,
	Brian Gerst <brgerst@gmail.com>,
	David Laight <David.Laight@aculab.com>,
	Kees Cook <keescook@chromium.org>
Subject: Re: [patch V2 2/2] x86/ldt: Prevent ldt inheritance on exec
Date: Sat, 9 Dec 2017 19:28:31 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1712091927320.2301@nanos> (raw)
In-Reply-To: <alpine.DEB.2.20.1712091922340.2301@nanos>

On Sat, 9 Dec 2017, Thomas Gleixner wrote:

> On Fri, 8 Dec 2017, Thomas Gleixner wrote:
> > +int ldt_dup_context(struct mm_struct *old_mm, struct mm_struct *mm)
> >  {
> >  	struct ldt_struct *new_ldt;
> > -	struct mm_struct *old_mm;
> >  	int retval = 0;
> >  
> > -	mutex_init(&mm->context.lock);
> > -	old_mm = current->mm;
> > -	if (!old_mm) {
> > -		mm->context.ldt = NULL;
> > +	if (!old_mm)
> >  		return 0;
> > -	}
> >  
> >  	mutex_lock(&old_mm->context.lock);
> 
> Bah. That's broken. It now nests into old_mm->mmap_sem which is the reverse
> lock order than in ldt_write. Will fix.

Confused myself. mmap_sem is not taken in mainline ldt_write. It's just in
the stuff I'm working on.

Thanks,

	tglx

  reply	other threads:[~2017-12-09 18:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-08 22:32 [patch V2 0/2] x86/ldt: Prevent LDT inheritance on exec() Thomas Gleixner
2017-12-08 22:32 ` [patch V2 1/2] arch: Allow arch_dup_mmap() to fail Thomas Gleixner
2017-12-08 22:32 ` [patch V2 2/2] x86/ldt: Prevent ldt inheritance on exec Thomas Gleixner
2017-12-09 18:24   ` Thomas Gleixner
2017-12-09 18:28     ` Thomas Gleixner [this message]
2017-12-11 12:13     ` Peter Zijlstra
2017-12-12 17:00       ` Thomas Gleixner

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=alpine.DEB.2.20.1712091927320.2301@nanos \
    --to=tglx@linutronix.de \
    --cc=David.Laight@aculab.com \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=peterz@infradead.org \
    --cc=torvalds@linuxfoundation.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).