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: <20081225181810.GA1548@elte.hu>
Date:	Thu, 25 Dec 2008 19:18:10 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Avi Kivity <avi@...hat.com>
Cc:	"H. Peter Anvin" <hpa@...or.com>,
	Joerg Roedel <joerg.roedel@....com>,
	Benjamin Serebrin <benjamin.serebrin@....com>,
	linux-kernel <linux-kernel@...r.kernel.org>, kvm@...r.kernel.org,
	Alexander Graf <agraf@...e.de>,
	Arjan van de Ven <arjan@...radead.org>,
	Alexander van Heukelum <heukelum@...tmail.fm>
Subject: Re: kvm vmload/vmsave vs tss.ist


* Avi Kivity <avi@...hat.com> wrote:

> Ingo Molnar wrote:
>>> I think it's enough to switch %rsp before incrementing irqcount, no?
>>>     
>>
>> no - that would introduce a small race: if an exception (say an NMI or  
>> MCE, or a debug trap) happens in that small window then the exception  
>> context thinks that it's on the IRQ stack already, and would use the 
>> task stack.
>>
>>   
>
> I'm suggesting
>
>    check irqcount
>    if (wasnt_in_irq)
>        rsp = irqstack
>    ++irqcount
>
> If the NMI happens before the increment, we'll switch the stack 
> unconditionally, and if the NMI happens after the increment, then we 
> won't switch the stack, but we're guaranteed to be on the irqstack 
> anyway.  The window size is negative :)
>
> Similarly, the exit path should be
>
>    oldstack_reg = oldstack;
>    --irqcount;
>    rsp = oldstack_register;
>
> To guarantee that by the time we decrement irqcount, we don't need the  
> stack anymore.

agreed, something like this would work too. My suggestion, to eliminate 
irqcount altogether and just check RSP against the known-irqstack-range, 
could result in slightly smaller (and thus faster) code, but it's a 
marginal difference at best.

	Ingo
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