]> xenbits.xensource.com Git - unikraft/unikraft.git/log
unikraft/unikraft.git
2 years agosupport/scripts: Allow overlapping bootinfo region
Marc Rittinghaus [Sat, 4 Feb 2023 04:32:20 +0000 (05:32 +0100)]
support/scripts: Allow overlapping bootinfo region

Preliminary fix: Unikraft expects memory regions in the boot info
to not overlap and be page aligned. This is, however, not
compatible with having the .tdata section being assigned its
dedicated segment. This commit removes the sanity checks for
now as Unikraft can handle this specific case.

Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Reviewed-by: Michalis Pappas <michalis.pappas@opensynergy.com>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #746

2 years agoplat/xen/x86: Add tls_load segment
Marc Rittinghaus [Sat, 4 Feb 2023 04:14:14 +0000 (05:14 +0100)]
plat/xen/x86: Add tls_load segment

This commit adds the tls_load segment that is needed for the .tdata
section.

Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Reviewed-by: Michalis Pappas <michalis.pappas@opensynergy.com>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #746

2 years agoplat/xen/arm: Add tls_load segment
Marc Rittinghaus [Sat, 4 Feb 2023 04:13:51 +0000 (05:13 +0100)]
plat/xen/arm: Add tls_load segment

This commit adds the tls_load segment that is needed for the .tdata
section.

Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Reviewed-by: Michalis Pappas <michalis.pappas@opensynergy.com>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #746

2 years agoplat/kvm/arm: Add tls_load segment
Marc Rittinghaus [Sat, 4 Feb 2023 04:13:28 +0000 (05:13 +0100)]
plat/kvm/arm: Add tls_load segment

This commit adds the tls_load segment that is needed for the .tdata
section.

Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Reviewed-by: Michalis Pappas <michalis.pappas@opensynergy.com>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #746

2 years agoplat/kvm/x86: Add tls_load segment
Marc Rittinghaus [Sat, 4 Feb 2023 04:24:33 +0000 (05:24 +0100)]
plat/kvm/x86: Add tls_load segment

This commit adds the tls_load segment that is needed for the .tdata
section.

Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Reviewed-by: Michalis Pappas <michalis.pappas@opensynergy.com>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #746

2 years agoplat/common: Put .tdata in tls_load segment
Marc Rittinghaus [Sat, 4 Feb 2023 04:04:28 +0000 (05:04 +0100)]
plat/common: Put .tdata in tls_load segment

When building Unikraft a warning might pop up stating that
the allocated section .tdata is not assigned to a loadable
segment. This commit puts the section into a segment which
is added to the PT_LOAD program headers.

Checkpatch-Ignore: SPACING
Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Reviewed-by: Michalis Pappas <michalis.pappas@opensynergy.com>
Reviewed-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #746

