ArvernOS icon indicating copy to clipboard operation
ArvernOS copied to clipboard

kernel: add linux compatibility layer

Open willdurand opened this issue 3 years ago • 5 comments

~~It does not quite work yet, although binaries built for ArvernOS run on Linux... "Just" need to make the opposite to happen now.~~

It totally works ~~on x86_64 (because other archs don't have support for loading executing ELFs)~~, although there are hacks everywhere! There are also many limitations, e.g., Linux binaries should be:

  • executable and not shared objects (-fno-pie)
  • compiled statically and with musl because glibc does weird stuff before calling a main() function...

Other limitations are related to ArvernOS itself:

  • no good multi-tasking (so no fork/clone)
  • no heap memory for user processes but I managed to fake that
  • no dedicated virtual memory for user processes so we can only execute a (user) binary once as long as it does not want to be loaded in memory areas already used by the kernel
  • no good sleep implementation

Screenshots

Screen Shot 2022-02-14 at 13 50 54 Screen Shot 2022-02-13 at 17 12 31

willdurand avatar Feb 10 '22 21:02 willdurand

(rebased)

It isn't working anymore since the x86_64 "process" code has been removed in the main branch.

willdurand avatar Mar 03 '22 08:03 willdurand

I updated this POC to run unmodified binaries in kernel mode.

willdurand avatar Apr 02 '22 13:04 willdurand

Screen Shot 2022-04-03 at 14 26 01

willdurand avatar Apr 03 '22 12:04 willdurand

The same program compiled for Linux on two different (64bit) architectures and running on ArvernOS:

Screen Shot 2022-04-04 at 21 17 21 Screen Shot 2022-04-04 at 21 13 23

willdurand avatar Apr 04 '22 19:04 willdurand

(BusyBox) uname -a:

Screen Shot 2022-04-04 at 21 50 03

willdurand avatar Apr 04 '22 19:04 willdurand