Code Monkey home page Code Monkey logo

kerla's Introduction

Kerla

CI Discord Chat

screenshot

Kerla is a monolithic operating system kernel written from scratch in Rust which aims to be compatible with the Linux ABI, that is, it runs Linux binaries without any modifications.

  • Implements *NIX process concepts: context switching, signals, fork(2), execve(2), wait4(2), etc.
  • Supports commonly used system calls like write(2), stat(2), mmap(2), pipe(2), poll(2), ...
  • No disk support for now: initramfs is mounted as the root file system.
  • Pseudo file systems: tmpfs and devfs.
  • smoltcp-based TCP/IP support.
  • Implements tty and pseudo terminal (pty).
  • Supports QEMU and Firecracker (with virtio-net device driver).
  • Supports x86_64.
  • Docker-based initramfs build system.

Check out my blog post for motivation and my thoughts on writing an OS kernel in Rust.

Demo: SSH into Kerla!

You can play with Kerla over ssh. Your login is not visible from others (except me): we automatically launch a dedicated microVM on Firecracker for each TCP connection.

If you found bugs or missing features, let me know on GitHub issues :)

Running a Docker Image (experimental)

You can run a Docker image as a root file system (not as a container!) on Kerla Kernel instead of our initramfs built from initramfs directory.

For example, to run nuta/helloworld image (Dockerfile), try the following command:

$ make IMAGE=nuta/helloworld run
...
[   0.029] syscall: execve(439398, 4393b8, 4393c8, 8, 2f2f2f2f2f2f2f2f, 8080808080808080)
[   0.030] syscall: arch_prctl(1002, 4055d8, 0, 20000, 0, ff)
[   0.031] syscall: set_tid_address(4057f0, 4055d8, 0, 20000, 0, ff)
[   0.033] syscall: ioctl(1, 5413, 9ffffeed0, 1, 405040, 9ffffeef7)

 _          _ _                            _     _ _
