linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@kernel.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Andy Lutomirski <luto@kernel.org>, X86 ML <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Borislav Petkov <bp@alien8.de>, Brian Gerst <brgerst@gmail.com>,
	David Laight <David.Laight@aculab.com>,
	Kees Cook <keescook@chromium.org>,
	Peter Zijlstra <peterz@infradead.org>,
	"Kirill A. Shutemov" <kirill@shutemov.name>,
	Dave Hansen <dave.hansen@intel.com>
Subject: Re: [PATCH PTI v3 10/10] x86/pti: Put the LDT in its own PGD if PTI is on
Date: Fri, 15 Dec 2017 22:41:23 -0800	[thread overview]
Message-ID: <CALCETrWxC8VHwzE_FB9BFGAJhizUuXJ5oMjxGOxzPiRQAMsqQg@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1712160136460.2099@nanos>

On Fri, Dec 15, 2017 at 2:54 PM, Thomas Gleixner <tglx@linutronix.de> wrote:
> On Tue, 12 Dec 2017, Andy Lutomirski wrote:
>> +/* This is a multiple of PAGE_SIZE. */
>> +#define LDT_SLOT_STRIDE (LDT_ENTRIES * LDT_ENTRY_SIZE)
>> +
>> +static void *ldt_slot_va(int slot)
>
> How is that supposed to compile w/o warnings? Want's to be inline ....

Good question.  But it does compile for me and apparently for the 0day
bot without warnings.  Fixed in my tree.

On Fri, Dec 15, 2017 at 4:39 PM, Thomas Gleixner <tglx@linutronix.de> wrote:
> On Tue, 12 Dec 2017, Andy Lutomirski wrote:
>> +
>> +     return 0;
>> +#else
>> +     return -EINVAL;
>
> Errm. What's the point of that? Breaking non PTI?

That's embarrassing.

>
>>       new_ldt = alloc_ldt_struct(old_mm->context.ldt->nr_entries);
>>       if (!new_ldt) {
>> @@ -155,8 +266,17 @@ int init_new_context_ldt(struct task_struct *tsk, struct mm_struct *mm)
>>       memcpy(new_ldt->entries, old_mm->context.ldt->entries,
>>              new_ldt->nr_entries * LDT_ENTRY_SIZE);
>>       finalize_ldt_struct(new_ldt);
>> +     retval = map_ldt_struct(mm, new_ldt, 0);
>> +     if (retval)
>> +             goto out_free;
>>
>>       mm->context.ldt = new_ldt;
>> +     goto out_unlock;
>> +
>> +out_free:
>> +     free_ldt_pgtables(mm);
>> +     free_ldt_struct(new_ldt);
>> +     return retval;
>
> Leaks old_mm->context_lock;
>

Indeed.

I'm going to go test the failure paths better tomorrow.  Meanwhile,
all three issues should be fixed in my tree.

      reply	other threads:[~2017-12-16  6:41 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-11 23:40 [PATCH PTI v3 00/10] Clean up pgd handling and fix VSYSCALL and LDT Andy Lutomirski
2017-12-12 10:09 ` Ingo Molnar
2017-12-12 15:58   ` Andy Lutomirski
2017-12-12 16:13     ` Borislav Petkov
2017-12-12 16:14       ` Juergen Gross
2017-12-12 16:20         ` Borislav Petkov
2017-12-12 15:56 ` [PATCH PTI v3 01/10] x86/espfix/64: Fix espfix double-fault handling on 5-level systems Andy Lutomirski
2017-12-12 17:18   ` Kirill A. Shutemov
2017-12-15 18:34   ` [tip:x86/urgent] " tip-bot for Andy Lutomirski
2017-12-12 15:56 ` [PATCH PTI v3 02/10] x86/pti: Vastly simplify pgd synchronization Andy Lutomirski
2017-12-12 15:56 ` [PATCH PTI v3 03/10] x86/pti/64: Fix ESPFIX64 user mapping Andy Lutomirski
2017-12-13 13:12   ` Kirill A. Shutemov
2017-12-13 17:01     ` Andy Lutomirski
2017-12-14 14:10       ` Kirill A. Shutemov
2017-12-14 16:18         ` Andy Lutomirski
2017-12-12 15:56 ` [PATCH PTI v3 04/10] Revert "x86/mm/pti: Disable native VSYSCALL" Andy Lutomirski
2017-12-12 15:56 ` [PATCH PTI v3 05/10] x86/vsyscall/64: Explicitly set _PAGE_USER in the pagetable hierarchy Andy Lutomirski
2017-12-12 15:56 ` [PATCH PTI v3 06/10] x86/vsyscall/64: Warn and fail vsyscall emulation in NATIVE mode Andy Lutomirski
2017-12-12 15:56 ` [PATCH PTI v3 07/10] x86/pti: Map the vsyscall page if needed Andy Lutomirski
2017-12-12 15:56 ` [PATCH PTI v3 08/10] x86/mm/64: Improve the memory map documentation Andy Lutomirski
2017-12-12 15:56 ` [PATCH PTI v3 09/10] x86/mm/64: Make a full PGD-entry size hole in the memory map Andy Lutomirski
2017-12-13 13:17   ` Kirill A. Shutemov
2017-12-13 17:04     ` Andy Lutomirski
2017-12-12 15:56 ` [PATCH PTI v3 10/10] x86/pti: Put the LDT in its own PGD if PTI is on Andy Lutomirski
2017-12-15 22:54   ` Thomas Gleixner
2017-12-16  0:39   ` Thomas Gleixner
2017-12-16  6:41     ` Andy Lutomirski [this message]

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=CALCETrWxC8VHwzE_FB9BFGAJhizUuXJ5oMjxGOxzPiRQAMsqQg@mail.gmail.com \
    --to=luto@kernel.org \
    --cc=David.Laight@aculab.com \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=dave.hansen@intel.com \
    --cc=keescook@chromium.org \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --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).