l3nkz / mvastest

Test suite for Linux' First Class Virtual Address Spaces
Other
0 stars 1 forks source link

Questions about how VAS is used #1

Open HappyBearZzz opened 5 years ago

HappyBearZzz commented 5 years ago

Hello, I recompiled the kernel “mvas-cp” on Ubuntu, then installed the libmvas library and tested it with the mvastest library and the results were correct.

Then, I would like to further understand the use of VAS, such as the implementation of processes’ switching between different VAS, I would like to know how to apply space in the current VAS to store variables. I wonder if the function “malloc” can do it. But when I used malloc and switched the VAS, the variables in the previous VAS could still be accessed, I was confused.

The test code and results have been added to the attachment. testMVAS_code.txt testMVAS_result.txt

I am looking forward to your reply! Thank you very much!

l3nkz commented 5 years ago

Hi, with the current implementation of mvas in the kernel, all normal address space regions (those that are not marked as VAS_PRIVATE) will be synchronized between the VAS of one application. This means, if you use pure malloc, this will always be synchronized and available in all VASes of the application.

To create non-synchronized VAS (private ones) you need to write your own allocator that will create a new address space region (using mmap) and set for it the VAS_PRIVATE flag.

HappyBearZzz commented 5 years ago

Thank you very much for your reply. I will try to do it as you said.

HappyBearZzz commented 5 years ago

Hello, I searched the source code of mvas-cp project and found no constant named VAS_PRIVATE. I wonder if I picked the wrong kernel to use, or if the constants here refer to MAP_PRIVATE?

My main concern is whether I can achieve in-process isolation by switching processes between different VAS. I wonder if this is feasible.

Thank you very much!

HappyBearZzz commented 5 years ago

I realized that the way I used VAS and segment before was wrong. Segment is a unit of data isolation and protection, so I should use the memory space in the segment to store and obtain data.

The following is my modified usage method. I wonder whether it is correct or not. Or is there any other way to use it? testlibmvas_for_use_of_segment_code.txt testlibmvas_for_use_of_segment_result.txt

Thank you very much!