-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
arch/x86_64: Implement ukarch_random #695
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @michpappas!
I tested the functions and they seem to work just as expected! I will let here a couple of comments.
307909f
to
8729b62
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this!
Reviewed-by: Razvan Virtan virtanrazvan@gmail.com
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thank you @michpappas !
Reviewed-by: Maria Sfiraiala maria.sfiraiala@gmail.com
Implement the ukarch_random API for x86_64. The implementation requires that both the RDRAND and RDSEED instructions are available in the system. Signed-off-by: Michalis Pappas <mpappas@fastmail.fm>
8729b62
to
58f0fb2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! 🚀
Approved-by: Marc Rittinghaus marc.rittinghaus@unikraft.io
✅ Checkpatch passed Beep boop! I ran Unikraft's
|
commit a20323a40e14f98a1e7b793a47eea755dbfe8f34 Author: Simon Kuenzer <simon@unikraft.io> Date: Wed Feb 1 23:13:05 2023 +0100 lib/syscall_shim: Pretty-print format: clone This commit introduces initial print format and decoding definitions for the following system calls: `SYS_clone` Checkpatch-Ignore: MISSING_BREAK Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Andra Paraschiv <andra@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #737 commit 239b989d3bef7787b984cc52096b96baba458b10 Author: Simon Kuenzer <simon@unikraft.io> Date: Wed Feb 1 23:12:13 2023 +0100 lib/syscall_shim: Pretty-print format: socket, bind, sendto, recvmsg This commit introduces initial print format and decoding definitions for the following system calls: `SYS_socket`, `SYS_bind`, `SYS_sendto`, `SYS_recvmsg` Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Andra Paraschiv <andra@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #737 commit e93760fa0d750547e5bf9d052e983bf3a394756f Author: Simon Kuenzer <simon@unikraft.io> Date: Wed Feb 1 23:10:26 2023 +0100 lib/syscall_shim: Pretty-print format: clock_gettime This commit introduces initial print format and decoding definitions for the following system calls: `SYS_clock_gettime` Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Andra Paraschiv <andra@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #737 commit d7ca4f7bdb6355e7d894fb2f3e21710b61655a9a Author: Simon Kuenzer <simon@unikraft.io> Date: Wed Feb 1 23:08:59 2023 +0100 lib/syscall_shim: Pretty-print format: futex This commit introduces initial print format and decoding definitions for the following system calls: `SYS_futex` Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Andra Paraschiv <andra@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #737 commit 7883f875f73b2296fba7c6e23e5fdacf6eac764d Author: Simon Kuenzer <simon@unikraft.io> Date: Wed Feb 1 23:07:24 2023 +0100 lib/syscall_shim: Pretty-print format: mmap, munmap, mprotect This commit introduces initial print format and decoding definitions for the following system calls: `SYS_mmap`, `SYS_munmap`, `SYS_mprotect` Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Andra Paraschiv <andra@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #737 commit c036b1528118dcb07ba2cb906670c5d838506379 Author: Simon Kuenzer <simon@unikraft.io> Date: Wed Feb 1 18:07:16 2023 +0100 lib/posix-futex: Remove circular config dependency to syscall_shim This commit removes the unit test dependency of `lib/posix-futex` to syscall_shim which caused a circular dependency over `lib/uktest`: `lib/uktest` started to be dependent on `lib/syscall_shim` and because the `lib/syscall_shim` depends on `lib/ukstreambuf`, the unit tests of `lib/ukstreambuf` depend on `lib/uktest` too. Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Andra Paraschiv <andra@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #737 commit a7630b1e8c5697a1817086900379552156945e7a Author: Simon Kuenzer <simon@unikraft.io> Date: Wed Feb 1 16:22:22 2023 +0100 lib/syscall_shim: strace-like output for binary system calls This commit introduces the option to enable a strace-like output for binary system calls. The option can be found under the debugging options of `lib/syscall_shim`. The implementation utilizes the pretty-print function `uk_snprsyscall()` for system call requests. Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Andra Paraschiv <andra@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #737 commit 26dfabdfdc43a9d89dc00c5284e2af19ddb44265 Author: Simon Kuenzer <simon@unikraft.io> Date: Wed Feb 1 22:36:24 2023 +0100 lib/syscall_shim: Functions to pretty-print system call requests This commit introduces an initial implementation of `uk_snprsyscall()` and `uk_vsnprsyscall()`, two functions that pretty print a system call request to a given C-string buffer. The system call name, the given arguments (including flags and definitions) and the response are decoded. As a start, this commit implements the formatting of the following system calls: brk, open, openat, write, read, stat, fstat, close, dup, dup2, gettid, getpid Yet unsupported system calls are printed with the raw values of arguments. Checkpatch-Ignore: DO_WHILE_MACRO_WITH_TRAILING_SEMICOLON Checkpatch-Ignore: MULTISTATEMENT_MACRO_USE_DO_WHILE Checkpatch-Ignore: TRAILING_SEMICOLON Checkpatch-Ignore: MISSING_BREAK Checkpatch-Ignore: COMPLEX_MACRO Checkpatch-Ignore: SPACING Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Andra Paraschiv <andra@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #737 commit 5f0510de86507b2e1745020acc862ad1b1a2bb97 Author: Simon Kuenzer <simon@unikraft.io> Date: Mon Jan 30 15:09:24 2023 +0100 lib/syscall_shim: Use `UK_NARGS()` from `<uk/essentials.h>` This commit removes the macros `__UK_SYSCALL_NARGS()` and `__UK_SYSCALL_DEF_NARGS()` and replaces their usage with `UK_NARGS()` provided by `<uk/essentials.h>`. Checkpatch-Ignore: LONG_LINE Checkpatch-Ignore: COMPLEX_MACRO Checkpatch-Ignore: SPACING Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Andra Paraschiv <andra@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #737 commit c47bff7b4a7f19981524a2c60605ffc92aa42268 Author: Simon Kuenzer <simon@unikraft.io> Date: Mon Jan 30 15:05:32 2023 +0100 include/essentials: UK_NARGS(): Support up to 25 arguments Increase the number of supported arguments of `UK_NARGS()` from 7 to 25. Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Andra Paraschiv <andra@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #737 commit 85b938c4678c6f2e365510cf575b8131098b5b61 Author: Simon Kuenzer <simon@unikraft.io> Date: Mon Jan 30 03:53:36 2023 +0100 lib/ukstreambuf: Unit tests: Append operations for binary data Registers `libuktest` unit tests for append operations of binary data to a streambuf object. Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Andra Paraschiv <andra@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #737 commit 3f39a18376498028ed8fe11fe678b2d2fc7743cb Author: Simon Kuenzer <simon@unikraft.io> Date: Mon Jan 30 03:51:50 2023 +0100 lib/ukstreambuf: Unit tests: Append operations for C-strings Registers `libuktest` unit tests for append operations of C-strings to a streambuf object. Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Andra Paraschiv <andra@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #737 commit b52f6ab7bda929c1342f3fc323bf35a3475839c1 Author: Simon Kuenzer <simon@unikraft.io> Date: Mon Jan 30 03:46:37 2023 +0100 lib/ukstreambuf: Unit tests: Initialization and basic operations Registers `libuktest` unit tests for initialization and basic operations of a streambuf object. Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Andra Paraschiv <andra@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #737 commit c28496eae076b29ef2fa1dcce9eca8fd8e00ef82 Author: Simon Kuenzer <simon@unikraft.io> Date: Mon Jan 30 03:34:07 2023 +0100 lib/ukstreambuf: Append operations for binary data This commit introduces append operations for binary data: - `uk_streambuf_memcpy()`: Append a copy of binary data - `uk_streambuf_reserve()`: In-place appending of binary data (zero copy) Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Andra Paraschiv <andra@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #737 commit 2c9065022de71f63796af0d83df356590ea7e379 Author: Simon Kuenzer <simon@unikraft.io> Date: Mon Jan 30 03:30:49 2023 +0100 lib/ukstreambuf: Append operations for C-strings This commit introduces append operations for C-strings: - `uk_streambuf_printf()`, `uk_streambuf_vprintf()`: Append a printf-formatted string - `uk_streambuf_strcpy`: Append a copy of a C-string Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Andra Paraschiv <andra@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #737 commit 44e2e7f7034003168130d472584c09cfa1c21821 Author: Simon Kuenzer <simon@unikraft.io> Date: Mon Jan 30 03:25:09 2023 +0100 lib/ukstreambuf: Initialization and basic operations This commit introduces functions to allocate and/or initialize a streambuf object for a given memory buffer. It also adds basic operations, like resetting a streambuf buffer and querying its current state. Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Andra Paraschiv <andra@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #737 commit f15a21681bb53727aa2537b606cac81662f081af Author: Simon Kuenzer <simon@unikraft.io> Date: Mon Jan 30 03:13:20 2023 +0100 lib/ukstreambuf: Add library skeleton The library will provide helper functions and macros to simplify dealing with appending of data and/or C-string to buffers. Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Reviewed-by: Andra Paraschiv <andra@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #737 commit 6092385bf2a5a3fdec4bf6d9f9551998ae6209ee Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Fri Feb 3 11:58:19 2023 +0100 lib/uksched: Silence warning about unused variable The parent variable was not used outside the assert. This leads to a warning when asserts are disabled. This commit fixes the warning be removing the variable. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #739 commit 1fbd1045bffa17ff1b38cd7f2488b0843aea5960 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Fri Feb 3 11:54:58 2023 +0100 lib/ukschedcoop: Silence warning about unused args When asserts are disabled we get warnings about unused args. This commit silences the warnings. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #739 commit cdeccfb9343d352a7bf63c66506275df663919d4 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Fri Feb 3 11:53:20 2023 +0100 lib/ukdebug: Silence warnings about unused args If printing of source line and file is disabled, we get warnings about srcline and srcname not being used. This commit silences the warning. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #739 commit 9910feb8c3efea57f3de284b0b0a28f0facbbbd6 Author: Simon Kuenzer <simon@unikraft.io> Date: Fri Feb 3 20:40:05 2023 +0100 lib/vfscore: Cast initrd vbase to (void *) PR #722 (Boot code refactoring) introduced an update to `struct ukplat_memregion_desc` where the virtual base of a memory region is now specified as a __vaddr_t integer value. Since it is a virtual address we can cast it to (void *) to avoid build warnings in `lib/vfscore/rootfs.c`. Signed-off-by: Simon Kuenzer <simon@unikraft.io> Reviewed-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Approved-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #744 commit e742f9d1da1008be8f35b51247b5182ab2b0eae4 Author: Michalis Pappas <mpappas@fastmail.fm> Date: Sun Dec 11 13:17:58 2022 +0100 plat/kvm: Enable Pointer Authentication in KVM Signed-off-by: Michalis Pappas <mpappas@fastmail.fm> Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com> Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #686 commit fb02d665a3a382fd875ec4f6588a792def31c261 Author: Michalis Pappas <mpappas@fastmail.fm> Date: Sun Dec 11 13:13:37 2022 +0100 plat/common: Use ukarch_random to generate PAuth key With the addition of the ukarch_random() API it is now possible to generate PAuth keys without delegating the implementation of key generation to the platform. Remove ukplat_pauth_gen_key() from the platform API and generate PAuth keys using the ukarch_random() API. Signed-off-by: Michalis Pappas <mpappas@fastmail.fm> Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com> Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #686 commit e0c98d94be9c9b870de9ef146b94bb19a0fda540 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Fri Feb 3 19:35:25 2023 +0100 include/uk/plat: Fix initrd0 macro This commit fixes a typo in the ukplat_memregion_find_initrd0 macro. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Simon Kuenzer <simon@unikraft.io> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #742 commit 1064d46d60d8e8fdbf0735d002acba8a58e92bfb Author: Delia-Maria Pavel <delia_maria.pavel@stud.acs.upb.ro> Date: Tue Dec 27 16:43:48 2022 +0200 lib/ramfs: Add README.md file Signed-off-by: Delia-Maria Pavel <delia_maria.pavel@stud.acs.upb.ro> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #705 commit 9d907d4df807c705313c2ad30a411fa02d0f14b2 Author: Delia-Maria Pavel <delia_maria.pavel@stud.acs.upb.ro> Date: Tue Dec 27 16:34:45 2022 +0200 lib/ramfs: Add comments to ramfs.h file Signed-off-by: Delia-Maria Pavel <delia_maria.pavel@stud.acs.upb.ro> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #704 commit e627b2d3c3fbec090cdbcd886d3edc80be05ebf0 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Thu Feb 2 20:30:04 2023 +0100 lib/uknofault: Fix warning with ukvmem When ukvmem is activated a warning may be observed during build about ps being potentially uninitialized. This commit fixes this. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Michalis Pappas <michalis.pappas@opensynergy.com> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #603 commit 425eb8468f56a07ebe7ed3a673523fc12db2ae84 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Thu Feb 2 19:47:36 2023 +0100 lib/posix-mmap: Introduce POSIX memory functions This commit adds the posix-mmap library that implements the POSIX memory-mapping related functions such as mmap and munmap based on ukvmem. Checkpatch-Ignore: NON_RAW_SYSCALL Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Michalis Pappas <michalis.pappas@opensynergy.com> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #603 commit d3626a6ce1061b34408d999775eda4fe12df3f4b Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Thu Feb 2 20:03:37 2023 +0100 drivers/virtio: Use DMA mapping with ukvmem The current implementation uses the heap to allocate memory for the virtio queues. This is problematic when used in conjunction with on-demand paging for the heap. It can cause pages of the virtio queue to be non-contiguous in physical memory. Some pages may not even mapped to physical memory, yet. Since the hypervisor does not care about the virtual mapping but only gets the physical start address of the virtio queue (i.e., the physical address of the first page), it will write on any physical page in the range of the virtio queue (i.e., start physical address + size of queue). However, these physical pages may belong to arbitrary other mappings. And even if they belong to the same virtqueue, they might not be mapped in the same order as in the virtual space. This is especially hard to debug, because the guest is not performing the corrupting memory writes. To fix this, we request contiguous memory from the frame allocator and map this in the same order in the virtual address space using uk_vma_map_dma(). Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Michalis Pappas <michalis.pappas@opensynergy.com> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #603 commit f335edee3e87b422efc9cce0cb2984bc9c9bdce2 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Thu Feb 2 19:45:51 2023 +0100 lib/ukboot: Initialize VAS + Heap When ukvmem is available, we can represent the heap as a virtual memory area. This has the advantage of enabling on-demand paging for the heap. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Michalis Pappas <michalis.pappas@opensynergy.com> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #603 commit 0313587052254819ea1d59d6bf0f1946bc354930 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Thu Feb 2 19:43:54 2023 +0100 lib/ukvmem: Introduce virtual memory library ukvmem provides the means to perform virtual address space management where each virtual address space is build from a set of virtual memory areas. This allows the library to select virtual addresses for mappings. This is in contrast to the primitive paging API which does not manage virtual address allocation. The library implements different VMA types via VMA operations that define the VMA's behavior and contents. Just like on Linux contiguous VMAs are merged and split depending on the compatibility of their flags and the behavior defined by the VMA. The library provides functions for mapping, unmapping, and changing of memory attributes. The initial version comes with support for x86_64, only. Checkpatch-Ignore: LONG_LINE_COMMENT Checkpatch-Ignore: FUNCTION_WITHOUT_ARGS Checkpatch-Ignore: SPLIT_STRING Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Michalis Pappas <michalis.pappas@opensynergy.com> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #603 commit eb5696faa938e8e85ed99099a9c8da72ab30525e Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Thu Feb 2 19:19:37 2023 +0100 include/plat: Update paging header to new CC This commit updates the function documentation in the platform paging header to the new coding convention so it is inline with the newly added functions. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Michalis Pappas <michalis.pappas@opensynergy.com> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #603 commit 17d6ae38922124a56494e72c84d753cc4f9a8f47 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Thu Feb 2 19:37:19 2023 +0100 plat/common: Ignore non-existent PTEs ukplat_page_unmap() ignores non-existent PTEs and just goes on to the next PTE in the memory range. The same behavior can be achieved with ukplat_page_mapx(). However, ukplat_page_set_attr() stops at the first non-existent PTE. This is problematic when on-demand paging has lead to some pages in a memory range being present and others not. This commit changes the behavior of ukplat_page_set_attr() to just ignore this like the other mapping functions. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Michalis Pappas <michalis.pappas@opensynergy.com> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #603 commit 2bc86d1f93407d44d4d35b3b4b032e2977233ee5 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Thu Feb 2 19:30:13 2023 +0100 plat/common: Ignore -ENOMEM errors in pg_ffree() Currently, the pg_ffree() function already ignored any errors, but it has an assert to check if the error could be expected. We add -ENOMEM to this, which signals that the memory has not been allocated. While this would indicate a true error condition in case a physical page is mapped only once, this is not the case if the same page is mapped multiple times in a certain range and this range is unmap en-bloc. In this case, the first free would free the frame in the allocator while the other mappings would cause an expected error. An example for such a mapping could be a memory range which should be zero-initialized by mapping all pages to the same zero frame and using a CoW-style mapping. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Michalis Pappas <michalis.pappas@opensynergy.com> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #603 commit 956e45ceb5de4c93d9147df6f8ccfc08afa20b5a Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Thu Feb 2 19:17:43 2023 +0100 plat/common: Introduce ukplat_page_k(un)map() For temporary mappings of physical memory within the unikernel, it is useful to have a fast alternative to ukplat_page_mapx() that also automatically selects a virtual address for the mapping. This commit introduces ukplat_page_kmap() and ukplat_page_kunmap() for this purpose. However, they are not guaranteed to succeed if for some reason no kernel mapping can be established. However, for direct-mapped physical memory implementations the functions just return the virtual address of the direct mapping. This makes the kmap() very fast. In addition, this implementation cannot fail and the unmap is a noop. The commit comes with an implementation for x86_64 and arm64. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Michalis Pappas <michalis.pappas@opensynergy.com> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #603 commit a51d65c446c2dbe204c5466e80f66e5974e8c8c6 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Thu Feb 2 19:11:39 2023 +0100 plat/common: Introduce ukplat_page_mapx() The current ukplat_page_map() functions allows to map a range of virtual pages to physical ones with a defined set of protections. This function has the following limitations that create problems in the context of virtual memory management: 1) If a mapping the virtual range already exists, the function aborts with an error. The caller has no knowledge about the virtual address that caused the error. 2) If the page attributes are set to read only while physical memory should be allocated at the same time with paddr=__PADDR_ANY, the caller has no chance of initializing the frame contents. This commit replaces ukplat_page_map() with ukplat_page_mapx() with the x being execute/extended. The mapx version allows the caller to specify a function that should be called during mapping before writing a PTE. The function can modify the PTE, instruct the mapping to skip the current page, or switch to a smaller page size. The original function behavior is provided when the mapx argument is NULL. The mapx function can be used in case 1) to either overwrite or skip existing mappings. The mapx function can also be used together with a temporary mapping to initialize the physical memory of the current page before establishing the mapping. This way, we avoid map/rw -> remap/ro windows, which can also pose a security problem besides the runtime overhead. If the caller sets paddr=0, it is also possible to completely leave physical memory allocation to the mapx function, for example, to serve memory from a cache. For compatibility, a wrapper for ukplat_page_map() is provided. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Michalis Pappas <michalis.pappas@opensynergy.com> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #603 commit 49d97bd83846166ab09007405fcbd712e5fad51b Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Thu Feb 2 18:52:40 2023 +0100 include/arch/x86_64: Add page fault error bits This commit adds bit definitions for parsing x86_64 page fault error codes. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Michalis Pappas <michalis.pappas@opensynergy.com> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #603 commit a93c1366b980edd84f34f39f0cc0743c889eae7e Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Thu Feb 2 18:48:40 2023 +0100 include/arch/x86_64: Add PT_Lx_PTE_SET_PADDR() This commit introduces PT_Lx_PTE_SET_PADDR() which allows to set the physical address in a page table entry. This commit comes only with the x86_64 implementation. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Michalis Pappas <michalis.pappas@opensynergy.com> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #603 commit 075cd8d62c0940feaa742cb7826e8c6b9266b6a1 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Thu Feb 2 18:44:33 2023 +0100 include/arch/[x86_64,arm64]: Add PAGE_SHIFT_Lx() This commit introduces a macro called PAGE_SHIFT_Lx() that is the reverse operation of PAGE_Lx_SHIFT() and allows to compute the page table level from the page size order. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Michalis Pappas <michalis.pappas@opensynergy.com> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #603 commit 69a268de0c87f1b4eeb67f4304d6ed85641c7abf Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Thu Feb 2 18:36:36 2023 +0100 include/uk/plat: Fix PAGE_FLAG_SIZE_MASK Currently, the macro uses the shift to define the mask. However, the mask is determined by the number of bits reserved for the size, not by the number of bits shifted in the flag word. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Michalis Pappas <michalis.pappas@opensynergy.com> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #603 commit 7d8ffd5047d335a19398f9587a7e257366934517 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Thu Feb 2 18:34:18 2023 +0100 include/uk: Move PAGE_ATTR_PROT_* values The PAGE_ATTR_PROT_RW and PAGE_ATTR_PROT_RWX definitions should be available even when the <uk/plat/paging.h> header is not available, just like the other PAGE_ATTR_* values. We thus move them to the arch header. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Michalis Pappas <michalis.pappas@opensynergy.com> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #603 commit e2183e285a2fce7c10ff3fc27fdb643826b18139 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Thu Feb 2 18:31:05 2023 +0100 lib/ukfallocbuddy: Build as ISR-safe To be able to invoke the frame allocator from within a page fault handler, we need to compile it as ISR-safe. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Michalis Pappas <michalis.pappas@opensynergy.com> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #603 commit 6408fadae4e67ae642484fbf8af7bdef7ed0ee68 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Thu Feb 2 18:28:41 2023 +0100 plat/kvm: Build paging code as ISR-safe To be able to invoke the paging code in the context of a page fault handler, we need to build it as ISR-safe. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Michalis Pappas <michalis.pappas@opensynergy.com> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #603 commit 47ec124fff0551ba3c4eccd4264cacc2f5f980f3 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Fri Feb 3 17:08:24 2023 +0100 plat/kvm/x86: Fix cmdline parsing In the boot refactoring, we replaced the statically allocated command line buffer with a dynamically allocated one. However, the length argument was not updated, which leads to the cmdline being not properly parsed. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #741 commit 85ef21541f61e8ec3b633d8ccc9e1453911c609e Author: Marco Schlumpp <marco.schlumpp@gmail.com> Date: Thu Dec 16 10:48:56 2021 +0100 plat/common/pci: Implement subclass matching The class is usually not precise enough to identify the correct driver for a device. For example, an NVM driver can only talk to devices which are in the subclass of NVM storage devices but not to other devices in the larger storage class. Signed-off-by: Marco Schlumpp <marco.schlumpp@gmail.com> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Approved-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #624 commit 6d686ab21fd2961b341413b0415db3d68253a9a7 Author: Maria Sfiraiala <maria.sfiraiala@gmail.com> Date: Wed Dec 21 23:57:49 2022 +0200 plat/pci_ecam.c: Fix gcc-ism for clang compilation This commit replaces a small gcc-ism from plat/common/pci_ecam.c that makes impossible any clang compilation on AArch64. The `dummy_imask[] = { [0 ... 16] = cpu_to_fdt32(~0) };` syntax is a GNU extension, ergo, it is not recognized by LLVM's clang. Signed-off-by: Maria Sfiraiala <maria.sfiraiala@gmail.com> Reviewed-by: Michalis Pappas <mpappas@fastmail.fm> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #701 commit 554e64136c136011d2a835c90909fd264721c1c8 Author: Tu Dinh Ngoc <dinhngoc.tu@irit.fr> Date: Mon Nov 28 15:44:12 2022 +0100 plat/virtio_net: Notify host of RX bufs on start Currently, we don't notify the virtio-net device of available RX buffers on driver start, meaning it might never send us incoming packets. Make sure that we send this notification once the driver has started. Signed-off-by: Tu Dinh Ngoc <dinhngoc.tu@irit.fr> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #669 commit add665661dec7b38e9db08a2e296d49e8167a44b Author: Tu Dinh Ngoc <dinhngoc.tu@irit.fr> Date: Mon Nov 28 15:43:57 2022 +0100 plat/virtio_net: Fix device MTU detection When looking for MTU information, instead of checking for the VIRTIO_NET_F_MTU feature flag, the virtio-net driver ends up checking VIRTIO_NET_F_STATUS instead. This commit fixes this check, and reports the device's MTU to the netdev architecture. Signed-off-by: Tu Dinh Ngoc <dinhngoc.tu@irit.fr> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #669 commit e2696bf36c9a45a894a978afd84533c9101010f0 Author: Nour-eddine Taleb <contact@noureddine.xyz> Date: Wed Dec 14 15:31:35 2022 +0100 lib/ukallocbbuddy: fix a memory leak fix a leak in the buddy allocator init routine. and an extra fix which subtract the bitmap size from the available pages in the region. GitHub-Fixes: #688 Signed-off-by: Nour-eddine Taleb <contact@noureddine.xyz> Reviewed-by: Florin Postolache <florin.postolache80@gmail.com> Approved-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #689 commit babad72979a85c021b41ef2b7d2605f2c556c6ed Author: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro> Date: Thu Jul 21 09:19:01 2022 +0300 lib/nolibc: Use Linux-compatible stat structure Use fields and field types for nolibc `stat` structure to make it compatible with Linux. It is required for binary compatibility mode. The structure is copied from Musl (arch/x86_64/bits/stat.h). Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro> Reviewed-by: Delia Pavel <delia_maria.pavel@stud.acs.upb.ro> Approved-by: Simon Kuenzer <simon@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #675 commit 8f0ddca1bb8a0869a27f111b6f4687eca9886cce Author: Marco Schlumpp <marco@unikraft.io> Date: Fri Jan 20 13:46:39 2023 +0100 plat/*: Handle errors returned from IRQ event handlers PR #691 adds the possibility to return error codes from the event handler. In the context of interrupts, we interpret an error code as a fatal error and emit a crash. Signed-off-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #699 commit 419062ff01ee42a6eaffa9ef2a55372c055d5087 Author: Marco Schlumpp <marco@unikraft.io> Date: Tue Dec 20 15:46:35 2022 +0100 plat/*: Add event for IRQs Adds an event which is triggered when an IRQ occurs. The event handler has access to the IRQ number and the registers of the interrupted thread. Signed-off-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #699 commit f65c7267794e347711cb652542dac68e0f10a2ae Author: Marco Schlumpp <marco@unikraft.io> Date: Fri Dec 16 15:55:42 2022 +0100 plat/*: Expose registers to main irq handler function The trap handlers already pass on the registers to the handler functions. This passes them to the KVM-internal dispatch function. Signed-off-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #699 commit 3ef521c6b99e8685040be1d6bee59ca82c3165c8 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Fri Feb 3 11:02:21 2023 +0100 include/event: Expose HANDLED_CONT return value The previous changes to the event hide if the last handler that successfully handled the event allowed further event processing (i.e., on success always UK_EVENT_HANDLED is returned). This commit fixes this so that the caller of uk_raise_event() is informed about if event processing can continue by other means or if it should stop. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #738 commit 3520375f78ca30aa073b1449bf6b24be0fb60f0e Author: Marco Schlumpp <marco@unikraft.io> Date: Fri Dec 16 16:03:05 2022 +0100 lib/ukdebug: Use correct variable name for sect-strip.py tool The variable used didn't match the one defined in the platform part and therefore the specified sections were never stripped. Signed-off-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Radu Nichita <radunichita99@gmail.com> Approved-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #690 commit 19694171104fbe7931c8a041629bcfa59652f1e6 Author: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro> Date: Fri May 13 00:34:49 2022 +0300 lib/posix-info: Comment out unused sysinfo buffer The sysinfo structure defines the `reserved` buffer. This is however not present on Linux, meaning that binary-compatibile applications use a shorter buffer. This results in a buffer overflow when transferring information from Unikraft to the buffer in binary-compatible app. This commit fixes this by commenting out the `reserved` buffer in the `sysinfo` structure. Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro> Reviewed-by: Radu Nichita <radunichita99@gmail.com> Approved-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #673 commit ba8d5cab8e750653d6f55eb292b322818cf9966b Author: Marco Schlumpp <marco@unikraft.io> Date: Fri Oct 28 12:37:00 2022 +0200 plat/kvm: Ensure time monotonicity for tscclock The TSC is not synchronized perfectly on some systems. Examples of such systems are multi-socket system or newer AMD processors. This patch ensure that this does not cause an unwanted underflow in the delta calculation. GitHub-Fixes: #334 Signed-off-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #617 commit 3c194d7efe22c79fdda213de939db692e9f7f279 Author: Marco Schlumpp <marco@unikraft.io> Date: Mon Nov 28 11:27:30 2022 +0100 build: Check doc comments when compiling with clang The diagnostic can check for various issues related to doxygen documentation comments. A list of detectable issues can be found at [1]. [1]:https://clang.llvm.org/docs/DiagnosticsReference.html#wdocumentation Signed-off-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #664 commit 323cd8630be2db717576263a0273a55902861a0e Author: Radu Nichita <radunichita99@gmail.com> Date: Sun Jan 1 22:28:33 2023 +0200 lib/vfscore: Add comments to vfs.h file Signed-off-by: Radu Nichita <radunichita99@gmail.com> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #707 commit 5d93938fcd07c0e24c70e18567acf07c5951649f Author: Marco Schlumpp <marco.schlumpp@gmail.com> Date: Tue Oct 19 10:19:21 2021 +0200 lib/vfscore: Introduce no-access-time flag The ported ext* filesystem supports tracks the access time by default. By specifying this flag, the user can disable the feature to reduce the amount of inode updates. Signed-off-by: Marco Schlumpp <marco.schlumpp@gmail.com> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #623 commit fb5d3a866d42f2b7c2aaf07b002d7806be625300 Author: Marco Schlumpp <marco.schlumpp@gmail.com> Date: Tue Oct 19 10:14:54 2021 +0200 lib/vfscore: Add additional vnode modes The ext* filesystem port supports the usage of these flags. Signed-off-by: Marco Schlumpp <marco.schlumpp@gmail.com> Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #623 commit 20d3d242e939886284190d62089d9867374ef44c Author: Stefan Jumarea <stefanjumarea02@gmail.com> Date: Sat Sep 17 13:55:17 2022 +0300 lib/uktest: Add README.md file Signed-off-by: Stefan Jumarea <stefanjumarea02@gmail.com> Reviewed-by: Razvan Deaconescu <razvand@unikraft.io> Reviewed-by: Alexander Jung <alex@unikraft.io> Approved-by: Alexander Jung <alex@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #555 commit 8a366930a3e6548d369db76382ef469b04affe12 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Tue Jan 17 18:47:08 2023 +0100 plat/kvm/x86: Remove old bootinfo structure This commit removes the no longer needed uk_bootinfo structure header. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #722 commit 20bdc0556e36f257e199a534d98741b01cbbc0ec Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Tue Jan 17 18:45:10 2023 +0100 lib/ukboot: Add heap initialization Previously, the heap has been initialized in the platform code and information about the heap areas has been communicated via ALLOCATABLE memory regions. With the new boot information heap initialization is fully moved to libukboot. If paging is not enabled, we use the free physical memory areas to initialize the heap. The platform takes care of only exposing mapped physical memory. As before, non-contiguous areas are added to the allocator one-by-one. If paging is enabled, we create a contiguous mapping at a customizable base address (default @16GiB) and initialize the allocator with this single area. As before, using paging allows to access more memory than mapped by the boot page table. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #722 commit 08a9ebf3492d22229ebc7143a3ca87634e64361c Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Tue Jan 17 18:36:04 2023 +0100 plat/kvm: Add generation of boot info The information about the kernel segments available as part of the boot information at runtime is generated by the mkbootinfo script. The script generates a binary blob based on the linked unikernel image. This blob is then stored in the .uk_bootinfo section to replace the dummy data. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #722 commit f0b9508e0884e807c02b07ea2f3501f7f55c136c Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Tue Jan 17 18:32:17 2023 +0100 plat/kvm: Remove platform symbol hiding To use protocol-specific names for boot protocol entry functions we need to remove the platform symbol hiding step. This step does not serve any useful purpose and can take considerable time for large images. Removing it thus has also other benefits. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #722 commit 65e37e2a03aaee979fd342dd824c0a4534f5a482 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Tue Jan 17 18:28:52 2023 +0100 plat/kvm: Use multiboot entry function With different boot protocols providing different entry functions we can no longer statically define a single entry function or would need to give it a generic name. This, however, would prevent us from building images that come with support for multiple boot protocols (i.e., entry functions). Also keeping a protocol specific name make the function name more descriptive. We thus remove the static ENTRY from the linker script and provide the (default) entry symbol via the linker command line. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #722 commit fd30438ed96ead1e6855a9704a9ba182b5b7c7c2 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Tue Jan 17 18:16:26 2023 +0100 plat/kvm: Replace platform initialization code This commit introduces a boot protocol-independent platform initialization based on the unikraft boot information. Major changes to the previous code are: + Simplified and no longer specific to multiboot + Early boot memory allocation from free memory regions to avoid static memory reservation for the command line + Prepares paging initialization to be moved out of platform code + The paging-based implementation performs (un)mappings generically based on the boot information, leading to more flexibility. For example, a chainloader can specify its own memory mappings as regions to be unmapped during boot by the chainloaded unikernel. + No heap initialization within the platform. + Detailed printing of boot memory map, kernel command line, and others via the ukplat_bootinfo_print() method. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #722 commit 82a1219db835f597ae15bda4ae3caa9ac41f55d2 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Tue Jan 17 18:03:37 2023 +0100 plat/kvm: Add multiboot entry With the new boot information every boot protocol must come with entry code that transforms the protocol-specific information into the generic unikraft format. This commit inserts the corresponding entry function for multiboot v1. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #722 commit b23cc9ced90fa1b24052f271674b71065e75883e Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Tue Jan 17 17:57:13 2023 +0100 plat/kvm: Back memregions by boot information Previously, the entries of the memory region list were dynamically created at runtime based on the section symbols. This commit replaces the entire implementation and uses the boot information as source for the list instead. However, this is only done on x86 for now. We keep the old method for ARM until we have switched to boot information. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #722 commit e46704df909aa3b9d1e8cff61f125b876bcfe3ee Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Tue Jan 17 17:50:23 2023 +0100 plat/common: Introduce boot information Currently, every boot protocol (e.g., multiboot, Linux Boot Protocol) must come with their own complete platform initialization as the basic platform code directly works on the specific boot data structures. The generalized boot information abstracts away from the specifics of a certain boot protocol, thereby making it possible to write generic platform initialization code. Every boot protocol is thus expected to transform protocol-specific boot information to the generic form before entering platform initialization code. In case of chainloading via a custom unikraft loader, the loader may directly supply boot information in the generalized format. An important piece of boot information is the memory layout at the time of boot. That includes the load address of the kernel, the address of a command line, the load addresses of additional data blobs (e.g., initrd, devicetree), and where free memory is located. The boot information structure expresses this as a list of memory region descriptors. For sanity checks and compatibility a magic value and version information is provided at the beginning of the structure. The boot information is stored in a dedicated section (.uk_bootinfo) that is initialized with information about the kernel image segments and their desired access permissions at link-time. To this end, the linker script needs to call the mkbootinfo.py script and replace the dummy information in the allocated section with the generated data. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #722 commit ef17c1daef1f82bd88518e2e940480f9d27e7245 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Tue Jan 17 17:27:43 2023 +0100 plat/kvm: Complement multiboot header Multiboot uses bits in the flags field to specify what fields are available. The commit adds definitions for the flag bits. It also adds any other missing definitions and fixes some style issues. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #722 commit 232567ec69726e491e6acaa670a5e6449b815fd8 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Tue Jan 17 17:18:04 2023 +0100 plat/kvm: Combine multiboot headers Currently the multiboot definitions span across two headers. The one that is used in C code only, and one that is safe to include from assembly. Since we have the __ASSEMBLY__ macro, which is used extensively in the project, we reduce the number of headers by combining both multiboot headers into one. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #722 commit 8cd52c8acb60977fd6921e04968e2bf7d942e704 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Tue Jan 17 17:10:57 2023 +0100 include/uk/plat/common: Add memregion list This commit adds a platform internal memory region list type based on the public memory region descriptor. The list is effectively a pre-allocated array that can be filled up to its capacity. Non-overlapping regions in the list are sorted in ascending order according to the physical address of the memory regions. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #722 commit 732df5ae694410634d978048a029b1719266e2cd Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Tue Jan 17 19:08:48 2023 +0100 plat/linuxu: Adapt to new memregion desc Adapts the linuxu code to the new memory region descriptor and listing functions. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #722 commit 3ec186b558abb0c563d2ef2e10ec9cf30573fd89 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Tue Jan 17 18:51:31 2023 +0100 plat/xen: Adapt to new memregion desc Adapts the XEN code to the new memory region descriptor and listing functions. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #722 commit d732a7f6bcbb3e5d3bc9c0bc6c4df05e5d5ecf0d Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Tue Jan 17 18:50:18 2023 +0100 plat/xen/x86: Adapt to new memregion desc Adapts the XEN/x86 code to the new memory region descriptor and listing functions. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #722 commit cb00309fa70055b29c9f6b5957a086ebd581cb47 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Tue Jan 17 18:48:46 2023 +0100 plat/xen/arm: Adapt to new memregion desc Adapts the XEN/arm code to the new memory region descriptor and listing functions. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #722 commit 442b1e5038364c4b079ce438d56a8e417214019c Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Tue Jan 17 16:59:10 2023 +0100 plat/common: Adapt W^X to memregion desc Adapts the existing code to the changed declaration of the memory region descriptor. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #722 commit fac37da39f4ba7626361d3cbd6cb4ee3b41f3b73 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Tue Jan 17 16:51:28 2023 +0100 lib/vfscore: Adapt to new memregion desc Adapts the existing code to work with the new definition of the memory region descriptor. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #722 commit 99bac7bd2f967115e951cc3a99daadbae34bf5d6 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Tue Jan 17 16:49:54 2023 +0100 include/uk/plat: Adapt documentation style This commit just adapts the documentation style of the unmodified functions to be inline with the other functions and the coding convention RFC. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #722 commit 47dfe0b72d55141672010d6eb3c3eb00180e24fc Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Tue Jan 17 16:46:37 2023 +0100 include/uk/plat: Extend memory region iteration The previous search function only accepted exact matches. The new search function extends this by allowing to specify multiple region types that are accepted and also select the region flags that should be incorporated in the search. For example, this allows to list all readable kernel segments irrespective if they are also writeable or executable. For improved performance, the new functions only return a pointer to the memory region and do not create a copy. While this permits changing the memory region descriptor, this can be useful in early boot phases to adapt the region list. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #722 commit c2430d42a2860d1b59b86b320deb4df3cf5a3755 Author: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Date: Tue Jan 17 16:28:41 2023 +0100 include/uk/plat: Extend memory region descriptor The commit extends the memory region descriptor in multiple ways to make it ready to be used within the boot protocol to generically express the memory layout of the system. The new structure adds separate virtual and physical address fields so that scenarios are supported where we don't have a 1:1 mapping (e.g., when loading the kernel to a different virtual address). Types are changed accordingly. We also embed the name so that the descriptor becomes self-contained. The type and flags have been separated for ease of use and because search semantics for these are different. Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Reviewed-by: Marco Schlumpp <marco@unikraft.io> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Marco Schlumpp <marco@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #722 commit 693d8775dfebeff1cdb3da5dbb36f5a71d43ce4d Author: Michalis Pappas <mpappas@fastmail.fm> Date: Sun Nov 20 17:19:35 2022 +0100 arch/x86_64: Implement ukarch_random Implement the ukarch_random API for x86_64. The implementation requires that both the RDRAND and RDSEED instructions are available in the system. Signed-off-by: Michalis Pappas <mpappas@fastmail.fm> Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com> Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com> Approved-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #695 commit d1d05128d0a432b805106c12fff7f43f089144d2 Author: Tu Dinh Ngoc <dinhngoc.tu@irit.fr> Date: Tue Nov 29 15:01:21 2022 +0000 lib/ukparam: Accept arguments containing `=` Mount options of some filesystems (e.g. 9pfs) may contain a `=` sign. Pass the whole argument as-is in that case. Signed-off-by: Tu Dinh Ngoc <dinhngoc.tu@irit.fr> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #671 commit 31f8173d0fc59442200aad0eaefc49ad905dfeb3 Author: Tu Dinh Ngoc <dinhngoc.tu@irit.fr> Date: Tue Nov 29 10:43:32 2022 +0000 lib/9pfs: Add mount option parsing Allow specifying protocol version, uname and aname in mount options. Signed-off-by: Tu Dinh Ngoc <dinhngoc.tu@irit.fr> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #671 commit 50751c585315591728ba00c53b3ef2a598299918 Author: Tu Dinh Ngoc <dinhngoc.tu@irit.fr> Date: Thu Jun 30 18:22:28 2022 +0000 lib/9pfs: Add 9p2000.L support Signed-off-by: Tu Dinh Ngoc <dinhngoc.tu@irit.fr> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #671 commit 804cbb39c2b528019e1779af7528e8db6b8a50db Author: Tu Dinh Ngoc <dinhngoc.tu@irit.fr> Date: Fri Oct 14 14:02:22 2022 +0000 lib/uk9p: Fix writes not accepting iounit of zero The 9P protocol specifies that iounit may be zero. Make sure that writes accept this value like reads already do. Signed-off-by: Tu Dinh Ngoc <dinhngoc.tu@irit.fr> Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: #671 commit 0a70f192cf70f331e566a87299764ff6e3cd137f Author: Marco Schlumpp <marco.schlumpp@gmail.com> Date: Tue Oct 19 10:11:36 2021 +0200 lib/nolibc: Expose rmdir/rename from nolibc These two functions were not exposed by the nolibc library but are implemented by vfscore. Signed-off-by: Marco Schlumpp <marco.schlumpp@gmail.com> Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com> Approved-by: Razvan Deacones…
Implement the ukarch_random API for x86_64. The implementation requires that both the RDRAND and RDSEED instructions are available in the system. Signed-off-by: Michalis Pappas <mpappas@fastmail.fm> Reviewed-by: Razvan Virtan <virtanrazvan@gmail.com> Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com> Approved-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io> Tested-by: Unikraft CI <monkey@unikraft.io> GitHub-Closes: unikraft#695
Prerequisite checklist
checkpatch.pl
on your commit series before opening this PR;Base target
x86_64
]Additional configuration
Introduce a "Processor Features" menu under "Architecture Selection" when x86 is selected.
The
CONFIG_X86_64_HAVE_RANDOM
option enables the processor-generated randomness.Description of changes
This PR introduces an implement the ukarch_random API for x86_64. The implementation uses the
RDRAND
/RDSEED
instructions provided by Intel's DRNG technology [1]. Each of these instructions has been introduced at different stages of the architecture's timeline:This implementation requires that both instructions are supported by the processor.
[1] https://www.intel.com/content/www/us/en/developer/articles/guide/intel-digital-random-number-generator-drng-software-implementation-guide.html