Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
x86-based VM: code/data sharing and security...
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
BGB / cr88192  
View profile   Translate to Translated (View Original)
 More options 16 Oct, 04:33
Newsgroups: alt.lang.asm, alt.os.development, comp.programming
From: "BGB / cr88192" <cr88...@hotmail.com>
Date: Thu, 15 Oct 2009 20:33:10 -0700
Local: Fri 16 Oct 2009 04:33
Subject: x86-based VM: code/data sharing and security...
so, for context (just making sure people have an idea here):
I am considering ideas for a long running project of mine (since 2007 or
so), and am interested in thoughts on, "yet another piece of the puzzle".

so, here is the general architecture:
I have a dynamic C compiler, which targets x86 and x86-64 (my current
targets are Win32, Win64, Linux on x86 and x86-64);
I have an interpreter for JBC (JavaByte Code);
I have a garbage collector, dynamic typesystem, and class/instance object
system (JVM-style);
I have an interpreter for x86 (partial x86-64 support).

I have several conventions in use:
a name mangling scheme which combines together parts of the IA64 name
mangling and the JVM / JNI signature system;
I have an exception handling scheme which works on x86 and x86-64, and which
combines together Win64 SEH (prologues+epilogues, structural unwinding) and
the JVM EH model (although general code support is fragmentary, so EH is
unlikely to work correctly at present);
dynamically generated code generally uses the native calling conventions
(cdecl, Win64, SysV, as appropriate).

in general, COFF is used internally as the main object format, and several
major components utilize PE/COFF as the binary format (for EXE's and DLL's).

now, getting more specific...

x86 interpreter:
primarily simulates userspace, makes no real attempt at emulating OS-level
features or HW (IOW: it is not intended to be an emulator, so no booting
Windows in this thing...);
currently, it implements "most" of the x86 ISA (nevermind poor performance,
likely bugs, and a few holes in the x87 and SSE support...).

its purpose then will be more to serve a role similar to that of a bytecode
interpreter (such as in the JVM or .NET, but using x86 machine code rather
than a bytecode such as JBC or MSIL).

the reason for x86 in my case, is largely that I already have LOTS of
facilities for x86, and was in need of VM, and came to the opinion that it
would take LOTS of effort to implement support for a bytecode (even though
the bytecode itself would be simpler).

the interpreter itself uses PE/COFF, and manages loading and linking PE
images.

now, I am getting to the part in question:
it is "probably" the case that code targetting the interpreter will
generally run in the interpreter, so I may relax "strict" compatibility with
native x86 some (and instead support a few facilities more typical of those
found in bytecoded VMs).

in particular, I am considering adding a feature very much unlike in native
x86:
the entire Virtual Address range 0xC0000000-0xFFFFFFFF will be reserved as a
big tagged value space (managed directly by the interpreter, rather than,
say, inaccessible and owned by the OS kernel...).

2.3.27: 11.Tag.Value

this space will then be used to "marshall" data between the inside and
outside worlds (essentially serving as a large handle space).

in the inside world, this space will not be directly accessible (as memory
at least...), but pointers into this region will be regarded as handles to
external objects or values (although, some types will be mapped directly).

these will generally be mapped to the external dynamic typesystem (includes
the class/instance system, and many other facilities), or to external
functions or methods.

attempts to resolve the address of an external function may in effect
resolve to one of these handles (mapping as necessary), so potentially code
may be linked directly against some of these handles.

when making a call to an imported function, it will then attempt to call to
one of these addresses, which will generate a special fault ('JumpFault', or
maybe a "special" GPF). this fault will be then trapped by the interpreter,
and the arguments marshalled, followed by the call being redirected as
appropriate, and when finished, the return value is marshalled and returned
to the caller (within the interpreter).

this mechanism would likely be done via special listings representing
"virtual" DLLs, which would basically provide FFI-related info. probably
these will be ASCII text files containing function signatures and security
info.

calls into the interpreter can similarly be handled via special thunks (and
probably similar V-DLL's), allowing an essentially bidirectional interface.

note: this will not likely impact coding style much, since many of my APIs
are based on opaque handles anyways, so neither the caller nor the callee
will notice that the object has been marshalled via a handle between
disjoint address spaces (however, this will not allow passing references to
raw memory objects, such as raw buffers or C-style arrays).

note that this mechanism would also be used by the interpreter to manage
gluing to the OO facilities (in place of the auto-generated thunks I am
using in many places in native-land...).

tag space:
0/1: flonum-28
2: fixnum
3: external object
4: external function
5/6: reserved
7: Tag2 (for smaller values)

Tag2:
2.3.7.20: 11.111.Tag2.Value
Tag2=127: special atomic values

(that, or, I forsake this kind of static tag scheme and use "linear space
ranges", similar to what I do using, errm, this same address range in native
32-bit x86).

security:
I am considering the idea that each virtual thread will have an associated
set of "privledges" (invisible from within the interpreter), and maybe
imported functions/objects will be associated to particular ACL's.

attempting to utilize an object or function for which access is not granted
via an ACL check will result in a #GP / GPF being thrown (or maybe a
security-related exception, either way...).

(BTW: if anyone knows of a decent BSD-liscensed C library, that would be
convinient, as so far I only know of Newlib, which is GPL...).

any thoughts?...


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jm l  
View profile   Translate to Translated (View Original)
 More options 16 Oct, 08:05