| |__   ___| | | ___   __      _____  _ __| | __| | |
| '_ \ / _ \ | |/ _ \  \ \ /\ / / _ \| '__| |/ _` | |
| | | |  __/ | | (_) |  \ V  V / (_) | |  | | (_| |_|
|_| |_|\___|_|_|\___/    \_/\_/ \___/|_|  |_|\__,_(_)

This feature is in a very early stage and I guess almost all images out there won't work because:

  • They tend to be too large to be embedded into the kernel image.
  • They might use unimplemented features (e.g. position-independent executables used in Alpine Linux).

Building and Running the OS

See Quickstart for instructions on building from source, running on emulators, etc.

Current Roadmap

Roadmap - Run a Node.js Web Application on Kerla on Firecracker on AWS

Compatibility

See here for the current status.

Contributing

Send me bug reports, feature requests, and patches on GitHub for example:

  • Implementing missing features: majority of existing Linux applications won't work due to the lack of features.
  • Writing documentation: I think Kerla could be good material to learn how an operating system kernel works.
  • Trying to experiment with Rust-y ideas: for example currently I'm interested in GhostCell.

License

See LICENSE.md.

Related Work

Emulating Linux ABI is not a novel work. Some UNIX-like kernels like FreeBSD and NetBSD already have their own Linux emulation layers. Windows has a well-known feature called Windows Subsystem for Linux (WSL) which enables running Linux binaries seamlessly. WSL 1 implements the feature by ABI emulation. WSL 2 runs the real Linux kernel using the hardware-accelerated virtualization (Hyper-V).

Aside from general-purpose operating systems, there're some attractive projects related to the Linux ABI emualtion. OSv is a unikernel which runs unmodified Linux binaries. rCore is a teaching operating system which implements the Linux ABI in Rust. Noah suggests an intriguing approach to run unmodified Linux binaries on macOS.

kerla's People

Contributors

bayedieng avatar castarco avatar daasin avatar dependabot[bot] avatar h4sh5 avatar michalfita avatar nuta avatar pro465 avatar shlomif avatar temoto avatar vocalfan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kerla's Issues

ls hang

it hang when ls -al /bin

BusyBox v1.31.1 (2021-05-28 14:16:49 UTC) built-in shell (ash)

# ls /bin
grep         nslookup     dropbear     busybox      mkdir        hello
dropbearkey  env          sleep        httpd        cp           uname
touch        curl         wget         tail         ln
ls           mv           clear        rm           head
echo         rmdir        sh           dmesg        cat
# ls -al /bin
Connection to kerla-demo.seiya.me closed by remote host.
Connection to kerla-demo.seiya.me closed.

Kerla ssh requires password "kerla"

I'm on macOS Big Sur 11.6 and am using macOS's builtin SSH tool to access the Kerla demo. I've added it permanently to a list of known hosts but have to enter the password "kerla" to login.

Suggestion:

Add the password to the README file.

Image:

Screen Shot 2021-10-26 at 8 01 38 PM

Eliminate implicit out-of-memory panics

Currently. Kerla extensively uses containers provided by liballoc. The problem is they can panic on memory allocation failures. Use failable methods (i.e. returning Result<T>) to improve the robustness.

Alternatives to liballoc

  • Scapegoat - Ordered set and map data structures

futex system call

A key feature of Linux kernel - futex is not yet implemented.

For a start, two operations can be implemented:

  • FUTEX_WAIT - Test if the value at the futex contains the expected value. If so, sleep.
  • FUTEX_WAKE - Wake up a number of waiters waiting on the futex word.

A futex consists of a kernelspace wait queue that is attached to an atomic integer in userspace. I found something similar here which is used for implementing spinlock: wait_queue.rs

References:

@nuta I hope I am going in the right direction. I seek your valuable inputs to get started with the implementation.

`make test` fails with non-informative error message

Context:

OS: Ubuntu 21.10 64bits

Problem

After upgrading my operating system, from Ubuntu 20.04 to Ubuntu 21.10 (and reinstalling some tools, like Docker, or qemu-*), and after building Kerla with the make command... I cannot test it via make test, instead, I have this error:

Screenshot from 2021-11-09 15-36-20

Any idea if there's any way to deal with this? I'm not sure it's really a bug, but so far it seems like it.

VGA text mode console

Currently, Kerla doesn't print anything on the screen and it's confusing when you run it on QEMU (I suppose only few people know how to open the serial console).

Introducing version numbers

I've started to introduce minor changes into the documentation ( #14 ), and then I realized that just having a column specifying the status (Implemented / Unimplemented) isn't really enough.

Having a column specifying the version when these syscalls were introduced (or main if it's implemented but not yet released) could be really helpful for some users.

What do you say about making an "emergency release" so we can document what's available at the time being?

panic when make run

hello,everyone:
panic when make run. stack is:
[ 0.000] running init script: "/bin/sh"
[ 0.000] WARN: invalid ELF e_machine[ 0.000] panicked at 'failed to execute the init script: : ENOEXEC: This error originates from:
#1: ffff800000150d79 kerla::printk::capture_backtrace()+0x79
#2: ffff800000137633 kerla::result::Error::new()+0x23
#3: ffff800000137c07 <kerla::result::Error as c...la::result::Errno>>::from()+0x17
#4: ffff800000104247 <T as core::convert::Into>::into()+0x17
#5: ffff8000001a7b32 kerla::process::elf::Elf::parse()+0x782
#6: ffff8000001bca7c kerla::process::process::do_setup_userspace()+0x49c
#7: ffff8000001bc5c9 kerla::process::process::setup_userspace()+0x39
#8: ffff8000001b9bed kerla::process::process::Process::new_init_process()+0x4ed
', kernel/boot.rs:154:14
[ 0.000] 0: ffff800000150cfa kerla::printk::backtrace()+0x1a
[ 0.000] 1: ffff8000001185fa rust_begin_unwind()+0xea
[ 0.000] 2: ffff8000002966fa core::panicking::panic_fmt()+0x3a
[ 0.000] 3: ffff8000002a2366 core::result::unwrap_failed()+0xe6
[ 0.000] 4: ffff80000013da98 core::result::Result<T,E>::expect()+0x78
[ 0.000] 5: ffff80000018e05f kerla::boot::boot_kernel()+0x91f
[ 0.000] 6: ffff80000010a8a4 bsp_early_init()+0x94
[ 0.000] 7: ffff8000001001f4 halt()+0x0

branch: master 8f2fce6
os: big sur 11.6
cpu: apple m1
Has anyone have same problem?

The `parent` of `Process` type `Option<Weak<...>>` is redundant

In the process.rs:

pub struct Process {
    // ...
    pub(super) parent: Option<Weak<SpinLock<Process>>>,
    // ...
}

for unnecessary level of indirection as Weak can be empty and then .upgrade() would return None. I've made the change and it works fine, so PR coming.

Running simple "hello world" JS script on NodeJS (tracking "epic")

I've run the following command in my Linux machine (to see which syscalls are being sent to the kernel for a very basic NodeJS program):

strace echo "console.log('hello')" | node

and I've got the following list (taking aside the ones already implemented):

  • access
  • openat
  • pread64
  • mprotect

some of this calls could be related to Bash and not NodeJS, but if instead I run this:

strace node example.js # with the same JS script as before

we obtain this list (confirming that they are needed for NodeJS too):

  • access
  • openat
  • pread64
  • mprotect
  • munmap
  • set_robutst_list
  • rt_sigprocmask
  • prlimit64
  • pipe2
  • eventfd2
  • clone
  • madvise
  • futex: #2
  • epoll_ctl: #19
  • epoll_wait: #19
  • exit_group

I hope this can be useful to guide the next steps for this roadmap ( https://github.com/nuta/kerla/projects/1 ).

Switch IRQ handler's map from BTreeMap to array

Grepped through the code, I found nice TODO:

use alloc::collections::BTreeMap;
// TODO: Use a simple array for faster access.
static IRQ_HANDLERS: SpinLock<BTreeMap<u8, Box<dyn FnMut() + Send + Sync>>> =

We want to have

[Option::<Box<dyn FnMut() + Send + Sync>>::None; 255] 

instead of

BTreeMap<u8, Box<dyn FnMut() + Send + Sync>>

as an IRQ handler's map.

If I get it right, I will make a pull request.

Unable to run on OSX: failed to execute /sbin/init: ENOEXEC

I followed the steps outlined in HACKING.md on my M1 Macbook, and I'm getting the following error when trying make run GUI=1

I'm copying my entire qemu output, as I also get a ton of these TCG warnings:

qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.fma [bit 12]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.pcid [bit 17]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.x2apic [bit 21]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.tsc-deadline [bit 24]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.avx [bit 28]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.f16c [bit 29]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.hle [bit 4]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.avx2 [bit 5]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.invpcid [bit 10]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.rtm [bit 11]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.avx512f [bit 16]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.avx512dq [bit 17]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.rdseed [bit 18]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.avx512cd [bit 28]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.avx512bw [bit 30]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EBX.avx512vl [bit 31]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:ECX.avx512vbmi [bit 1]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:ECX.umip [bit 2]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:ECX.avx512vbmi2 [bit 6]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:ECX.gfni [bit 8]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:ECX.vaes [bit 9]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:ECX.vpclmulqdq [bit 10]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:ECX.avx512vnni [bit 11]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:ECX.avx512bitalg [bit 12]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:ECX.avx512-vpopcntdq [bit 14]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EDX.spec-ctrl [bit 26]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.07H:EDX.ssbd [bit 31]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.80000001H:ECX.3dnowprefetch [bit 8]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.80000008H:EBX.wbnoinvd [bit 9]
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.0DH:EAX.xsavec [bit 1]

[   0.000]  available RAM: 0000000000000000-000000000009fc00 639KiB
[   0.000]       reserved: 000000000009fc00-00000000000a0000 1KiB
[   0.000]       reserved: 00000000000f0000-0000000000100000 64KiB
[   0.000]  available RAM: 0000000000100000-000000001ffe0000 510MiB
[   0.000]       reserved: 000000001ffe0000-0000000020000000 128KiB
[   0.000]       reserved: 00000000fffc0000-0000000100000000 256KiB
[   0.000] cmdline: (empty)
[   0.000] enabling PIT (i8254) timer: divisor=1193
[   0.000] Booting Kerla...
[   0.000] available RAM: base=63f000, size=505MiB
[   0.000] initramfs: "/bin" (0B)
[   0.000] initramfs: "/sbin" (0B)
[   0.000] initramfs: "/etc" (0B)
[   0.000] initramfs: "/dev" (0B)
[   0.000] initramfs: "/tmp" (0B)
[   0.000] initramfs: "/bin/cat" (12B)
[   0.000] initramfs: "/bin/wget" (12B)
[   0.000] initramfs: "/bin/nslookup" (12B)
[   0.000] initramfs: "/bin/echo" (12B)
[   0.000] initramfs: "/bin/touch" (12B)
[   0.000] initramfs: "/bin/sleep" (12B)
[   0.000] initramfs: "/bin/uname" (12B)
[   0.000] initramfs: "/bin/tail" (12B)
[   0.000] initramfs: "/bin/grep" (12B)
[   0.000] initramfs: "/bin/env" (12B)
[   0.000] initramfs: "/bin/head" (12B)
[   0.000] initramfs: "/bin/clear" (12B)
[   0.000] initramfs: "/bin/sh" (12B)
[   0.000] initramfs: "/bin/busybox" (937KiB)
[   0.000] initramfs: "/bin/dropbear" (369KiB)
[   0.000] initramfs: "/bin/curl" (552KiB)
[   0.000] initramfs: "/bin/httpd" (12B)
[   0.000] initramfs: "/bin/dmesg" (12B)
[   0.000] initramfs: "/bin/mkdir" (12B)
[   0.000] initramfs: "/bin/dropbearkey" (245KiB)
[   0.000] initramfs: "/bin/rmdir" (12B)
[   0.000] initramfs: "/bin/mv" (12B)
[   0.000] initramfs: "/bin/hello" (614KiB)
[   0.000] initramfs: "/bin/ln" (12B)
[   0.000] initramfs: "/bin/ls" (12B)
[   0.000] initramfs: "/bin/cp" (12B)
[   0.000] initramfs: "/bin/rm" (12B)
[   0.000] initramfs: "/sbin/init" (130B)
[   0.000] initramfs: "/etc/group" (10B)
[   0.000] initramfs: "/etc/init.d" (0B)
[   0.000] initramfs: "/etc/profile" (235B)
[   0.000] initramfs: "/etc/resolv.conf" (19B)
[   0.000] initramfs: "/etc/inittab" (45B)
[   0.000] initramfs: "/etc/banner" (228B)
[   0.000] initramfs: "/etc/passwd" (26B)
[   0.000] initramfs: "/etc/init.d/rcS" (130B)
[   0.000] initramfs: "/dev/.keep" (0B)
[   0.000] initramfs: "/tmp/.keep" (0B)
[   0.000] initramfs: loaded 43 files and directories (2MiB)
[   0.000] pci: found a device: id=8086:1237, bar0=MemoryMapped { paddr: PAddr(0000000000000000) }, irq=0
[   0.000] virtio-net: found the device (over PCI)
[   0.000] pci: found a device: id=1234:1111, bar0=MemoryMapped { paddr: PAddr(00000000fd000000) }, irq=0
[   0.000] virtio-net: found the device (over PCI)
[   0.000] pci: found a device: id=1af4:1041, bar0=MemoryMapped { paddr: PAddr(0000000000000000) }, irq=11
[   0.000] virtio-net: found the device (over PCI)
[   0.000] virtio-net: MAC address is 52:54:00:12:34:56
[   0.000] virtio-net: transmitting 299 octets (tx_ring=0, paddr=0000000000747000)
[   0.000] running /sbin/init
[   0.000] WARN: invalid ELF e_machine[   0.000] panicked at 'failed to execute /sbin/init: ENOEXEC', kernel/boot.rs:142:10

Any help would be appreciated πŸ™‡β€β™‚οΈ

Panic on irq_handler overwrite

Right now, after we switch to MaybeUninit, we lose panic on irq_handler overwrite. But now it is even more important than before because MaybeUninit::write will not drop the previous value so that Box will live forever. Or, if I overthink, and this is not the real problem, this should be documented as a feature :)

I will be happy to provide a PR.

Suggestion: Kerla Chatroom

Github is nice and all for posting issues, but perhaps this project would benefit from a community chatroom somewhere?

I know I'd like to dive in and hack at a system call or two, but the real-time collaboration a chatroom could provide would help immensely.

I'd prefer a Discord server myself, but I'm amicable to anything really. Whatever it is, I think it's something @nuta should start to avoid any conflicts of interest :-)

ls -la in /bin freezes kerla

On the SSH connection:

# cd /bin
# ls
grep         nslookup     dropbear     busybox      mkdir        hello
dropbearkey  env          sleep        httpd        cp           uname
touch        curl         wget         tail         ln
ls           mv           clear        rm           head
echo         rmdir        sh           dmesg        cat
# ls -la
[ .... minutes later ... ]
Timeout, server kerla-demo.seiya.me not responding.

Great work! :)

Unrelated question (but this bug report can probably be closed anyway):

Can this also be developed on a Mac or do you need a VM or docker or such?

Amendment to licensing contract ( Refer to Issue #5 and PR #100 for more info )

I was looking over the discussions on the licensing and tried to address them as best I could with an amended file and added clarity but wanted to run it by here first and get some thoughts before I open any kind of pull request πŸ™‚

One example being where someone said that MIT doesn't deal with patents even though in precedent for multiple jurisdictions (inc European) it may be implied by the contract itself. #5
@nuta

Amendments Presented:
image
image

Start implementation of `clone` syscall

This is big task to cover all flags this syscall supports, so this is not going to end up with one issue, especially as some testing in the process would be required.

This call is used by pthread_create() in system libraries (I've checked musl source code so far), so it's crucial to support user space threading.

I would assign myself to this task, but I don't have such powers. Could we have project or milestone for multithreading?

`RootFs` need to be cloneable, so the whole state can be copies instead of inherit a reference on `fork()`/`clone()`

At the moment Process::fork() seem to clone the Arc<RootFs> instead of content of the RootFs itself, what leads to shared RootFs between processes, not independent file system states.

Found during work on #88 and belongs to Multithreading milestone (I can't add myself).

More details in the flags mask of clone(2), scroll down to CLONE_FS. I haven't checked yet how it's implemented in Linux Kernel.

External disk support

Currently, Kerla uses initramfs embedded into the kernel as its root file system.

The major disadvantage is that the all file contents will be loaded into the memory. That is, if you want to run a 100MiB Docker image, 100MiB needs to be reserved for initramfs!

This issue is aims to allow running large Docker images by:

  • Implement virtio-blk (or virtio-scsi) block device.
  • Implement a file system (e.g. ext4).

Fine-grained locks in Process

Currently, a process control block is wrapped with SpinLock. It's not convenient because even if you just want to get its PID, you need to acquire the lock (proc.lock().pid())!

This issue aims to turn Arc<SpinLock<Process>> into Arc<Process>.

Maybe change the license is good choice (such as GPLv3)

The big problem of MIT license is that the companies love take the project and close it or not colaborate in the main or parent project. Because MIT license has not the "Freedom 3: The freedom to improve the program, and release your improvements (and modified versions in general) to the public, so that the whole community benefits." .

There are a lot of links about this:

IMHO: GPLv3 is better.

exec `make` have a rpc receive error

It looks like I have encountered the limitation of grpc transfer file size, But I can't find where I can set this value.

     BUILD  testing
[+] Building 3.6s (17/42)
 => [internal] load build definition from Dockerfile                                                               0.0s
 => => transferring dockerfile: 32B                                                                                0.0s
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 2B                                                                                    0.0s
 => [internal] load metadata for docker.io/library/ubuntu:20.04                                                    0.0s
 => [internal] load build context                                                                                  0.0s
 => => transferring context: 536B                                                                                  0.0s
 => [curl 1/8] FROM docker.io/library/ubuntu:20.04                                                                 0.0s
 => CACHED [curl 2/8] RUN apt-get update && apt-get install -qy build-essential curl sed                           0.0s
 => CACHED [curl 3/8] RUN apt-get install -qy musl-tools                                                           0.0s
 => CACHED [dropbear 4/11] RUN curl -fsSL --output tarball.tar.bz2 "https://matt.ucc.asn.au/dropbear/releases/dro  0.0s
 => CACHED [dropbear 5/11] RUN mkdir /build && tar xf tarball.tar.bz2 --strip-components=1 -C /build               0.0s
 => CACHED [dropbear 6/11] ADD dropbear/accept-empty-password-root-login.patch /build/accept-empty-password-root-  0.0s
 => CACHED [dropbear 7/11] ADD dropbear/localoptions.h /build/localoptions.h                                       0.0s
 => CACHED [dropbear 8/11] WORKDIR /build                                                                          0.0s
 => CACHED [dropbear 9/11] RUN sh -c 'patch --ignore-whitespace -p1 < accept-empty-password-root-login.patch'      0.0s
 => [dropbear 10/11] RUN ./configure CC=musl-gcc --enable-static --disable-largefile --disable-zlib --disable-sys  3.5s
 => => # checking for endutent... yes
 => => # checking for getutent... yes
 => => # checking for getutid... yes
 => => # checking for getutline... yes
 => => # checking for pututline... yes
 => => # checking for setutent... yes
 => CACHED [busybox 4/8] RUN curl -fsSL --output tarball.tar.bz2 "https://busybox.net/downloads/busybox-1.31.1.ta  0.0s
 => CACHED [busybox 5/8] RUN mkdir /build && tar xf tarball.tar.bz2 --strip-components=1 -C /build                 0.0s
 => CACHED [busybox 6/8] WORKDIR /build                                                                            0.0s
 => CACHED [busybox 7/8] ADD busybox/config /build/.config                                                         0.0s
 => [busybox 8/8] RUN yes n | make oldconfig     && ln -s /usr/bin/ar /usr/bin/musl-ar     && ln -s /usr/bin/stri  3.5s
 => => # ) [6] (NEW) Minimum password length (PASSWORD_MINLEN) [6] (NEW) Minimum password length (PASSWORD_MINLEN) [6]
 => => # (NEW) Minimum password length (PASSWORD_MINLEN) [6] (NEW) Minimum password length (PASSWORD_MINLEN) [6] (NEW)
 => => # Minimum password length (PASSWORD_MINLEN) [6] (NEW) Minimum password length (PASSWORD_MINLEN) [6] (NEW) Minimu
 => => # m password length (PASSWORD_MINLEN) [6] (NEW) Minimum password length (PASSWORD_MINLEN) [6] (NEW) Minimum pass
 => => # word length (PASSWORD_MINLEN) [6] (NEW) Minimum password length (PASSWORD_MINLEN) [6] (NEW) Minimum password l
 => => # ength (PASSWORD_MINLEN) [6] (NEW) Minimum password length (PASSWORD_MINLEN) [6] (NEW)
failed to receive status: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (5417870 vs. 4194304)
make[2]: *** [Makefile:193: build/kerla.initramfs] Error 1
make[1]: *** [Makefile:92: build-crate] Error 2
make: *** [Makefile:78: build] Error 2

Suggestion: Logo

As the title says. I think it would be fitting for Kerla to have a (most likely makeshift/temporary) logo. I'll submit a PR when I've come up with something (in the little time I have left today).

`foo=$(echo bar)` freezes the shell

BusyBox v1.31.1 (2021-11-04 11:38:59 UTC) built-in shell (ash)

[   0.038] [1:/bin/sh] syscall: open(44af99, 2, 0, 0, 0, 0)
[   0.038] [1:/bin/sh] open("/dev/tty")
[   0.040] [1:/bin/sh] syscall: fcntl(3, 406, a, a, 48, 0)
[   0.041] [1:/bin/sh] syscall: fcntl(a, 2, 1, a, 48, 0)
[   0.041] [1:/bin/sh] syscall: close(3, 0, 0, 0, 0, 0)
[   0.042] [1:/bin/sh] syscall: ioctl(a, 540f, 9ffffed14, 0, 0, 0)
[   0.043] [1:/bin/sh] syscall: getpgid(0, 540f, 9ffffed14, 0, 0, 0)
[   0.044] [1:/bin/sh] syscall: rt_sigaction(14, 0, 9ffffec00, 8, 0, 0)
[   0.045] [1:/bin/sh] syscall: rt_sigaction(14, 9ffffebe0, 0, 8, 0, 0)
[   0.046] [1:/bin/sh] syscall: rt_sigaction(16, 0, 9ffffec00, 8, 0, 0)
[   0.046] [1:/bin/sh] syscall: rt_sigaction(16, 9ffffebe0, 0, 8, 0, 0)
[   0.046] [1:/bin/sh] syscall: rt_sigaction(15, 0, 9ffffec00, 8, 0, 0)
[   0.047] [1:/bin/sh] syscall: setpgid(0, 1, 0, 8, 0, 0)
[   0.048] [1:/bin/sh] syscall: ioctl(a, 5410, 9ffffed04, 8, 0, 0)
[   0.049] [1:/bin/sh] syscall: wait4(ffffffffffffffff, 9ffffebec, 3, 0, 0, 0)
# x=$(echo)
[   4.895] [1:/bin/sh] syscall: pipe(9ffffea40, 1, 451400, 2, 101010101010101, 3)
[   4.896] [1:/bin/sh] syscall: rt_sigprocmask(0, 449d58, 9ffffe910, 8, 452150, 3)
[   4.896] WARN: unimplemented system call: rt_sigprocmask (n=14)
[   4.896] WARN: rt_sigprocmask: error: ENOSYS: This error originates from:
    #1: ffff800000214179  kerla::printk::capture_backtrace()+0x79
    #2: ffff8000001ad443  kerla::result::Error::new()+0x23
    #3: ffff80000014ba77  kerla::syscalls::SyscallHandler::do_dispatch()+0x9c7
    #4: ffff80000014a87c  kerla::syscalls::SyscallHandler::dispatch()+0x1ac
    #5: ffff8000001b6dbc  x64_handle_syscall()+0x9c
    #6: ffff800000100235  syscall_entry()+0x3d

[   4.897] [1:/bin/sh] syscall: fork(0, 449d58, 9ffffe910, 8, 452150, 3)
[   4.898] [1:/bin/sh] syscall: rt_sigprocmask(2, 9ffffe910, 0, 8, 452150, 3)
[   4.898] WARN: unimplemented system call: rt_sigprocmask (n=14)
[   4.898] WARN: rt_sigprocmask: error: ENOSYS: This error originates from:
    #1: ffff800000214179  kerla::printk::capture_backtrace()+0x79
    #2: ffff8000001ad443  kerla::result::Error::new()+0x23
    #3: ffff80000014ba77  kerla::syscalls::SyscallHandler::do_dispatch()+0x9c7
    #4: ffff80000014a87c  kerla::syscalls::SyscallHandler::dispatch()+0x1ac
    #5: ffff8000001b6dbc  x64_handle_syscall()+0x9c
    #6: ffff800000100235  syscall_entry()+0x3d

[   4.899] [1:/bin/sh] syscall: close(4, 0, 0, 0, 0, 0)
[   4.899] [1:/bin/sh] syscall: read(3, 9ffffea48, 80, 0, 0, 0)
[   4.900] [2:/bin/sh] syscall: gettid(0, 449d58, 450438, 8, 452150, 3)
[   4.900] WARN: unimplemented system call: gettid (n=186)
[   4.900] WARN: gettid: error: ENOSYS: This error originates from:
    #1: ffff800000214179  kerla::printk::capture_backtrace()+0x79
    #2: ffff8000001ad443  kerla::result::Error::new()+0x23
    #3: ffff80000014ba77  kerla::syscalls::SyscallHandler::do_dispatch()+0x9c7
    #4: ffff80000014a87c  kerla::syscalls::SyscallHandler::dispatch()+0x1ac
    #5: ffff8000001b6dbc  x64_handle_syscall()+0x9c
    #6: ffff800000100235  syscall_entry()+0x3d

[   4.901] [2:/bin/sh] syscall: rt_sigprocmask(2, 9ffffe910, 0, 8, 452150, 3)
[   4.901] WARN: unimplemented system call: rt_sigprocmask (n=14)
[   4.901] WARN: rt_sigprocmask: error: ENOSYS: This error originates from:
    #1: ffff800000214179  kerla::printk::capture_backtrace()+0x79
    #2: ffff8000001ad443  kerla::result::Error::new()+0x23
    #3: ffff80000014ba77  kerla::syscalls::SyscallHandler::do_dispatch()+0x9c7
    #4: ffff80000014a87c  kerla::syscalls::SyscallHandler::dispatch()+0x1ac
    #5: ffff8000001b6dbc  x64_handle_syscall()+0x9c
    #6: ffff800000100235  syscall_entry()+0x3d

[   4.902] [2:/bin/sh] syscall: rt_sigaction(2, 9ffffe820, 0, 8, 452150, 3)
[   4.903] [2:/bin/sh] syscall: rt_sigaction(f, 9ffffe820, 0, 8, 452150, 3)
[   4.903] [2:/bin/sh] syscall: rt_sigaction(3, 9ffffe820, 0, 8, 452150, 3)
[   4.903] [2:/bin/sh] syscall: close(3, 0, 0, 0, 0, 0)
[   4.903] [2:/bin/sh] syscall: dup2(4, 1, 0, 0, 21, 0)
[   4.904] [2:/bin/sh] syscall: close(4, 0, 0, 0, 0, 0)
[   4.906] [2:/bin/sh] syscall: wait4(ffffffffffffffff, 9ffffe7ac, 1, 0, 0, 0)
[   4.908] [2:/bin/sh] syscall: exit_group(0, 0, 451020, 0, 452050, 0)
[   4.908] WARN: unimplemented system call: exit_group (n=231)
[   4.908] WARN: exit_group: error: ENOSYS: This error originates from:
    #1: ffff800000214179  kerla::printk::capture_backtrace()+0x79
    #2: ffff8000001ad443  kerla::result::Error::new()+0x23
    #3: ffff80000014ba77  kerla::syscalls::SyscallHandler::do_dispatch()+0x9c7
    #4: ffff80000014a87c  kerla::syscalls::SyscallHandler::dispatch()+0x1ac
    #5: ffff8000001b6dbc  x64_handle_syscall()+0x9c
    #6: ffff800000100235  syscall_entry()+0x3d

[   4.909] [2:/bin/sh] syscall: exit(0, 0, 3c, 0, 452050, 0)
[   4.909] WARN: read: error: EINTR: This error originates from:
    #1: ffff800000214179  kerla::printk::capture_backtrace()+0x79
    #2: ffff8000001ad443  kerla::result::Error::new()+0x23
    #3: ffff8000001ada17  <kerla::result::Error as c...la::result::Errno>>::from()+0x17
    #4: ffff8000001ab467  <T as core::convert::Into<U>>::into()+0x17
    #5: ffff800000136cfe  kerla::process::wait_queue...e::sleep_signalable_until()+0x1ae
    #6: ffff800000152e4c  <kerla::pipe::PipeReader a...s::inode::FileLike>::read()+0x7c
    #7: ffff80000012dfcd  kerla::fs::opened_file::OpenedFile::read()+0x14d
    #8: ffff800000146276  kerla::syscalls::read::<im...SyscallHandler>::sys_read()+0x1d6

[   4.909] delivering 17 to PId(1)
[   4.910] [1:/bin/sh] syscall: rt_sigreturn(11, 0, 0, 0, 0, 0)
[   4.910] WARN: rt_sigreturn: error: EINTR: This error originates from:
    #1: ffff800000214179  kerla::printk::capture_backtrace()+0x79
    #2: ffff8000001ad443  kerla::result::Error::new()+0x23
    #3: ffff8000001ada17  <kerla::result::Error as c...la::result::Errno>>::from()+0x17
    #4: ffff8000001ab467  <T as core::convert::Into<U>>::into()+0x17
    #5: ffff8000001477f4  kerla::syscalls::rt_sigret...andler>::sys_rt_sigreturn()+0x44
    #6: ffff80000014b577  kerla::syscalls::SyscallHandler::do_dispatch()+0x4c7
    #7: ffff80000014a87c  kerla::syscalls::SyscallHandler::dispatch()+0x1ac
    #8: ffff8000001b6dbc  x64_handle_syscall()+0x9c

[   4.911] [1:/bin/sh] syscall: read(3, 9ffffea48, 80, 0, 0, 0)
[   4.912] [1:/bin/sh] syscall: read(3, 9ffffea48, 80, 0, 0, 0)

[freezes here]

Make dependencies broken

The 70d4c1c for #85 introduced problems with Make targets where generation of extensions loader isn't dependencies for all targets invoking cargo, where root crate refers to the generated dependency.

Symptom:

error: failed to load manifest for workspace member `/home/manveru/projects/kerla/kernel`

Caused by:
  failed to load manifest for dependency `kerla_kexts_loader`

Caused by:
  failed to read `/home/manveru/projects/kerla/build/kexts_loader/Cargo.toml`

Caused by:
  No such file or directory (os error 2)
make: *** [Makefile:142: check] Error 101

Write Documentation

It would be helpful for interested contributors if kerla has some documentation. I would like to help with that. It will also help me understand kerla (and Operating Systems in general) better so that I can contribute with some code later on.

@nuta if possible can you suggest a rough outline of how you imagine the documentation to be structured? I can start working and send in some pull requests.

make: rust-strip: No such file or directory

I'm using archlinux and I installed the cargo and rustup dependencies , and docker,qemu,python3,gdb

and I'm getting this error

warning: kerla (bin "kerla") generated 9 warnings (1 duplicate)
Finished dev [unoptimized + debuginfo] target(s) in 2.11s
make[1]: Leaving directory '/home/coolpp/github/kerla'
NM kerla.x64.symbols
/bin/sh: line 1: rust-nm: command not found
/bin/sh: line 1: rustfilt: command not found
SYMBOLS kerla.x64.elf
STRIP kerla.x64.stripped.elf
make: rust-strip: No such file or directory
make: *** [Makefile:67: build] Error 127

Implement `lseek` syscall

I'm opening this issue to track the implementation of the lseek syscall, as I plan to work on it. I'll iterate over the issue description by adding more "bullet points" as I improve my understanding of what's needed.

  • "implementation" (might be broken into smaller subtasks)
  • tests

Hello World from glibc

Glibc, the de facto libc implementation in Linux, tends to use non-trivial Linux-specific features (/proc) and it makes harder to support applications built with glibc. This issue aims to implement missing features needed to run the glibc-based hello world program.

Implement epoll

IIUC it's essential to run event-driven programs like Node.js.

`OpenedFileTable` needs to be shareable

At the moment Process::fork() seem to clone the OpenedFileTable while for proper multithreading we have to have shared access to opened files following clone(2) semantics supported by the Linux Kernel.

Found during work on #88 and belongs to Multithreading milestone (I can't add myself).

More details in the flags mask of clone(2), scroll down to CLONE_FILES. I haven't checked yet how it's implemented in Linux Kernel.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.