lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180305183647.GU16484@8bytes.org>
Date:   Mon, 5 Mar 2018 19:36:47 +0100
From:   Joerg Roedel <joro@...tes.org>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...nel.org>, Peter Anvin <hpa@...or.com>,
        the arch/x86 maintainers <x86@...nel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-mm <linux-mm@...ck.org>,
        Andrew Lutomirski <luto@...nel.org>,
        Dave Hansen <dave.hansen@...el.com>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Jürgen Groß <jgross@...e.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Borislav Petkov <bp@...en8.de>, Jiri Kosina <jkosina@...e.cz>,
        Boris Ostrovsky <boris.ostrovsky@...cle.com>,
        Brian Gerst <brgerst@...il.com>,
        David Laight <David.Laight@...lab.com>,
        Denys Vlasenko <dvlasenk@...hat.com>,
        Eduardo Valentin <eduval@...zon.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Will Deacon <will.deacon@....com>,
        "Liguori, Anthony" <aliguori@...zon.com>,
        Daniel Gruss <daniel.gruss@...k.tugraz.at>,
        Hugh Dickins <hughd@...gle.com>,
        Kees Cook <keescook@...gle.com>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Waiman Long <llong@...hat.com>, Pavel Machek <pavel@....cz>,
        Joerg Roedel <jroedel@...e.de>
Subject: Re: [PATCH 07/34] x86/entry/32: Restore segments before int registers

On Mon, Mar 05, 2018 at 10:23:59AM -0800, Linus Torvalds wrote:
> On Mon, Mar 5, 2018 at 5:12 AM, Joerg Roedel <joro@...tes.org> wrote:
> >
> >> The things is, we *know* that we will restore two segment registers with the
> >> user cr3 already loaded: CS and SS get restored with the final iret.
> >
> > Yeah, I know, but the iret-exception path is fine because it will
> > deliver a SIGILL and doesn't return to the faulting iret.
> 
> That's not so much my worry, as just getting %cr3 wrong. The fact is,
> we still take the exception, and we still have to handle it, and that
> still needs to get the user<->kernel cr3 right.

Right, as I said, up to v2 of this series I thought I could avoid the
whole from-kernel-with-user-cr3 game, but that turned out to be wrong.
Now I added the necessary check and handling for it, as at least the
#DB handler needs it.

> So then the whole "restore segments early" must be wrong, because
> *that* path must get it all right too, no?
> 
> And it appears that the code *does* get it right, and you can just
> avoid this patch entirely?

Right, I will drop this patch.

> 
> > The iret-exception case is tested by the ldt_gdt selftest (the
> > do_multicpu_tests subtest). But I didn't actually tested single-stepping
> > through sysenter yet. I just re-ran the same tests I did with v2 on this
> > patch-set.
> 
> Ok. Maybe we should have a test for the "take DB on first instruction
> of sysenter".

I put a selftest for that on my list of things to look into. I'll have
no idea how difficult this will be, but I certainly find out :)


Regards,

	Joerg

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