Newsgroups: alt.lang.asm, alt.os.development, comp.programming
From: jm l <oksidi...@gmail.com>
Date: Fri, 16 Oct 2009 00:05:05 -0700 (PDT)
Local: Fri 16 Oct 2009 08:05
Subject: Re: x86-based VM: code/data sharing and security...
On 16 oct, 05:33, "BGB / cr88192" <cr88...@hotmail.com> wrote:

> (BTW: if anyone knows of a decent BSD-liscensed C library, that would be
> convinient, as so far I only know of Newlib, which is GPL...).

I know a public domain C library : pdpclib
http://sourceforge.net/projects/pdos/files/

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rod Pemberton  
View profile   Translate to Translated (View Original)
 More options 16 Oct, 10:41
Newsgroups: alt.lang.asm, alt.os.development, comp.programming
From: "Rod Pemberton" <do_not_h...@nohavenot.cmm>
Date: Fri, 16 Oct 2009 05:41:00 -0400
Subject: Re: x86-based VM: code/data sharing and security...
"BGB / cr88192" <cr88...@hotmail.com> wrote in message
news:hb8phm$7lc$1@news.albasani.net...

> [...]

Um...  (No comment.)

> (BTW: if anyone knows of a decent BSD-liscensed C library, that would be
> convinient, as so far I only know of Newlib, which is GPL...).

Did you mean other than the BSD-licensed C library that comes with FreeBSD,
OpenBSD, or NetBSD?  I.e., BSD libc.

Rod Pemberton


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
BGB / cr88192  
View profile   Translate to Translated (View Original)
 More options 16 Oct, 16:03
Newsgroups: alt.lang.asm, alt.os.development, comp.programming
From: "BGB / cr88192" <cr88...@hotmail.com>
Date: Fri, 16 Oct 2009 08:03:57 -0700
Local: Fri 16 Oct 2009 16:03
Subject: Re: x86-based VM: code/data sharing and security...

"jm l" <oksidi...@gmail.com> wrote in message

news:02a71056-b702-486e-b7c6-6d70bf7add36@k17g2000yqb.googlegroups.com...

> On 16 oct, 05:33, "BGB / cr88192" <cr88...@hotmail.com> wrote:

>> (BTW: if anyone knows of a decent BSD-liscensed C library, that would be
>> convinient, as so far I only know of Newlib, which is GPL...).

> I know a public domain C library : pdpclib
> http://sourceforge.net/projects/pdos/files/

yep, looking into.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
BGB / cr88192  
View profile   Translate to Translated (View Original)
 More options 16 Oct, 17:15
Newsgroups: alt.lang.asm, alt.os.development, comp.programming
From: "BGB / cr88192" <cr88...@hotmail.com>
Date: Fri, 16 Oct 2009 09:15:00 -0700
Subject: Re: x86-based VM: code/data sharing and security...

"Rod Pemberton" <do_not_h...@nohavenot.cmm> wrote in message

news:hb9f2o$s7s$1@aioe.org...

> "BGB / cr88192" <cr88...@hotmail.com> wrote in message
> news:hb8phm$7lc$1@news.albasani.net...
>> [...]

> Um...  (No comment.)

I realized after writing all this that it was not terribly so novel as I had
thought, and there is little stopping one from doing similar with an actual
processor assuming they can trap the resulting GPF or similar...

>> (BTW: if anyone knows of a decent BSD-liscensed C library, that would be
>> convinient, as so far I only know of Newlib, which is GPL...).

> Did you mean other than the BSD-licensed C library that comes with
> FreeBSD,
> OpenBSD, or NetBSD?  I.e., BSD libc.

hmm...

I had not thought of this one...


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rod Pemberton  
View profile   Translate to Translated (View Original)
 More options 17 Oct, 08:37
Newsgroups: alt.lang.asm, alt.os.development, comp.programming
From: "Rod Pemberton" <do_not_h...@nohavenot.cmm>
Date: Sat, 17 Oct 2009 03:37:49 -0400
Local: Sat 17 Oct 2009 08:37
Subject: Re: x86-based VM: code/data sharing and security...
"BGB / cr88192" <cr88...@hotmail.com> wrote in message
news:hba665$g3t$1@news.albasani.net...

> >> (BTW: if anyone knows of a decent BSD-liscensed C library, that would
be
> >> convinient, as so far I only know of Newlib, which is GPL...).

> > Did you mean other than the BSD-licensed C library that comes with
> > FreeBSD,
> > OpenBSD, or NetBSD?  I.e., BSD libc.

> hmm...

> I had not thought of this one...

IIRC, MOSS uses a modified BSD C library:
http://www.cs.utah.edu/flux/oskit/

The Flux OSKit converted FreeBSD into a library, including the FreeBSD C
library:
http://www.cs.utah.edu/flux/moss/moss.html

Rod Pemberton


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
BGB / cr88192  
View profile   Translate to Translated (View Original)
 More options 17 Oct, 09:18
Newsgroups: alt.lang.asm, alt.os.development, comp.programming
From: "BGB / cr88192" <cr88...@hotmail.com>
Date: Sat, 17 Oct 2009 01:18:44 -0700
Local: Sat 17 Oct 2009 09:18
Subject: Re: x86-based VM: code/data sharing and security...

"Rod Pemberton" <do_not_h...@nohavenot.cmm> wrote in message

news:hbbs7o$n0a$1@aioe.org...

yep.

I am currently looking into the PDOS C library (PDPCLIB), which if it has
one good point, it is that it is small enough to be fairly easy (in general)
to figure out and to modify (and was impressively easy to get to be able to
build and work).

however, I have been considering some need for basic POSIX functionality,
which I had assumed add myself (mostly, because this code would be operating
"across the barrier").

but, it is all a start at least...


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google