[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAObL_7HwZDPeYe_T36zUMw+FA8x6DJX8Jzh59iuWXQLdktpR+Q@mail.gmail.com>
Date: Thu, 19 Jan 2012 08:13:27 -0800
From: Andrew Lutomirski <luto@....edu>
To: Jamie Lokier <jamie@...reable.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Indan Zupancic <indan@....nu>,
Andi Kleen <andi@...stfloor.org>,
Oleg Nesterov <oleg@...hat.com>,
Will Drewry <wad@...omium.org>, linux-kernel@...r.kernel.org,
keescook@...omium.org, john.johansen@...onical.com,
serge.hallyn@...onical.com, coreyb@...ux.vnet.ibm.com,
pmoore@...hat.com, eparis@...hat.com, djm@...drot.org,
segoon@...nwall.com, rostedt@...dmis.org, jmorris@...ei.org,
scarybeasts@...il.com, avi@...hat.com, penberg@...helsinki.fi,
viro@...iv.linux.org.uk, mingo@...e.hu, akpm@...ux-foundation.org,
khilman@...com, borislav.petkov@....com, amwang@...hat.com,
ak@...ux.intel.com, eric.dumazet@...il.com, gregkh@...e.de,
dhowells@...hat.com, daniel.lezcano@...e.fr,
linux-fsdevel@...r.kernel.org,
linux-security-module@...r.kernel.org, olofj@...omium.org,
mhalcrow@...gle.com, dlaor@...hat.com,
Roland McGrath <mcgrathr@...omium.org>
Subject: Re: Compat 32-bit syscall entry from 64-bit task!?
On Thu, Jan 19, 2012 at 8:01 AM, Jamie Lokier <jamie@...reable.org> wrote:
> Andrew Lutomirski wrote:
>> It's reasonable, obvious, and even more wrong than it appears. On
>> Xen, there's an extra 64-bit GDT entry, and it gets used by default.
>> (I got bitten by this in some iteration of the vsyscall emulation
>> patches -- see user_64bit_mode for the correct and
>> unusable-from-user-mode way to do this.)
>
> Here it is:
>
> static inline bool user_64bit_mode(struct pt_regs *regs)
> {
> #ifndef CONFIG_PARAVIRT
> /*
> * On non-paravirt systems, this is the only long mode CPL 3
> * selector. We do not allow long mode selectors in the LDT.
> */
> return regs->cs == __USER_CS;
> #else
> /* Headers are too twisted for this to go in paravirt.h. */
> return regs->cs == __USER_CS || regs->cs == pv_info.extra_user_64bit_cs;
> #endif
> }
>
> Perhaps userspace can do that.
> Would it be right for a ptracer to say:
>
> CS == 0x23 -> 32-bit
> (CS & 4) -> 32-bit (LDT, "we do not allow long mode selectors in the LDT")
> else -> 64-bit (__USER_CS or some other GDT entry which must be pv_info's)
>
> I.e. assume that no other *GDT* CS values are available to userspace?
> There are other 32-bit GDT entries, but are they not all for data or kernel use only?
I suspect not. asm/xen/interface_64.h has:
#define FLAT_RING3_CS32 0xe023 /* GDT index 260 */
#define FLAT_RING3_CS64 0xe033 /* GDT index 261 */
#define FLAT_RING3_DS32 0xe02b /* GDT index 262 */
#define FLAT_RING3_DS64 0x0000 /* NULL selector */
#define FLAT_RING3_SS32 0xe02b /* GDT index 262 */
#define FLAT_RING3_SS64 0xe02b /* GDT index 262 */
which sounds like there's an extra 32-bit selector as well. I haven't
checked, though.
--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists