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: <4B8C1320.6060602@redhat.com>
Date:	Mon, 01 Mar 2010 09:18:56 -1000
From:	Zachary Amsden <zamsden@...hat.com>
To:	Gleb Natapov <gleb@...hat.com>
CC:	linux-kernel@...r.kernel.org, mingo@...e.hu, avi@...hat.com,
	mtosatti@...hat.com
Subject: Re: use of setjmp/longjmp in x86 emulator.

On 03/01/2010 09:03 AM, Gleb Natapov wrote:
> On Mon, Mar 01, 2010 at 08:39:49AM -1000, Zachary Amsden wrote:
>    
>
>> Anything that can generate exceptions is going to need logic to
>> handle error cases anyway... the depth can not be that bad.
>> Especially if you structure it so as to optimize for tail calling.
>>
>>      
> Tail call is not what usually happens. Usually emulation goes like this:
>   if (check some conditions) {
> 	queue exception A
>          return exception queued
>   }
>   if (check other conditions) {
> 	queue exception B
>          return exception queued
>   }
>   do some emulation
>   try to read guest memory
>   if (read failed) {
>      queue exception C
>      return exception queued
>   }
>   if (read needs exit to userspace for device emulation)
>      return please go out and retrieve me the data
>
>   continue emulation
>   try to write guest memory
>   if (write failed) {
>      queue exception C
>      return exception queued
>   }
>   if (write needs exit to userspace for device emulation)
>      return please go out and process the data
>
>   emulate some more.
>
>   return emulation done
>    

It's going to be ugly to emulate segmentation, NX and write protect 
support without hardware to do this checking for you, but it's just what 
you have to do in this slow path - tedious, fully specified emulation.

Just because it's tedious doesn't mean we need to use setjmp / longjmp.  
Throw / catch might be effective, but it's still pretty bizarre to do 
tricks like that in C.

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