[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5432C65C.4040406@zytor.com>
Date: Mon, 06 Oct 2014 09:42:04 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Andy Lutomirski <luto@...capital.net>,
Thomas Gleixner <tglx@...utronix.de>, X86 ML <x86@...nel.org>,
Ingo Molnar <mingo@...hat.com>
CC: Sebastian Lackner <sebastian@...-team.de>,
Anish Bhatt <anish@...lsio.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Chuck Ebbert <cebbert.lkml@...il.com>,
stable <stable@...r.kernel.org>
Subject: Re: [PATCH v4 1/2] x86_64,entry: Filter RFLAGS.NT on entry from userspace
On 10/01/2014 12:49 PM, Andy Lutomirski wrote:
> On Wed, Oct 1, 2014 at 11:49 AM, Andy Lutomirski <luto@...capital.net> wrote:
>> The NT flag doesn't do anything in long mode other than causing IRET
>> to #GP. Oddly, CPL3 code can still set NT using popf.
>>
>
> [...]
>
>> +
>> + /*
>> + * Sysenter doesn't filter flags, so we need to clear NT
>> + * ourselves. To save a few cycles, we can check whether
>> + * NT was set instead of doing an unconditional popfq.
>> + */
>> + testl $X86_EFLAGS_NT,EFLAGS(%rsp) /* saved EFLAGS match cpu */
>> + jnz sysenter_fix_flags
>> +sysenter_flags_fixed:
>> +
>
> Because this thread hasn't gone on long enough:
>
> Do we need to clear IOPL here, too? With patch 2 applied, an IOPL !=
> 0 program can leak IOPL into another task. It should be cleared on
> iret, sysexit (via popf) and sysret (directly), so this shouldn't
> matter. Am I missing something?
>
> Adding IOPL to the test will add no overhead for non-iopl-using tasks,
> but it will slighly slow down 32-bit tasks that use iopl.
>
I don't see why. IOPL has no effect in the kernel.
-hpa
--
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