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: <20081225175821.GA23390@elte.hu>
Date:	Thu, 25 Dec 2008 18:58:21 +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:
>> * Ingo Molnar <mingo@...e.hu> wrote:
>>
>>   
>>> i'd suggest to reuse the irq-stacks for this. Right now on 64-bit 
>>> we've got the following stack layout: 8K process stacks, a 16K IRQ 
>>> stack on each CPU, shared by all IRQs. Then we have the IST stacks 
>>> with weird sizes: debug:8K, the others: 4K.
>>>     
>>
>> this has to be done carefully though, as there's a subtle detail here:  
>> right now the pda_irqcount and the pda_irqstackptr logic in entry_64.S 
>> is not re-entry safe and relies on IRQs being off.
>>
>> If critical exceptions are moved to the IRQ stack then %rsp switching 
>> to the IRQ stack has to be done atomically: instead of using the 
>> pda_irqcount check the %rsp value itself should be checked against 
>> pda_irqstackptr - if it's within that 16K range then we are already on 
>> the IRQ stack and do not need to switch to it but can just use the 
>> current %rsp.
>>   
>
> 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.

So if we want to move them to IRQ stacks all the time, we have to check 
that condition atomically - the safest way of which is to check RSP 
against the (static) pda:[irqstackptr-16K+64..irqstackptr] range.

	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