2 years agolib/syscall_shim: Pretty-print format: clone
Simon Kuenzer [Wed, 1 Feb 2023 22:13:05 +0000 (23:13 +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

2 years agolib/syscall_shim: Pretty-print format: socket, bind, sendto, recvmsg
Simon Kuenzer [Wed, 1 Feb 2023 22:12:13 +0000 (23:12 +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

2 years agolib/syscall_shim: Pretty-print format: clock_gettime
Simon Kuenzer [Wed, 1 Feb 2023 22:10:26 +0000 (23:10 +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

2 years agolib/syscall_shim: Pretty-print format: futex
Simon Kuenzer [Wed, 1 Feb 2023 22:08:59 +0000 (23:08 +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

2 years agolib/syscall_shim: Pretty-print format: mmap, munmap, mprotect
Simon Kuenzer [Wed, 1 Feb 2023 22:07:24 +0000 (23:07 +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

2 years agolib/posix-futex: Remove circular config dependency to syscall_shim
Simon Kuenzer [Wed, 1 Feb 2023 17:07:16 +0000 (18:07 +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

2 years agolib/syscall_shim: strace-like output for binary system calls
Simon Kuenzer [Wed, 1 Feb 2023 15:22:22 +0000 (16:22 +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

2 years agolib/syscall_shim: Functions to pretty-print system call requests
Simon Kuenzer [Wed, 1 Feb 2023 21:36:24 +0000 (22:36 +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

2 years agolib/syscall_shim: Use `UK_NARGS()` from `<uk/essentials.h>`
Simon Kuenzer [Mon, 30 Jan 2023 14:09:24 +0000 (15:09 +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

2 years agoinclude/essentials: UK_NARGS(): Support up to 25 arguments
Simon Kuenzer [Mon, 30 Jan 2023 14:05:32 +0000 (15:05 +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

2 years agolib/ukstreambuf: Unit tests: Append operations for binary data
Simon Kuenzer [Mon, 30 Jan 2023 02:53:36 +0000 (03:53 +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

2 years agolib/ukstreambuf: Unit tests: Append operations for C-strings
Simon Kuenzer [Mon, 30 Jan 2023 02:51:50 +0000 (03:51 +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

2 years agolib/ukstreambuf: Unit tests: Initialization and basic operations
Simon Kuenzer [Mon, 30 Jan 2023 02:46:37 +0000 (03:46 +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

2 years agolib/ukstreambuf: Append operations for binary data
Simon Kuenzer [Mon, 30 Jan 2023 02:34:07 +0000 (03:34 +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

2 years agolib/ukstreambuf: Append operations for C-strings
Simon Kuenzer [Mon, 30 Jan 2023 02:30:49 +0000 (03:30 +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

2 years agolib/ukstreambuf: Initialization and basic operations
Simon Kuenzer [Mon, 30 Jan 2023 02:25:09 +0000 (03:25 +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

2 years agolib/ukstreambuf: Add library skeleton
Simon Kuenzer [Mon, 30 Jan 2023 02:13:20 +0000 (03:13 +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

2 years agolib/uksched: Silence warning about unused variable
Marc Rittinghaus [Fri, 3 Feb 2023 10:58:19 +0000 (11:58 +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

2 years agolib/ukschedcoop: Silence warning about unused args
Marc Rittinghaus [Fri, 3 Feb 2023 10:54:58 +0000 (11:54 +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

2 years agolib/ukdebug: Silence warnings about unused args
Marc Rittinghaus [Fri, 3 Feb 2023 10:53:20 +0000 (11:53 +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

2 years agolib/vfscore: Cast initrd vbase to (void *)
Simon Kuenzer [Fri, 3 Feb 2023 19:40:05 +0000 (20:40 +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

2 years agoplat/kvm: Enable Pointer Authentication in KVM
Michalis Pappas [Sun, 11 Dec 2022 12:17:58 +0000 (13:17 +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

2 years agoplat/common: Use ukarch_random to generate PAuth key
Michalis Pappas [Sun, 11 Dec 2022 12:13:37 +0000 (13:13 +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

2 years agoinclude/uk/plat: Fix initrd0 macro
Marc Rittinghaus [Fri, 3 Feb 2023 18:35:25 +0000 (19:35 +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

2 years agolib/ramfs: Add README.md file
Delia-Maria Pavel [Tue, 27 Dec 2022 14:43:48 +0000 (16:43 +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

2 years agolib/ramfs: Add comments to ramfs.h file
Delia-Maria Pavel [Tue, 27 Dec 2022 14:34:45 +0000 (16:34 +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

2 years agolib/uknofault: Fix warning with ukvmem
Marc Rittinghaus [Thu, 2 Feb 2023 19:30:04 +0000 (20:30 +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

2 years agolib/posix-mmap: Introduce POSIX memory functions
Marc Rittinghaus [Thu, 2 Feb 2023 18:47:36 +0000 (19:47 +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

2 years agodrivers/virtio: Use DMA mapping with ukvmem
Marc Rittinghaus [Thu, 2 Feb 2023 19:03:37 +0000 (20:03 +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

2 years agolib/ukboot: Initialize VAS + Heap
Marc Rittinghaus [Thu, 2 Feb 2023 18:45:51 +0000 (19:45 +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

2 years agolib/ukvmem: Introduce virtual memory library
Marc Rittinghaus [Thu, 2 Feb 2023 18:43:54 +0000 (19:43 +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

2 years agoinclude/plat: Update paging header to new CC
Marc Rittinghaus [Thu, 2 Feb 2023 18:19:37 +0000 (19:19 +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

2 years agoplat/common: Ignore non-existent PTEs
Marc Rittinghaus [Thu, 2 Feb 2023 18:37:19 +0000 (19:37 +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

2 years agoplat/common: Ignore -ENOMEM errors in pg_ffree()
Marc Rittinghaus [Thu, 2 Feb 2023 18:30:13 +0000 (19:30 +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

2 years agoplat/common: Introduce ukplat_page_k(un)map()
Marc Rittinghaus [Thu, 2 Feb 2023 18:17:43 +0000 (19:17 +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

2 years agoplat/common: Introduce ukplat_page_mapx()
Marc Rittinghaus [Thu, 2 Feb 2023 18:11:39 +0000 (19:11 +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

2 years agoinclude/arch/x86_64: Add page fault error bits
Marc Rittinghaus [Thu, 2 Feb 2023 17:52:40 +0000 (18:52 +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

2 years agoinclude/arch/x86_64: Add PT_Lx_PTE_SET_PADDR()
Marc Rittinghaus [Thu, 2 Feb 2023 17:48:40 +0000 (18:48 +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

2 years agoinclude/arch/[x86_64,arm64]: Add PAGE_SHIFT_Lx()
Marc Rittinghaus [Thu, 2 Feb 2023 17:44:33 +0000 (18:44 +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

2 years agoinclude/uk/plat: Fix PAGE_FLAG_SIZE_MASK
Marc Rittinghaus [Thu, 2 Feb 2023 17:36:36 +0000 (18:36 +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

2 years agoinclude/uk: Move PAGE_ATTR_PROT_* values
Marc Rittinghaus [Thu, 2 Feb 2023 17:34:18 +0000 (18:34 +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

2 years agolib/ukfallocbuddy: Build as ISR-safe
Marc Rittinghaus [Thu, 2 Feb 2023 17:31:05 +0000 (18:31 +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

2 years agoplat/kvm: Build paging code as ISR-safe
Marc Rittinghaus [Thu, 2 Feb 2023 17:28:41 +0000 (18:28 +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

2 years agoplat/kvm/x86: Fix cmdline parsing
Marc Rittinghaus [Fri, 3 Feb 2023 16:08:24 +0000 (17:08 +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

2 years agoplat/common/pci: Implement subclass matching
Marco Schlumpp [Thu, 16 Dec 2021 09:48:56 +0000 (10:48 +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

2 years agoplat/pci_ecam.c: Fix gcc-ism for clang compilation
Maria Sfiraiala [Wed, 21 Dec 2022 21:57:49 +0000 (23:57 +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

2 years agoplat/virtio_net: Notify host of RX bufs on start
Tu Dinh Ngoc [Mon, 28 Nov 2022 14:44:12 +0000 (15:44 +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

2 years agoplat/virtio_net: Fix device MTU detection
Tu Dinh Ngoc [Mon, 28 Nov 2022 14:43:57 +0000 (15:43 +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

2 years agolib/ukallocbbuddy: fix a memory leak
Nour-eddine Taleb [Wed, 14 Dec 2022 14:31:35 +0000 (15:31 +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

2 years agolib/nolibc: Use Linux-compatible stat structure
Razvan Deaconescu [Thu, 21 Jul 2022 06:19:01 +0000 (09:19 +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

2 years agoplat/*: Handle errors returned from IRQ event handlers
Marco Schlumpp [Fri, 20 Jan 2023 12:46:39 +0000 (13:46 +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

2 years agoplat/*: Add event for IRQs
Marco Schlumpp [Tue, 20 Dec 2022 14:46:35 +0000 (15:46 +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

2 years agoplat/*: Expose registers to main irq handler function
Marco Schlumpp [Fri, 16 Dec 2022 14:55:42 +0000 (15:55 +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

2 years agoinclude/event: Expose HANDLED_CONT return value
Marc Rittinghaus [Fri, 3 Feb 2023 10:02:21 +0000 (11:02 +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

2 years agolib/ukdebug: Use correct variable name for sect-strip.py tool
Marco Schlumpp [Fri, 16 Dec 2022 15:03:05 +0000 (16:03 +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

2 years agolib/posix-info: Comment out unused sysinfo buffer
Razvan Deaconescu [Thu, 12 May 2022 21:34:49 +0000 (00:34 +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

2 years agoplat/kvm: Ensure time monotonicity for tscclock
Marco Schlumpp [Fri, 28 Oct 2022 10:37:00 +0000 (12:37 +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

2 years agobuild: Check doc comments when compiling with clang
Marco Schlumpp [Mon, 28 Nov 2022 10:27:30 +0000 (11:27 +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

2 years agolib/vfscore: Add comments to vfs.h file
Radu Nichita [Sun, 1 Jan 2023 20:28:33 +0000 (22:28 +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

2 years agolib/vfscore: Introduce no-access-time flag
Marco Schlumpp [Tue, 19 Oct 2021 08:19:21 +0000 (10:19 +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

2 years agolib/vfscore: Add additional vnode modes
Marco Schlumpp [Tue, 19 Oct 2021 08:14:54 +0000 (10:14 +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

2 years agolib/uktest: Add README.md file
Stefan Jumarea [Sat, 17 Sep 2022 10:55:17 +0000 (13:55 +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

2 years agoplat/kvm/x86: Remove old bootinfo structure
Marc Rittinghaus [Tue, 17 Jan 2023 17:47:08 +0000 (18:47 +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

2 years agolib/ukboot: Add heap initialization
Marc Rittinghaus [Tue, 17 Jan 2023 17:45:10 +0000 (18:45 +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

2 years agoplat/kvm: Add generation of boot info
Marc Rittinghaus [Tue, 17 Jan 2023 17:36:04 +0000 (18:36 +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

2 years agoplat/kvm: Remove platform symbol hiding
Marc Rittinghaus [Tue, 17 Jan 2023 17:32:17 +0000 (18:32 +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

2 years agoplat/kvm: Use multiboot entry function
Marc Rittinghaus [Tue, 17 Jan 2023 17:28:52 +0000 (18:28 +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

2 years agoplat/kvm: Replace platform initialization code
Marc Rittinghaus [Tue, 17 Jan 2023 17:16:26 +0000 (18:16 +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

2 years agoplat/kvm: Add multiboot entry
Marc Rittinghaus [Tue, 17 Jan 2023 17:03:37 +0000 (18:03 +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

2 years agoplat/kvm: Back memregions by boot information
Marc Rittinghaus [Tue, 17 Jan 2023 16:57:13 +0000 (17:57 +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

2 years agoplat/common: Introduce boot information
Marc Rittinghaus [Tue, 17 Jan 2023 16:50:23 +0000 (17:50 +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

2 years agoplat/kvm: Complement multiboot header
Marc Rittinghaus [Tue, 17 Jan 2023 16:27:43 +0000 (17:27 +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

2 years agoplat/kvm: Combine multiboot headers
Marc Rittinghaus [Tue, 17 Jan 2023 16:18:04 +0000 (17:18 +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

2 years agoinclude/uk/plat/common: Add memregion list
Marc Rittinghaus [Tue, 17 Jan 2023 16:10:57 +0000 (17:10 +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

2 years agoplat/linuxu: Adapt to new memregion desc
Marc Rittinghaus [Tue, 17 Jan 2023 18:08:48 +0000 (19:08 +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

2 years agoplat/xen: Adapt to new memregion desc
Marc Rittinghaus [Tue, 17 Jan 2023 17:51:31 +0000 (18:51 +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

2 years agoplat/xen/x86: Adapt to new memregion desc
Marc Rittinghaus [Tue, 17 Jan 2023 17:50:18 +0000 (18:50 +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

2 years agoplat/xen/arm: Adapt to new memregion desc
Marc Rittinghaus [Tue, 17 Jan 2023 17:48:46 +0000 (18:48 +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

2 years agoplat/common: Adapt W^X to memregion desc
Marc Rittinghaus [Tue, 17 Jan 2023 15:59:10 +0000 (16:59 +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

2 years agolib/vfscore: Adapt to new memregion desc
Marc Rittinghaus [Tue, 17 Jan 2023 15:51:28 +0000 (16:51 +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

2 years agoinclude/uk/plat: Adapt documentation style
Marc Rittinghaus [Tue, 17 Jan 2023 15:49:54 +0000 (16:49 +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

2 years agoinclude/uk/plat: Extend memory region iteration
Marc Rittinghaus [Tue, 17 Jan 2023 15:46:37 +0000 (16:46 +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

2 years agoinclude/uk/plat: Extend memory region descriptor
Marc Rittinghaus [Tue, 17 Jan 2023 15:28:41 +0000 (16:28 +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

2 years agoarch/x86_64: Implement ukarch_random
Michalis Pappas [Sun, 20 Nov 2022 16:19:35 +0000 (17:19 +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

2 years agolib/ukparam: Accept arguments containing `=`
Tu Dinh Ngoc [Tue, 29 Nov 2022 15:01:21 +0000 (15:01 +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

2 years agolib/9pfs: Add mount option parsing
Tu Dinh Ngoc [Tue, 29 Nov 2022 10:43:32 +0000 (10:43 +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

2 years agolib/9pfs: Add 9p2000.L support
Tu Dinh Ngoc [Thu, 30 Jun 2022 18:22:28 +0000 (18:22 +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

2 years agolib/uk9p: Fix writes not accepting iounit of zero
Tu Dinh Ngoc [Fri, 14 Oct 2022 14:02:22 +0000 (14:02 +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

2 years agolib/nolibc: Expose rmdir/rename from nolibc
Marco Schlumpp [Tue, 19 Oct 2021 08:11:36 +0000 (10:11 +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 Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #622

2 years agoplat/kvm/x86: Remove .intrstack section
Marco Schlumpp [Wed, 1 Feb 2023 14:11:03 +0000 (15:11 +0100)]
plat/kvm/x86: Remove .intrstack section

We now rely on the bootloader to properly load the Unikernel ELF file.
Therefore, we don't be careful to not introduce alignment padding into
the final ELF file. This allows us to place the interrupt stacks in the
normal `.bss` section.

Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #698

2 years agobuild: Place sections into segments with correct permissions
Marco Schlumpp [Tue, 20 Dec 2022 09:20:08 +0000 (10:20 +0100)]
build: Place sections into segments with correct permissions

This hard-codes the permissions of the segments and assigns the sections
to the correct segments. Previously, many sections were just packed
together with other sections that had differing permissions. This
resulted in segments that had overly broad permission bits such as being
writable and executable.

Checkpatch-Ignore: SPACING
Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #698

2 years agoplat/kvm: Remove omagic flag and remove MULTIBOOT_AOUT_KLUDGE
Marco Schlumpp [Tue, 17 Jan 2023 17:35:47 +0000 (18:35 +0100)]
plat/kvm: Remove omagic flag and remove MULTIBOOT_AOUT_KLUDGE

The omagic flag has caused various issues such as having multiple
segments with different permissions on the same page or producing broken
ELF files. It was necessary because the multiboot header specified the
binary layout in a.out terms. This did not allow any padding between
segments.

With this patch we produce a 32-bit ELF file that is loadable by
QEMU/GRUB without having to resort to MULTIBOOT_AOUT_KLUDGE. This is
necessary because the multiboot protocol expects to a binary that will
start in protected mode. After Unikraft switched to long mode the ELF
file type is not relevant anymore. The `*.dbg` is still a 64-bit ELF
file that can be loaded into GDB to debug a running Unikraft instance in
QEMU. Because multiboot only allows 32-bit ELF files, this also means
that the `*.dbg` cannot be loaded anymore.

Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #698

2 years agobuild: Remove sect-strip.py tool
Marco Schlumpp [Tue, 20 Dec 2022 09:12:19 +0000 (10:12 +0100)]
build: Remove sect-strip.py tool

The script was only used for silencing a warning. Doing the same with
grep is shorter and simpler. In case there are sections to
strip it also saves an objcopy call.

Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #698

2 years agoarch/random: Update documentation of ukarch_random
Michalis Pappas [Sun, 25 Dec 2022 11:58:36 +0000 (12:58 +0100)]
arch/random: Update documentation of ukarch_random

Fix summary on ukarch_random_u32/u64. Remove implementation-specific
information from ukarch_random_seed_u32/u64.

Signed-off-by: Michalis Pappas <mpappas@fastmail.fm>
Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Approved-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #703