Statix allocation at load time + no MMU, no protection ring.

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
sandras
Member
Member
Posts: 146
Joined: Thu Nov 03, 2011 9:30 am

Statix allocation at load time + no MMU, no protection ring.

Post by sandras »

So I had this idea yesterday night. I was thinking about not having any kind of dynamic allocation system for yser space and combining that with some sort of bound checking the executables and not requiring an MMU. Basically, load executable (native machine code), relocate it to where you have space available, check if it does not touch memory outside of the little chunk allocated to it and go for it - run the program. The Idea is that you simplify bound checking because of static allocation. you gain speed because of single address space, and you don't lose process isolation. Is it feasible to check whether a machine code executable will not touch memory not of it's own? I though it is, but when I started thinking, it seemed quite complicated. Are there any tricks I may not know about, that simplify the process?
evoex
Member
Member
Posts: 103
Joined: Tue Dec 13, 2011 4:11 pm

Re: Statix allocation at load time + no MMU, no protection r

Post by evoex »

Sandras wrote:Is it feasible to check whether a machine code executable will not touch memory not of it's own?
There's one way to do it, namely single-stepping the entire application and for any memory access make sure the pointer is valid. However, such a solution would be extremely slow. Besides, you could only have a few applications running, until you use up all the memory.

Trust me, don't even go there.
OSwhatever
Member
Member
Posts: 595
Joined: Mon Jul 05, 2010 4:15 pm

Re: Statix allocation at load time + no MMU, no protection r

Post by OSwhatever »

Pre-checking an executable that it behaves nicely is very difficult and I'm not sure you could get 100% coverage with native code. After that the system stability is up to the software/library to be stable enough so that no bugs slips through that can harm the system. HW support could be added, then the CPU could work with identifiers rather than pointers, HW bounds checking could be in place. Then the kernel must assign memory associated with these bounds structures that the CPU can load and use. The question is if HW bounds checking on object level would be faster than an MMU?

One address space works well in system where the SW is known and a crash doesn't mean the end of the world, examples are embedded systems like TV-setup boxes and such. Let's say you are a server administrator, if a program crash that means the whole system goes down and the company server downtime can cost millions, in this case you probably want to leave the MMU on even if does mean that the server is a little bit slower.
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Re: Statix allocation at load time + no MMU, no protection r

Post by AndrewAPrice »

This is why I'm using a bytecode approach. I ensure addresses to functions, class layouts, types, array bounds, etc are all correct at load time.
My OS is Perception.
OSwhatever
Member
Member
Posts: 595
Joined: Mon Jul 05, 2010 4:15 pm

Re: Statix allocation at load time + no MMU, no protection r

Post by OSwhatever »

MessiahAndrw wrote:This is why I'm using a bytecode approach. I ensure addresses to functions, class layouts, types, array bounds, etc are all correct at load time.
Is there some way it is possible that bugs can sneak in, for example bugs in the bytecode implementation or in the library?

Microsoft in the Singularity experimental OS, implemented pre-verification at load time in order to check if the program is safe. Why did they do this when bytecode is supposed to be safe to begin with?
Nable
Member
Member
Posts: 453
Joined: Tue Nov 08, 2011 11:35 am

Re: Statix allocation at load time + no MMU, no protection r

Post by Nable »

> pre-verification at load time in order to check if the program is safe
> check if the program is safe
http://en.wikipedia.org/wiki/Halting_problem
jnc100
Member
Member
Posts: 775
Joined: Mon Apr 09, 2007 12:10 pm
Location: London, UK
Contact:

Re: Statix allocation at load time + no MMU, no protection r

Post by jnc100 »

CIL (as defined by Microsoft) is not inherently type safe, only a certain subset is, and the subset which is verifiable is in itself a subset of that which is type safe. Therefore, the checks by Singularity are to ensure that the code is verifiable (and thus type safe) prior to being run. For example, you can generate non-type safe code with c# using the 'unsafe' keyword to allow direct access to certain memory areas, e.g.

Code: Select all

unsafe {
    byte * vmem = (byte *)0xb8000;
    *vmem = (byte)'H';
}
compiles to valid CIL, but you wouldn't want any process to be able to include it. The rules for verifiability are defined in ECMA-335.

Regards,
John.
ACcurrent
Member
Member
Posts: 125
Joined: Thu Aug 11, 2011 12:04 am
Location: Watching You

Re: Statix allocation at load time + no MMU, no protection r

Post by ACcurrent »

Google's native client does the same thing (except its not an OS), however it use llvm-IR for PNaCl and its own specialized compiler. On x86 it uses segments. It works well for chrome because Javascript would be slower in any case. However it has its performance limitations.
Get back to work!
Github
Post Reply